google-cloud-kms-v1 0.25.0 → 0.26.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -4
  3. data/README.md +3 -3
  4. data/lib/google/cloud/kms/v1/autokey/client.rb +713 -0
  5. data/lib/google/cloud/kms/v1/autokey/credentials.rb +52 -0
  6. data/lib/google/cloud/kms/v1/autokey/operations.rb +809 -0
  7. data/lib/google/cloud/kms/v1/autokey/paths.rb +90 -0
  8. data/lib/google/cloud/kms/v1/autokey/rest/client.rb +675 -0
  9. data/lib/google/cloud/kms/v1/autokey/rest/operations.rb +902 -0
  10. data/lib/google/cloud/kms/v1/autokey/rest/service_stub.rb +247 -0
  11. data/lib/google/cloud/kms/v1/autokey/rest.rb +70 -0
  12. data/lib/google/cloud/kms/v1/autokey.rb +72 -0
  13. data/lib/google/cloud/kms/v1/autokey_admin/client.rb +677 -0
  14. data/lib/google/cloud/kms/v1/autokey_admin/credentials.rb +52 -0
  15. data/lib/google/cloud/kms/v1/autokey_admin/paths.rb +61 -0
  16. data/lib/google/cloud/kms/v1/autokey_admin/rest/client.rb +639 -0
  17. data/lib/google/cloud/kms/v1/autokey_admin/rest/service_stub.rb +247 -0
  18. data/lib/google/cloud/kms/v1/autokey_admin/rest.rb +59 -0
  19. data/lib/google/cloud/kms/v1/autokey_admin.rb +61 -0
  20. data/lib/google/cloud/kms/v1/autokey_admin_pb.rb +53 -0
  21. data/lib/google/cloud/kms/v1/autokey_admin_services_pb.rb +62 -0
  22. data/lib/google/cloud/kms/v1/autokey_pb.rb +53 -0
  23. data/lib/google/cloud/kms/v1/autokey_services_pb.rb +71 -0
  24. data/lib/google/cloud/kms/v1/bindings_override.rb +1 -1
  25. data/lib/google/cloud/kms/v1/ekm_service/client.rb +17 -7
  26. data/lib/google/cloud/kms/v1/ekm_service/rest/client.rb +17 -7
  27. data/lib/google/cloud/kms/v1/key_management_service/client.rb +59 -28
  28. data/lib/google/cloud/kms/v1/key_management_service/rest/client.rb +59 -28
  29. data/lib/google/cloud/kms/v1/resources_pb.rb +1 -1
  30. data/lib/google/cloud/kms/v1/rest.rb +3 -1
  31. data/lib/google/cloud/kms/v1/version.rb +1 -1
  32. data/lib/google/cloud/kms/v1.rb +4 -2
  33. data/proto_docs/google/api/client.rb +4 -0
  34. data/proto_docs/google/cloud/kms/v1/autokey.rb +123 -0
  35. data/proto_docs/google/cloud/kms/v1/autokey_admin.rb +99 -0
  36. data/proto_docs/google/cloud/kms/v1/resources.rb +9 -10
  37. data/proto_docs/google/longrunning/operations.rb +164 -0
  38. data/proto_docs/google/protobuf/empty.rb +34 -0
  39. data/proto_docs/google/rpc/status.rb +48 -0
  40. metadata +27 -2
