google-cloud-kms-v1 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,650 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/ekm_service_pb"
21
+ require "google/cloud/kms/v1/ekm_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+ require "google/iam/v1/rest"
24
+
25
+ module Google
26
+ module Cloud
27
+ module Kms
28
+ module V1
29
+ module EkmService
30
+ module Rest
31
+ ##
32
+ # REST client for the EkmService service.
33
+ #
34
+ # Google Cloud Key Management EKM Service
35
+ #
36
+ # Manages external cryptographic keys and operations using those keys.
37
+ # Implements a REST model with the following objects:
38
+ # * {::Google::Cloud::Kms::V1::EkmConnection EkmConnection}
39
+ #
40
+ class Client
41
+ include Paths
42
+
43
+ # @private
44
+ attr_reader :ekm_service_stub
45
+
46
+ ##
47
+ # Configure the EkmService Client class.
48
+ #
49
+ # See {::Google::Cloud::Kms::V1::EkmService::Rest::Client::Configuration}
50
+ # for a description of the configuration fields.
51
+ #
52
+ # @example
53
+ #
54
+ # # Modify the configuration for all EkmService clients
55
+ # ::Google::Cloud::Kms::V1::EkmService::Rest::Client.configure do |config|
56
+ # config.timeout = 10.0
57
+ # end
58
+ #
59
+ # @yield [config] Configure the Client client.
60
+ # @yieldparam config [Client::Configuration]
61
+ #
62
+ # @return [Client::Configuration]
63
+ #
64
+ def self.configure
65
+ @configure ||= begin
66
+ namespace = ["Google", "Cloud", "Kms", "V1"]
67
+ parent_config = while namespace.any?
68
+ parent_name = namespace.join "::"
69
+ parent_const = const_get parent_name
70
+ break parent_const.configure if parent_const.respond_to? :configure
71
+ namespace.pop
72
+ end
73
+ default_config = Client::Configuration.new parent_config
74
+
75
+ default_config.rpcs.list_ekm_connections.timeout = 60.0
76
+ default_config.rpcs.list_ekm_connections.retry_policy = {
77
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
78
+ }
79
+
80
+ default_config.rpcs.get_ekm_connection.timeout = 60.0
81
+ default_config.rpcs.get_ekm_connection.retry_policy = {
82
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
83
+ }
84
+
85
+ default_config.rpcs.create_ekm_connection.timeout = 60.0
86
+ default_config.rpcs.create_ekm_connection.retry_policy = {
87
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
88
+ }
89
+
90
+ default_config.rpcs.update_ekm_connection.timeout = 60.0
91
+ default_config.rpcs.update_ekm_connection.retry_policy = {
92
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
93
+ }
94
+
95
+ default_config
96
+ end
97
+ yield @configure if block_given?
98
+ @configure
99
+ end
100
+
101
+ ##
102
+ # Configure the EkmService Client instance.
103
+ #
104
+ # The configuration is set to the derived mode, meaning that values can be changed,
105
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
106
+ # should be made on {Client.configure}.
107
+ #
108
+ # See {::Google::Cloud::Kms::V1::EkmService::Rest::Client::Configuration}
109
+ # for a description of the configuration fields.
110
+ #
111
+ # @yield [config] Configure the Client client.
112
+ # @yieldparam config [Client::Configuration]
113
+ #
114
+ # @return [Client::Configuration]
115
+ #
116
+ def configure
117
+ yield @config if block_given?
118
+ @config
119
+ end
120
+
121
+ ##
122
+ # Create a new EkmService REST client object.
123
+ #
124
+ # @example
125
+ #
126
+ # # Create a client using the default configuration
127
+ # client = ::Google::Cloud::Kms::V1::EkmService::Rest::Client.new
128
+ #
129
+ # # Create a client using a custom configuration
130
+ # client = ::Google::Cloud::Kms::V1::EkmService::Rest::Client.new do |config|
131
+ # config.timeout = 10.0
132
+ # end
133
+ #
134
+ # @yield [config] Configure the EkmService client.
135
+ # @yieldparam config [Client::Configuration]
136
+ #
137
+ def initialize
138
+ # Create the configuration object
139
+ @config = Configuration.new Client.configure
140
+
141
+ # Yield the configuration if needed
142
+ yield @config if block_given?
143
+
144
+ # Create credentials
145
+ credentials = @config.credentials
146
+ # Use self-signed JWT if the endpoint is unchanged from default,
147
+ # but only if the default endpoint does not have a region prefix.
148
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
149
+ !@config.endpoint.split(".").first.include?("-")
150
+ credentials ||= Credentials.default scope: @config.scope,
151
+ enable_self_signed_jwt: enable_self_signed_jwt
152
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
153
+ credentials = Credentials.new credentials, scope: @config.scope
154
+ end
155
+
156
+ @quota_project_id = @config.quota_project
157
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
158
+
159
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
160
+ config.credentials = credentials
161
+ config.quota_project = @quota_project_id
162
+ config.endpoint = @config.endpoint
163
+ config.bindings_override = @config.bindings_override
164
+ end
165
+
166
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
167
+ config.credentials = credentials
168
+ config.quota_project = @quota_project_id
169
+ config.endpoint = @config.endpoint
170
+ config.bindings_override = @config.bindings_override
171
+ end
172
+
173
+ @ekm_service_stub = ::Google::Cloud::Kms::V1::EkmService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
174
+ end
175
+
176
+ ##
177
+ # Get the associated client for mix-in of the Locations.
178
+ #
179
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
180
+ #
181
+ attr_reader :location_client
182
+
183
+ ##
184
+ # Get the associated client for mix-in of the IAMPolicy.
185
+ #
186
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
187
+ #
188
+ attr_reader :iam_policy_client
189
+
190
+ # Service calls
191
+
192
+ ##
193
+ # Lists {::Google::Cloud::Kms::V1::EkmConnection EkmConnections}.
194
+ #
195
+ # @overload list_ekm_connections(request, options = nil)
196
+ # Pass arguments to `list_ekm_connections` via a request object, either of type
197
+ # {::Google::Cloud::Kms::V1::ListEkmConnectionsRequest} or an equivalent Hash.
198
+ #
199
+ # @param request [::Google::Cloud::Kms::V1::ListEkmConnectionsRequest, ::Hash]
200
+ # A request object representing the call parameters. Required. To specify no
201
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
202
+ # @param options [::Gapic::CallOptions, ::Hash]
203
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
204
+ #
205
+ # @overload list_ekm_connections(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
206
+ # Pass arguments to `list_ekm_connections` via keyword arguments. Note that at
207
+ # least one keyword argument is required. To specify no parameters, or to keep all
208
+ # the default parameter values, pass an empty Hash as a request object (see above).
209
+ #
210
+ # @param parent [::String]
211
+ # Required. The resource name of the location associated with the
212
+ # {::Google::Cloud::Kms::V1::EkmConnection EkmConnections} to list, in the format
213
+ # `projects/*/locations/*`.
214
+ # @param page_size [::Integer]
215
+ # Optional. Optional limit on the number of
216
+ # {::Google::Cloud::Kms::V1::EkmConnection EkmConnections} to include in the
217
+ # response. Further {::Google::Cloud::Kms::V1::EkmConnection EkmConnections} can
218
+ # subsequently be obtained by including the
219
+ # {::Google::Cloud::Kms::V1::ListEkmConnectionsResponse#next_page_token ListEkmConnectionsResponse.next_page_token}
220
+ # in a subsequent request. If unspecified, the server will pick an
221
+ # appropriate default.
222
+ # @param page_token [::String]
223
+ # Optional. Optional pagination token, returned earlier via
224
+ # {::Google::Cloud::Kms::V1::ListEkmConnectionsResponse#next_page_token ListEkmConnectionsResponse.next_page_token}.
225
+ # @param filter [::String]
226
+ # Optional. Only include resources that match the filter in the response. For
227
+ # more information, see
228
+ # [Sorting and filtering list
229
+ # results](https://cloud.google.com/kms/docs/sorting-and-filtering).
230
+ # @param order_by [::String]
231
+ # Optional. Specify how the results should be sorted. If not specified, the
232
+ # results will be sorted in the default order. For more information, see
233
+ # [Sorting and filtering list
234
+ # results](https://cloud.google.com/kms/docs/sorting-and-filtering).
235
+ # @yield [result, operation] Access the result along with the TransportOperation object
236
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Kms::V1::EkmConnection>]
237
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
238
+ #
239
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Kms::V1::EkmConnection>]
240
+ #
241
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
242
+ def list_ekm_connections request, options = nil
243
+ raise ::ArgumentError, "request must be provided" if request.nil?
244
+
245
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::ListEkmConnectionsRequest
246
+
247
+ # Converts hash and nil to an options object
248
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
249
+
250
+ # Customize the options with defaults
251
+ call_metadata = @config.rpcs.list_ekm_connections.metadata.to_h
252
+
253
+ # Set x-goog-api-client and x-goog-user-project headers
254
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
255
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
256
+ gapic_version: ::Google::Cloud::Kms::V1::VERSION,
257
+ transports_version_send: [:rest]
258
+
259
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
260
+
261
+ options.apply_defaults timeout: @config.rpcs.list_ekm_connections.timeout,
262
+ metadata: call_metadata,
263
+ retry_policy: @config.rpcs.list_ekm_connections.retry_policy
264
+
265
+ options.apply_defaults timeout: @config.timeout,
266
+ metadata: @config.metadata,
267
+ retry_policy: @config.retry_policy
268
+
269
+ @ekm_service_stub.list_ekm_connections request, options do |result, operation|
270
+ result = ::Gapic::Rest::PagedEnumerable.new @ekm_service_stub, :list_ekm_connections, "ekm_connections", request, result, options
271
+ yield result, operation if block_given?
272
+ return result
273
+ end
274
+ rescue ::Gapic::Rest::Error => e
275
+ raise ::Google::Cloud::Error.from_error(e)
276
+ end
277
+
278
+ ##
279
+ # Returns metadata for a given
280
+ # {::Google::Cloud::Kms::V1::EkmConnection EkmConnection}.
281
+ #
282
+ # @overload get_ekm_connection(request, options = nil)
283
+ # Pass arguments to `get_ekm_connection` via a request object, either of type
284
+ # {::Google::Cloud::Kms::V1::GetEkmConnectionRequest} or an equivalent Hash.
285
+ #
286
+ # @param request [::Google::Cloud::Kms::V1::GetEkmConnectionRequest, ::Hash]
287
+ # A request object representing the call parameters. Required. To specify no
288
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
289
+ # @param options [::Gapic::CallOptions, ::Hash]
290
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
291
+ #
292
+ # @overload get_ekm_connection(name: nil)
293
+ # Pass arguments to `get_ekm_connection` via keyword arguments. Note that at
294
+ # least one keyword argument is required. To specify no parameters, or to keep all
295
+ # the default parameter values, pass an empty Hash as a request object (see above).
296
+ #
297
+ # @param name [::String]
298
+ # Required. The {::Google::Cloud::Kms::V1::EkmConnection#name name} of the
299
+ # {::Google::Cloud::Kms::V1::EkmConnection EkmConnection} to get.
300
+ # @yield [result, operation] Access the result along with the TransportOperation object
301
+ # @yieldparam result [::Google::Cloud::Kms::V1::EkmConnection]
302
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
303
+ #
304
+ # @return [::Google::Cloud::Kms::V1::EkmConnection]
305
+ #
306
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
307
+ def get_ekm_connection request, options = nil
308
+ raise ::ArgumentError, "request must be provided" if request.nil?
309
+
310
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::GetEkmConnectionRequest
311
+
312
+ # Converts hash and nil to an options object
313
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
314
+
315
+ # Customize the options with defaults
316
+ call_metadata = @config.rpcs.get_ekm_connection.metadata.to_h
317
+
318
+ # Set x-goog-api-client and x-goog-user-project headers
319
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
320
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
321
+ gapic_version: ::Google::Cloud::Kms::V1::VERSION,
322
+ transports_version_send: [:rest]
323
+
324
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
325
+
326
+ options.apply_defaults timeout: @config.rpcs.get_ekm_connection.timeout,
327
+ metadata: call_metadata,
328
+ retry_policy: @config.rpcs.get_ekm_connection.retry_policy
329
+
330
+ options.apply_defaults timeout: @config.timeout,
331
+ metadata: @config.metadata,
332
+ retry_policy: @config.retry_policy
333
+
334
+ @ekm_service_stub.get_ekm_connection request, options do |result, operation|
335
+ yield result, operation if block_given?
336
+ return result
337
+ end
338
+ rescue ::Gapic::Rest::Error => e
339
+ raise ::Google::Cloud::Error.from_error(e)
340
+ end
341
+
342
+ ##
343
+ # Creates a new {::Google::Cloud::Kms::V1::EkmConnection EkmConnection} in a given
344
+ # Project and Location.
345
+ #
346
+ # @overload create_ekm_connection(request, options = nil)
347
+ # Pass arguments to `create_ekm_connection` via a request object, either of type
348
+ # {::Google::Cloud::Kms::V1::CreateEkmConnectionRequest} or an equivalent Hash.
349
+ #
350
+ # @param request [::Google::Cloud::Kms::V1::CreateEkmConnectionRequest, ::Hash]
351
+ # A request object representing the call parameters. Required. To specify no
352
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
353
+ # @param options [::Gapic::CallOptions, ::Hash]
354
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
355
+ #
356
+ # @overload create_ekm_connection(parent: nil, ekm_connection_id: nil, ekm_connection: nil)
357
+ # Pass arguments to `create_ekm_connection` via keyword arguments. Note that at
358
+ # least one keyword argument is required. To specify no parameters, or to keep all
359
+ # the default parameter values, pass an empty Hash as a request object (see above).
360
+ #
361
+ # @param parent [::String]
362
+ # Required. The resource name of the location associated with the
363
+ # {::Google::Cloud::Kms::V1::EkmConnection EkmConnection}, in the format
364
+ # `projects/*/locations/*`.
365
+ # @param ekm_connection_id [::String]
366
+ # Required. It must be unique within a location and match the regular
367
+ # expression `[a-zA-Z0-9_-]{1,63}`.
368
+ # @param ekm_connection [::Google::Cloud::Kms::V1::EkmConnection, ::Hash]
369
+ # Required. An {::Google::Cloud::Kms::V1::EkmConnection EkmConnection} with
370
+ # initial field values.
371
+ # @yield [result, operation] Access the result along with the TransportOperation object
372
+ # @yieldparam result [::Google::Cloud::Kms::V1::EkmConnection]
373
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
374
+ #
375
+ # @return [::Google::Cloud::Kms::V1::EkmConnection]
376
+ #
377
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
378
+ def create_ekm_connection request, options = nil
379
+ raise ::ArgumentError, "request must be provided" if request.nil?
380
+
381
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::CreateEkmConnectionRequest
382
+
383
+ # Converts hash and nil to an options object
384
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
385
+
386
+ # Customize the options with defaults
387
+ call_metadata = @config.rpcs.create_ekm_connection.metadata.to_h
388
+
389
+ # Set x-goog-api-client and x-goog-user-project headers
390
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
391
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
392
+ gapic_version: ::Google::Cloud::Kms::V1::VERSION,
393
+ transports_version_send: [:rest]
394
+
395
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
396
+
397
+ options.apply_defaults timeout: @config.rpcs.create_ekm_connection.timeout,
398
+ metadata: call_metadata,
399
+ retry_policy: @config.rpcs.create_ekm_connection.retry_policy
400
+
401
+ options.apply_defaults timeout: @config.timeout,
402
+ metadata: @config.metadata,
403
+ retry_policy: @config.retry_policy
404
+
405
+ @ekm_service_stub.create_ekm_connection request, options do |result, operation|
406
+ yield result, operation if block_given?
407
+ return result
408
+ end
409
+ rescue ::Gapic::Rest::Error => e
410
+ raise ::Google::Cloud::Error.from_error(e)
411
+ end
412
+
413
+ ##
414
+ # Updates an {::Google::Cloud::Kms::V1::EkmConnection EkmConnection}'s metadata.
415
+ #
416
+ # @overload update_ekm_connection(request, options = nil)
417
+ # Pass arguments to `update_ekm_connection` via a request object, either of type
418
+ # {::Google::Cloud::Kms::V1::UpdateEkmConnectionRequest} or an equivalent Hash.
419
+ #
420
+ # @param request [::Google::Cloud::Kms::V1::UpdateEkmConnectionRequest, ::Hash]
421
+ # A request object representing the call parameters. Required. To specify no
422
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
423
+ # @param options [::Gapic::CallOptions, ::Hash]
424
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
425
+ #
426
+ # @overload update_ekm_connection(ekm_connection: nil, update_mask: nil)
427
+ # Pass arguments to `update_ekm_connection` via keyword arguments. Note that at
428
+ # least one keyword argument is required. To specify no parameters, or to keep all
429
+ # the default parameter values, pass an empty Hash as a request object (see above).
430
+ #
431
+ # @param ekm_connection [::Google::Cloud::Kms::V1::EkmConnection, ::Hash]
432
+ # Required. {::Google::Cloud::Kms::V1::EkmConnection EkmConnection} with updated
433
+ # values.
434
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
435
+ # Required. List of fields to be updated in this request.
436
+ # @yield [result, operation] Access the result along with the TransportOperation object
437
+ # @yieldparam result [::Google::Cloud::Kms::V1::EkmConnection]
438
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
439
+ #
440
+ # @return [::Google::Cloud::Kms::V1::EkmConnection]
441
+ #
442
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
443
+ def update_ekm_connection request, options = nil
444
+ raise ::ArgumentError, "request must be provided" if request.nil?
445
+
446
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::UpdateEkmConnectionRequest
447
+
448
+ # Converts hash and nil to an options object
449
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
450
+
451
+ # Customize the options with defaults
452
+ call_metadata = @config.rpcs.update_ekm_connection.metadata.to_h
453
+
454
+ # Set x-goog-api-client and x-goog-user-project headers
455
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
456
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
457
+ gapic_version: ::Google::Cloud::Kms::V1::VERSION,
458
+ transports_version_send: [:rest]
459
+
460
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
461
+
462
+ options.apply_defaults timeout: @config.rpcs.update_ekm_connection.timeout,
463
+ metadata: call_metadata,
464
+ retry_policy: @config.rpcs.update_ekm_connection.retry_policy
465
+
466
+ options.apply_defaults timeout: @config.timeout,
467
+ metadata: @config.metadata,
468
+ retry_policy: @config.retry_policy
469
+
470
+ @ekm_service_stub.update_ekm_connection request, options do |result, operation|
471
+ yield result, operation if block_given?
472
+ return result
473
+ end
474
+ rescue ::Gapic::Rest::Error => e
475
+ raise ::Google::Cloud::Error.from_error(e)
476
+ end
477
+
478
+ ##
479
+ # Configuration class for the EkmService REST API.
480
+ #
481
+ # This class represents the configuration for EkmService REST,
482
+ # providing control over timeouts, retry behavior, logging, transport
483
+ # parameters, and other low-level controls. Certain parameters can also be
484
+ # applied individually to specific RPCs. See
485
+ # {::Google::Cloud::Kms::V1::EkmService::Rest::Client::Configuration::Rpcs}
486
+ # for a list of RPCs that can be configured independently.
487
+ #
488
+ # Configuration can be applied globally to all clients, or to a single client
489
+ # on construction.
490
+ #
491
+ # @example
492
+ #
493
+ # # Modify the global config, setting the timeout for
494
+ # # list_ekm_connections to 20 seconds,
495
+ # # and all remaining timeouts to 10 seconds.
496
+ # ::Google::Cloud::Kms::V1::EkmService::Rest::Client.configure do |config|
497
+ # config.timeout = 10.0
498
+ # config.rpcs.list_ekm_connections.timeout = 20.0
499
+ # end
500
+ #
501
+ # # Apply the above configuration only to a new client.
502
+ # client = ::Google::Cloud::Kms::V1::EkmService::Rest::Client.new do |config|
503
+ # config.timeout = 10.0
504
+ # config.rpcs.list_ekm_connections.timeout = 20.0
505
+ # end
506
+ #
507
+ # @!attribute [rw] endpoint
508
+ # The hostname or hostname:port of the service endpoint.
509
+ # Defaults to `"cloudkms.googleapis.com"`.
510
+ # @return [::String]
511
+ # @!attribute [rw] credentials
512
+ # Credentials to send with calls. You may provide any of the following types:
513
+ # * (`String`) The path to a service account key file in JSON format
514
+ # * (`Hash`) A service account key as a Hash
515
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
516
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
517
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
518
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
519
+ # * (`nil`) indicating no credentials
520
+ # @return [::Object]
521
+ # @!attribute [rw] scope
522
+ # The OAuth scopes
523
+ # @return [::Array<::String>]
524
+ # @!attribute [rw] lib_name
525
+ # The library name as recorded in instrumentation and logging
526
+ # @return [::String]
527
+ # @!attribute [rw] lib_version
528
+ # The library version as recorded in instrumentation and logging
529
+ # @return [::String]
530
+ # @!attribute [rw] timeout
531
+ # The call timeout in seconds.
532
+ # @return [::Numeric]
533
+ # @!attribute [rw] metadata
534
+ # Additional headers to be sent with the call.
535
+ # @return [::Hash{::Symbol=>::String}]
536
+ # @!attribute [rw] retry_policy
537
+ # The retry policy. The value is a hash with the following keys:
538
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
539
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
540
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
541
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
542
+ # trigger a retry.
543
+ # @return [::Hash]
544
+ # @!attribute [rw] quota_project
545
+ # A separate project against which to charge quota.
546
+ # @return [::String]
547
+ #
548
+ class Configuration
549
+ extend ::Gapic::Config
550
+
551
+ config_attr :endpoint, "cloudkms.googleapis.com", ::String
552
+ config_attr :credentials, nil do |value|
553
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
554
+ allowed.any? { |klass| klass === value }
555
+ end
556
+ config_attr :scope, nil, ::String, ::Array, nil
557
+ config_attr :lib_name, nil, ::String, nil
558
+ config_attr :lib_version, nil, ::String, nil
559
+ config_attr :timeout, nil, ::Numeric, nil
560
+ config_attr :metadata, nil, ::Hash, nil
561
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
562
+ config_attr :quota_project, nil, ::String, nil
563
+
564
+ # @private
565
+ # Overrides for http bindings for the RPCs of this service
566
+ # are only used when this service is used as mixin, and only
567
+ # by the host service.
568
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
569
+ config_attr :bindings_override, {}, ::Hash, nil
570
+
571
+ # @private
572
+ def initialize parent_config = nil
573
+ @parent_config = parent_config unless parent_config.nil?
574
+
575
+ yield self if block_given?
576
+ end
577
+
578
+ ##
579
+ # Configurations for individual RPCs
580
+ # @return [Rpcs]
581
+ #
582
+ def rpcs
583
+ @rpcs ||= begin
584
+ parent_rpcs = nil
585
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
586
+ Rpcs.new parent_rpcs
587
+ end
588
+ end
589
+
590
+ ##
591
+ # Configuration RPC class for the EkmService API.
592
+ #
593
+ # Includes fields providing the configuration for each RPC in this service.
594
+ # Each configuration object is of type `Gapic::Config::Method` and includes
595
+ # the following configuration fields:
596
+ #
597
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
598
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
599
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
600
+ # include the following keys:
601
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
602
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
603
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
604
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
605
+ # trigger a retry.
606
+ #
607
+ class Rpcs
608
+ ##
609
+ # RPC-specific configuration for `list_ekm_connections`
610
+ # @return [::Gapic::Config::Method]
611
+ #
612
+ attr_reader :list_ekm_connections
613
+ ##
614
+ # RPC-specific configuration for `get_ekm_connection`
615
+ # @return [::Gapic::Config::Method]
616
+ #
617
+ attr_reader :get_ekm_connection
618
+ ##
619
+ # RPC-specific configuration for `create_ekm_connection`
620
+ # @return [::Gapic::Config::Method]
621
+ #
622
+ attr_reader :create_ekm_connection
623
+ ##
624
+ # RPC-specific configuration for `update_ekm_connection`
625
+ # @return [::Gapic::Config::Method]
626
+ #
627
+ attr_reader :update_ekm_connection
628
+
629
+ # @private
630
+ def initialize parent_rpcs = nil
631
+ list_ekm_connections_config = parent_rpcs.list_ekm_connections if parent_rpcs.respond_to? :list_ekm_connections
632
+ @list_ekm_connections = ::Gapic::Config::Method.new list_ekm_connections_config
633
+ get_ekm_connection_config = parent_rpcs.get_ekm_connection if parent_rpcs.respond_to? :get_ekm_connection
634
+ @get_ekm_connection = ::Gapic::Config::Method.new get_ekm_connection_config
635
+ create_ekm_connection_config = parent_rpcs.create_ekm_connection if parent_rpcs.respond_to? :create_ekm_connection
636
+ @create_ekm_connection = ::Gapic::Config::Method.new create_ekm_connection_config
637
+ update_ekm_connection_config = parent_rpcs.update_ekm_connection if parent_rpcs.respond_to? :update_ekm_connection
638
+ @update_ekm_connection = ::Gapic::Config::Method.new update_ekm_connection_config
639
+
640
+ yield self if block_given?
641
+ end
642
+ end
643
+ end
644
+ end
645
+ end
646
+ end
647
+ end
648
+ end
649
+ end
650
+ end