@@ -0,0 +1,677 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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/kms/v1/autokey_admin_pb"
21
+ require "google/cloud/location"
22
+ require "google/iam/v1"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Kms
27
+ module V1
28
+ module AutokeyAdmin
29
+ ##
30
+ # Client for the AutokeyAdmin service.
31
+ #
32
+ # Provides interfaces for managing Cloud KMS Autokey folder-level
33
+ # configurations. A configuration is inherited by all descendent projects. A
34
+ # configuration at one folder overrides any other configurations in its
35
+ # ancestry. Setting a configuration on a folder is a prerequisite for Cloud KMS
36
+ # Autokey, so that users working in a descendant project can request
37
+ # provisioned {::Google::Cloud::Kms::V1::CryptoKey CryptoKeys}, ready for Customer
38
+ # Managed Encryption Key (CMEK) use, on-demand.
39
+ #
40
+ class Client
41
+ # @private
42
+ API_VERSION = ""
43
+
44
+ # @private
45
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudkms.$UNIVERSE_DOMAIN$"
46
+
47
+ include Paths
48
+
49
+ # @private
50
+ attr_reader :autokey_admin_stub
51
+
52
+ ##
53
+ # Configure the AutokeyAdmin Client class.
54
+ #
55
+ # See {::Google::Cloud::Kms::V1::AutokeyAdmin::Client::Configuration}
56
+ # for a description of the configuration fields.
57
+ #
58
+ # @example
59
+ #
60
+ # # Modify the configuration for all AutokeyAdmin clients
61
+ # ::Google::Cloud::Kms::V1::AutokeyAdmin::Client.configure do |config|
62
+ # config.timeout = 10.0
63
+ # end
64
+ #
65
+ # @yield [config] Configure the Client client.
66
+ # @yieldparam config [Client::Configuration]
67
+ #
68
+ # @return [Client::Configuration]
69
+ #
70
+ def self.configure
71
+ @configure ||= begin
72
+ namespace = ["Google", "Cloud", "Kms", "V1"]
73
+ parent_config = while namespace.any?
74
+ parent_name = namespace.join "::"
75
+ parent_const = const_get parent_name
76
+ break parent_const.configure if parent_const.respond_to? :configure
77
+ namespace.pop
78
+ end
79
+ default_config = Client::Configuration.new parent_config
80
+
81
+ default_config.rpcs.update_autokey_config.timeout = 60.0
82
+ default_config.rpcs.update_autokey_config.retry_policy = {
83
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
84
+ }
85
+
86
+ default_config.rpcs.get_autokey_config.timeout = 60.0
87
+ default_config.rpcs.get_autokey_config.retry_policy = {
88
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
89
+ }
90
+
91
+ default_config.rpcs.show_effective_autokey_config.timeout = 60.0
92
+ default_config.rpcs.show_effective_autokey_config.retry_policy = {
93
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
94
+ }
95
+
96
+ default_config
97
+ end
98
+ yield @configure if block_given?
99
+ @configure
100
+ end
101
+
102
+ ##
103
+ # Configure the AutokeyAdmin Client instance.
104
+ #
105
+ # The configuration is set to the derived mode, meaning that values can be changed,
106
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
107
+ # should be made on {Client.configure}.
108
+ #
109
+ # See {::Google::Cloud::Kms::V1::AutokeyAdmin::Client::Configuration}
110
+ # for a description of the configuration fields.
111
+ #
112
+ # @yield [config] Configure the Client client.
113
+ # @yieldparam config [Client::Configuration]
114
+ #
115
+ # @return [Client::Configuration]
116
+ #
117
+ def configure
118
+ yield @config if block_given?
119
+ @config
120
+ end
121
+
122
+ ##
123
+ # The effective universe domain
124
+ #
125
+ # @return [String]
126
+ #
127
+ def universe_domain
128
+ @autokey_admin_stub.universe_domain
129
+ end
130
+
131
+ ##
132
+ # Create a new AutokeyAdmin client object.
133
+ #
134
+ # @example
135
+ #
136
+ # # Create a client using the default configuration
137
+ # client = ::Google::Cloud::Kms::V1::AutokeyAdmin::Client.new
138
+ #
139
+ # # Create a client using a custom configuration
140
+ # client = ::Google::Cloud::Kms::V1::AutokeyAdmin::Client.new do |config|
141
+ # config.timeout = 10.0
142
+ # end
143
+ #
144
+ # @yield [config] Configure the AutokeyAdmin client.
145
+ # @yieldparam config [Client::Configuration]
146
+ #
147
+ def initialize
148
+ # These require statements are intentionally placed here to initialize
149
+ # the gRPC module only when it's required.
150
+ # See https://github.com/googleapis/toolkit/issues/446
151
+ require "gapic/grpc"
152
+ require "google/cloud/kms/v1/autokey_admin_services_pb"
153
+
154
+ # Create the configuration object
155
+ @config = Configuration.new Client.configure
156
+
157
+ # Yield the configuration if needed
158
+ yield @config if block_given?
159
+
160
+ # Create credentials
161
+ credentials = @config.credentials
162
+ # Use self-signed JWT if the endpoint is unchanged from default,
163
+ # but only if the default endpoint does not have a region prefix.
164
+ enable_self_signed_jwt = @config.endpoint.nil? ||
165
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
166
+ !@config.endpoint.split(".").first.include?("-"))
167
+ credentials ||= Credentials.default scope: @config.scope,
168
+ enable_self_signed_jwt: enable_self_signed_jwt
169
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
170
+ credentials = Credentials.new credentials, scope: @config.scope
171
+ end
172
+ @quota_project_id = @config.quota_project
173
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
174
+
175
+ @autokey_admin_stub = ::Gapic::ServiceStub.new(
176
+ ::Google::Cloud::Kms::V1::AutokeyAdmin::Stub,
177
+ credentials: credentials,
178
+ endpoint: @config.endpoint,
179
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
180
+ universe_domain: @config.universe_domain,
181
+ channel_args: @config.channel_args,
182
+ interceptors: @config.interceptors,
183
+ channel_pool_config: @config.channel_pool
184
+ )
185
+
186
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
187
+ config.credentials = credentials
188
+ config.quota_project = @quota_project_id
189
+ config.endpoint = @autokey_admin_stub.endpoint
190
+ config.universe_domain = @autokey_admin_stub.universe_domain
191
+ end
192
+
193
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
194
+ config.credentials = credentials
195
+ config.quota_project = @quota_project_id
196
+ config.endpoint = @autokey_admin_stub.endpoint
197
+ config.universe_domain = @autokey_admin_stub.universe_domain
198
+ end
199
+ end
200
+
201
+ ##
202
+ # Get the associated client for mix-in of the Locations.
203
+ #
204
+ # @return [Google::Cloud::Location::Locations::Client]
205
+ #
206
+ attr_reader :location_client
207
+
208
+ ##
209
+ # Get the associated client for mix-in of the IAMPolicy.
210
+ #
211
+ # @return [Google::Iam::V1::IAMPolicy::Client]
212
+ #
213
+ attr_reader :iam_policy_client
214
+
215
+ # Service calls
216
+
217
+ ##
218
+ # Updates the {::Google::Cloud::Kms::V1::AutokeyConfig AutokeyConfig} for a
219
+ # folder. The caller must have both `cloudkms.autokeyConfigs.update`
220
+ # permission on the parent folder and `cloudkms.cryptoKeys.setIamPolicy`
221
+ # permission on the provided key project. A
222
+ # {::Google::Cloud::Kms::V1::KeyHandle KeyHandle} creation in the folder's
223
+ # descendant projects will use this configuration to determine where to
224
+ # create the resulting {::Google::Cloud::Kms::V1::CryptoKey CryptoKey}.
225
+ #
226
+ # @overload update_autokey_config(request, options = nil)
227
+ # Pass arguments to `update_autokey_config` via a request object, either of type
228
+ # {::Google::Cloud::Kms::V1::UpdateAutokeyConfigRequest} or an equivalent Hash.
229
+ #
230
+ # @param request [::Google::Cloud::Kms::V1::UpdateAutokeyConfigRequest, ::Hash]
231
+ # A request object representing the call parameters. Required. To specify no
232
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
233
+ # @param options [::Gapic::CallOptions, ::Hash]
234
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
235
+ #
236
+ # @overload update_autokey_config(autokey_config: nil, update_mask: nil)
237
+ # Pass arguments to `update_autokey_config` via keyword arguments. Note that at
238
+ # least one keyword argument is required. To specify no parameters, or to keep all
239
+ # the default parameter values, pass an empty Hash as a request object (see above).
240
+ #
241
+ # @param autokey_config [::Google::Cloud::Kms::V1::AutokeyConfig, ::Hash]
242
+ # Required. {::Google::Cloud::Kms::V1::AutokeyConfig AutokeyConfig} with values to
243
+ # update.
244
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
245
+ # Required. Masks which fields of the
246
+ # {::Google::Cloud::Kms::V1::AutokeyConfig AutokeyConfig} to update, e.g.
247
+ # `keyProject`.
248
+ #
249
+ # @yield [response, operation] Access the result along with the RPC operation
250
+ # @yieldparam response [::Google::Cloud::Kms::V1::AutokeyConfig]
251
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
252
+ #
253
+ # @return [::Google::Cloud::Kms::V1::AutokeyConfig]
254
+ #
255
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
256
+ #
257
+ # @example Basic example
258
+ # require "google/cloud/kms/v1"
259
+ #
260
+ # # Create a client object. The client can be reused for multiple calls.
261
+ # client = Google::Cloud::Kms::V1::AutokeyAdmin::Client.new
262
+ #
263
+ # # Create a request. To set request fields, pass in keyword arguments.
264
+ # request = Google::Cloud::Kms::V1::UpdateAutokeyConfigRequest.new
265
+ #
266
+ # # Call the update_autokey_config method.
267
+ # result = client.update_autokey_config request
268
+ #
269
+ # # The returned object is of type Google::Cloud::Kms::V1::AutokeyConfig.
270
+ # p result
271
+ #
272
+ def update_autokey_config request, options = nil
273
+ raise ::ArgumentError, "request must be provided" if request.nil?
274
+
275
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::UpdateAutokeyConfigRequest
276
+
277
+ # Converts hash and nil to an options object
278
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
279
+
280
+ # Customize the options with defaults
281
+ metadata = @config.rpcs.update_autokey_config.metadata.to_h
282
+
283
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
284
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
285
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
286
+ gapic_version: ::Google::Cloud::Kms::V1::VERSION
287
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
288
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
289
+
290
+ header_params = {}
291
+ if request.autokey_config&.name
292
+ header_params["autokey_config.name"] = request.autokey_config.name
293
+ end
294
+
295
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
296
+ metadata[:"x-goog-request-params"] ||= request_params_header
297
+
298
+ options.apply_defaults timeout: @config.rpcs.update_autokey_config.timeout,
299
+ metadata: metadata,
300
+ retry_policy: @config.rpcs.update_autokey_config.retry_policy
301
+
302
+ options.apply_defaults timeout: @config.timeout,
303
+ metadata: @config.metadata,
304
+ retry_policy: @config.retry_policy
305
+
306
+ @autokey_admin_stub.call_rpc :update_autokey_config, request, options: options do |response, operation|
307
+ yield response, operation if block_given?
308
+ return response
309
+ end
310
+ rescue ::GRPC::BadStatus => e
311
+ raise ::Google::Cloud::Error.from_error(e)
312
+ end
313
+
314
+ ##
315
+ # Returns the {::Google::Cloud::Kms::V1::AutokeyConfig AutokeyConfig} for a
316
+ # folder.
317
+ #
318
+ # @overload get_autokey_config(request, options = nil)
319
+ # Pass arguments to `get_autokey_config` via a request object, either of type
320
+ # {::Google::Cloud::Kms::V1::GetAutokeyConfigRequest} or an equivalent Hash.
321
+ #
322
+ # @param request [::Google::Cloud::Kms::V1::GetAutokeyConfigRequest, ::Hash]
323
+ # A request object representing the call parameters. Required. To specify no
324
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
325
+ # @param options [::Gapic::CallOptions, ::Hash]
326
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
327
+ #
328
+ # @overload get_autokey_config(name: nil)
329
+ # Pass arguments to `get_autokey_config` via keyword arguments. Note that at
330
+ # least one keyword argument is required. To specify no parameters, or to keep all
331
+ # the default parameter values, pass an empty Hash as a request object (see above).
332
+ #
333
+ # @param name [::String]
334
+ # Required. Name of the {::Google::Cloud::Kms::V1::AutokeyConfig AutokeyConfig}
335
+ # resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig`.
336
+ #
337
+ # @yield [response, operation] Access the result along with the RPC operation
338
+ # @yieldparam response [::Google::Cloud::Kms::V1::AutokeyConfig]
339
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
340
+ #
341
+ # @return [::Google::Cloud::Kms::V1::AutokeyConfig]
342
+ #
343
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
344
+ #
345
+ # @example Basic example
346
+ # require "google/cloud/kms/v1"
347
+ #
348
+ # # Create a client object. The client can be reused for multiple calls.
349
+ # client = Google::Cloud::Kms::V1::AutokeyAdmin::Client.new
350
+ #
351
+ # # Create a request. To set request fields, pass in keyword arguments.
352
+ # request = Google::Cloud::Kms::V1::GetAutokeyConfigRequest.new
353
+ #
354
+ # # Call the get_autokey_config method.
355
+ # result = client.get_autokey_config request
356
+ #
357
+ # # The returned object is of type Google::Cloud::Kms::V1::AutokeyConfig.
358
+ # p result
359
+ #
360
+ def get_autokey_config request, options = nil
361
+ raise ::ArgumentError, "request must be provided" if request.nil?
362
+
363
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::GetAutokeyConfigRequest
364
+
365
+ # Converts hash and nil to an options object
366
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
367
+
368
+ # Customize the options with defaults
369
+ metadata = @config.rpcs.get_autokey_config.metadata.to_h
370
+
371
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
372
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
373
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
374
+ gapic_version: ::Google::Cloud::Kms::V1::VERSION
375
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
376
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
377
+
378
+ header_params = {}
379
+ if request.name
380
+ header_params["name"] = request.name
381
+ end
382
+
383
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
384
+ metadata[:"x-goog-request-params"] ||= request_params_header
385
+
386
+ options.apply_defaults timeout: @config.rpcs.get_autokey_config.timeout,
387
+ metadata: metadata,
388
+ retry_policy: @config.rpcs.get_autokey_config.retry_policy
389
+
390
+ options.apply_defaults timeout: @config.timeout,
391
+ metadata: @config.metadata,
392
+ retry_policy: @config.retry_policy
393
+
394
+ @autokey_admin_stub.call_rpc :get_autokey_config, request, options: options do |response, operation|
395
+ yield response, operation if block_given?
396
+ return response
397
+ end
398
+ rescue ::GRPC::BadStatus => e
399
+ raise ::Google::Cloud::Error.from_error(e)
400
+ end
401
+
402
+ ##
403
+ # Returns the effective Cloud KMS Autokey configuration for a given project.
404
+ #
405
+ # @overload show_effective_autokey_config(request, options = nil)
406
+ # Pass arguments to `show_effective_autokey_config` via a request object, either of type
407
+ # {::Google::Cloud::Kms::V1::ShowEffectiveAutokeyConfigRequest} or an equivalent Hash.
408
+ #
409
+ # @param request [::Google::Cloud::Kms::V1::ShowEffectiveAutokeyConfigRequest, ::Hash]
410
+ # A request object representing the call parameters. Required. To specify no
411
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
412
+ # @param options [::Gapic::CallOptions, ::Hash]
413
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
414
+ #
415
+ # @overload show_effective_autokey_config(parent: nil)
416
+ # Pass arguments to `show_effective_autokey_config` via keyword arguments. Note that at
417
+ # least one keyword argument is required. To specify no parameters, or to keep all
418
+ # the default parameter values, pass an empty Hash as a request object (see above).
419
+ #
420
+ # @param parent [::String]
421
+ # Required. Name of the resource project to the show effective Cloud KMS
422
+ # Autokey configuration for. This may be helpful for interrogating the effect
423
+ # of nested folder configurations on a given resource project.
424
+ #
425
+ # @yield [response, operation] Access the result along with the RPC operation
426
+ # @yieldparam response [::Google::Cloud::Kms::V1::ShowEffectiveAutokeyConfigResponse]
427
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
428
+ #
429
+ # @return [::Google::Cloud::Kms::V1::ShowEffectiveAutokeyConfigResponse]
430
+ #
431
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
432
+ #
433
+ # @example Basic example
434
+ # require "google/cloud/kms/v1"
435
+ #
436
+ # # Create a client object. The client can be reused for multiple calls.
437
+ # client = Google::Cloud::Kms::V1::AutokeyAdmin::Client.new
438
+ #
439
+ # # Create a request. To set request fields, pass in keyword arguments.
440
+ # request = Google::Cloud::Kms::V1::ShowEffectiveAutokeyConfigRequest.new
441
+ #
442
+ # # Call the show_effective_autokey_config method.
443
+ # result = client.show_effective_autokey_config request
444
+ #
445
+ # # The returned object is of type Google::Cloud::Kms::V1::ShowEffectiveAutokeyConfigResponse.
446
+ # p result
447
+ #
448
+ def show_effective_autokey_config request, options = nil
449
+ raise ::ArgumentError, "request must be provided" if request.nil?
450
+
451
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::ShowEffectiveAutokeyConfigRequest
452
+
453
+ # Converts hash and nil to an options object
454
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
455
+
456
+ # Customize the options with defaults
457
+ metadata = @config.rpcs.show_effective_autokey_config.metadata.to_h
458
+
459
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
460
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
461
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
462
+ gapic_version: ::Google::Cloud::Kms::V1::VERSION
463
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
464
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
465
+
466
+ header_params = {}
467
+ if request.parent
468
+ header_params["parent"] = request.parent
469
+ end
470
+
471
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
472
+ metadata[:"x-goog-request-params"] ||= request_params_header
473
+
474
+ options.apply_defaults timeout: @config.rpcs.show_effective_autokey_config.timeout,
475
+ metadata: metadata,
476
+ retry_policy: @config.rpcs.show_effective_autokey_config.retry_policy
477
+
478
+ options.apply_defaults timeout: @config.timeout,
479
+ metadata: @config.metadata,
480
+ retry_policy: @config.retry_policy
481
+
482
+ @autokey_admin_stub.call_rpc :show_effective_autokey_config, request, options: options do |response, operation|
483
+ yield response, operation if block_given?
484
+ return response
485
+ end
486
+ rescue ::GRPC::BadStatus => e
487
+ raise ::Google::Cloud::Error.from_error(e)
488
+ end
489
+
490
+ ##
491
+ # Configuration class for the AutokeyAdmin API.
492
+ #
493
+ # This class represents the configuration for AutokeyAdmin,
494
+ # providing control over timeouts, retry behavior, logging, transport
495
+ # parameters, and other low-level controls. Certain parameters can also be
496
+ # applied individually to specific RPCs. See
497
+ # {::Google::Cloud::Kms::V1::AutokeyAdmin::Client::Configuration::Rpcs}
498
+ # for a list of RPCs that can be configured independently.
499
+ #
500
+ # Configuration can be applied globally to all clients, or to a single client
501
+ # on construction.
502
+ #
503
+ # @example
504
+ #
505
+ # # Modify the global config, setting the timeout for
506
+ # # update_autokey_config to 20 seconds,
507
+ # # and all remaining timeouts to 10 seconds.
508
+ # ::Google::Cloud::Kms::V1::AutokeyAdmin::Client.configure do |config|
509
+ # config.timeout = 10.0
510
+ # config.rpcs.update_autokey_config.timeout = 20.0
511
+ # end
512
+ #
513
+ # # Apply the above configuration only to a new client.
514
+ # client = ::Google::Cloud::Kms::V1::AutokeyAdmin::Client.new do |config|
515
+ # config.timeout = 10.0
516
+ # config.rpcs.update_autokey_config.timeout = 20.0
517
+ # end
518
+ #
519
+ # @!attribute [rw] endpoint
520
+ # A custom service endpoint, as a hostname or hostname:port. The default is
521
+ # nil, indicating to use the default endpoint in the current universe domain.
522
+ # @return [::String,nil]
523
+ # @!attribute [rw] credentials
524
+ # Credentials to send with calls. You may provide any of the following types:
525
+ # * (`String`) The path to a service account key file in JSON format
526
+ # * (`Hash`) A service account key as a Hash
527
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
528
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
529
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
530
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
531
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
532
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
533
+ # * (`nil`) indicating no credentials
534
+ # @return [::Object]
535
+ # @!attribute [rw] scope
536
+ # The OAuth scopes
537
+ # @return [::Array<::String>]
538
+ # @!attribute [rw] lib_name
539
+ # The library name as recorded in instrumentation and logging
540
+ # @return [::String]
541
+ # @!attribute [rw] lib_version
542
+ # The library version as recorded in instrumentation and logging
543
+ # @return [::String]
544
+ # @!attribute [rw] channel_args
545
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
546
+ # `GRPC::Core::Channel` object is provided as the credential.
547
+ # @return [::Hash]
548
+ # @!attribute [rw] interceptors
549
+ # An array of interceptors that are run before calls are executed.
550
+ # @return [::Array<::GRPC::ClientInterceptor>]
551
+ # @!attribute [rw] timeout
552
+ # The call timeout in seconds.
553
+ # @return [::Numeric]
554
+ # @!attribute [rw] metadata
555
+ # Additional gRPC headers to be sent with the call.
556
+ # @return [::Hash{::Symbol=>::String}]
557
+ # @!attribute [rw] retry_policy
558
+ # The retry policy. The value is a hash with the following keys:
559
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
560
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
561
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
562
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
563
+ # trigger a retry.
564
+ # @return [::Hash]
565
+ # @!attribute [rw] quota_project
566
+ # A separate project against which to charge quota.
567
+ # @return [::String]
568
+ # @!attribute [rw] universe_domain
569
+ # The universe domain within which to make requests. This determines the
570
+ # default endpoint URL. The default value of nil uses the environment
571
+ # universe (usually the default "googleapis.com" universe).
572
+ # @return [::String,nil]
573
+ #
574
+ class Configuration
575
+ extend ::Gapic::Config
576
+
577
+ # @private
578
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
579
+ DEFAULT_ENDPOINT = "cloudkms.googleapis.com"
580
+
581
+ config_attr :endpoint, nil, ::String, nil
582
+ config_attr :credentials, nil do |value|
583
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
584
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
585
+ allowed.any? { |klass| klass === value }
586
+ end
587
+ config_attr :scope, nil, ::String, ::Array, nil
588
+ config_attr :lib_name, nil, ::String, nil
589
+ config_attr :lib_version, nil, ::String, nil
590
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
591
+ config_attr :interceptors, nil, ::Array, nil
592
+ config_attr :timeout, nil, ::Numeric, nil
593
+ config_attr :metadata, nil, ::Hash, nil
594
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
595
+ config_attr :quota_project, nil, ::String, nil
596
+ config_attr :universe_domain, nil, ::String, nil
597
+
598
+ # @private
599
+ def initialize parent_config = nil
600
+ @parent_config = parent_config unless parent_config.nil?
601
+
602
+ yield self if block_given?
603
+ end
604
+
605
+ ##
606
+ # Configurations for individual RPCs
607
+ # @return [Rpcs]
608
+ #
609
+ def rpcs
610
+ @rpcs ||= begin
611
+ parent_rpcs = nil
612
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
613
+ Rpcs.new parent_rpcs
614
+ end
615
+ end
616
+
617
+ ##
618
+ # Configuration for the channel pool
619
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
620
+ #
621
+ def channel_pool
622
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
623
+ end
624
+
625
+ ##
626
+ # Configuration RPC class for the AutokeyAdmin API.
627
+ #
628
+ # Includes fields providing the configuration for each RPC in this service.
629
+ # Each configuration object is of type `Gapic::Config::Method` and includes
630
+ # the following configuration fields:
631
+ #
632
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
633
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
634
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
635
+ # include the following keys:
636
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
637
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
638
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
639
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
640
+ # trigger a retry.
641
+ #
642
+ class Rpcs
643
+ ##
644
+ # RPC-specific configuration for `update_autokey_config`
645
+ # @return [::Gapic::Config::Method]
646
+ #
647
+ attr_reader :update_autokey_config
648
+ ##
649
+ # RPC-specific configuration for `get_autokey_config`
650
+ # @return [::Gapic::Config::Method]
651
+ #
652
+ attr_reader :get_autokey_config
653
+ ##
654
+ # RPC-specific configuration for `show_effective_autokey_config`
655
+ # @return [::Gapic::Config::Method]
656
+ #
657
+ attr_reader :show_effective_autokey_config
658
+
659
+ # @private
660
+ def initialize parent_rpcs = nil
661
+ update_autokey_config_config = parent_rpcs.update_autokey_config if parent_rpcs.respond_to? :update_autokey_config
662
+ @update_autokey_config = ::Gapic::Config::Method.new update_autokey_config_config
663
+ get_autokey_config_config = parent_rpcs.get_autokey_config if parent_rpcs.respond_to? :get_autokey_config
664
+ @get_autokey_config = ::Gapic::Config::Method.new get_autokey_config_config
665
+ show_effective_autokey_config_config = parent_rpcs.show_effective_autokey_config if parent_rpcs.respond_to? :show_effective_autokey_config
666
+ @show_effective_autokey_config = ::Gapic::Config::Method.new show_effective_autokey_config_config
667
+
668
+ yield self if block_given?
669
+ end
670
+ end
671
+ end
672
+ end
673
+ end
674
+ end
675
+ end
676
+ end
677
+ end