google-cloud-kms-v1 0.16.0 → 0.18.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.
@@ -0,0 +1,793 @@
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
+ # Returns the {::Google::Cloud::Kms::V1::EkmConfig EkmConfig} singleton resource
480
+ # for a given project and location.
481
+ #
482
+ # @overload get_ekm_config(request, options = nil)
483
+ # Pass arguments to `get_ekm_config` via a request object, either of type
484
+ # {::Google::Cloud::Kms::V1::GetEkmConfigRequest} or an equivalent Hash.
485
+ #
486
+ # @param request [::Google::Cloud::Kms::V1::GetEkmConfigRequest, ::Hash]
487
+ # A request object representing the call parameters. Required. To specify no
488
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
489
+ # @param options [::Gapic::CallOptions, ::Hash]
490
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
491
+ #
492
+ # @overload get_ekm_config(name: nil)
493
+ # Pass arguments to `get_ekm_config` via keyword arguments. Note that at
494
+ # least one keyword argument is required. To specify no parameters, or to keep all
495
+ # the default parameter values, pass an empty Hash as a request object (see above).
496
+ #
497
+ # @param name [::String]
498
+ # Required. The {::Google::Cloud::Kms::V1::EkmConfig#name name} of the
499
+ # {::Google::Cloud::Kms::V1::EkmConfig EkmConfig} to get.
500
+ # @yield [result, operation] Access the result along with the TransportOperation object
501
+ # @yieldparam result [::Google::Cloud::Kms::V1::EkmConfig]
502
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
503
+ #
504
+ # @return [::Google::Cloud::Kms::V1::EkmConfig]
505
+ #
506
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
507
+ def get_ekm_config request, options = nil
508
+ raise ::ArgumentError, "request must be provided" if request.nil?
509
+
510
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::GetEkmConfigRequest
511
+
512
+ # Converts hash and nil to an options object
513
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
514
+
515
+ # Customize the options with defaults
516
+ call_metadata = @config.rpcs.get_ekm_config.metadata.to_h
517
+
518
+ # Set x-goog-api-client and x-goog-user-project headers
519
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
520
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
521
+ gapic_version: ::Google::Cloud::Kms::V1::VERSION,
522
+ transports_version_send: [:rest]
523
+
524
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
525
+
526
+ options.apply_defaults timeout: @config.rpcs.get_ekm_config.timeout,
527
+ metadata: call_metadata,
528
+ retry_policy: @config.rpcs.get_ekm_config.retry_policy
529
+
530
+ options.apply_defaults timeout: @config.timeout,
531
+ metadata: @config.metadata,
532
+ retry_policy: @config.retry_policy
533
+
534
+ @ekm_service_stub.get_ekm_config request, options do |result, operation|
535
+ yield result, operation if block_given?
536
+ return result
537
+ end
538
+ rescue ::Gapic::Rest::Error => e
539
+ raise ::Google::Cloud::Error.from_error(e)
540
+ end
541
+
542
+ ##
543
+ # Updates the {::Google::Cloud::Kms::V1::EkmConfig EkmConfig} singleton resource
544
+ # for a given project and location.
545
+ #
546
+ # @overload update_ekm_config(request, options = nil)
547
+ # Pass arguments to `update_ekm_config` via a request object, either of type
548
+ # {::Google::Cloud::Kms::V1::UpdateEkmConfigRequest} or an equivalent Hash.
549
+ #
550
+ # @param request [::Google::Cloud::Kms::V1::UpdateEkmConfigRequest, ::Hash]
551
+ # A request object representing the call parameters. Required. To specify no
552
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
553
+ # @param options [::Gapic::CallOptions, ::Hash]
554
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
555
+ #
556
+ # @overload update_ekm_config(ekm_config: nil, update_mask: nil)
557
+ # Pass arguments to `update_ekm_config` via keyword arguments. Note that at
558
+ # least one keyword argument is required. To specify no parameters, or to keep all
559
+ # the default parameter values, pass an empty Hash as a request object (see above).
560
+ #
561
+ # @param ekm_config [::Google::Cloud::Kms::V1::EkmConfig, ::Hash]
562
+ # Required. {::Google::Cloud::Kms::V1::EkmConfig EkmConfig} with updated values.
563
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
564
+ # Required. List of fields to be updated in this request.
565
+ # @yield [result, operation] Access the result along with the TransportOperation object
566
+ # @yieldparam result [::Google::Cloud::Kms::V1::EkmConfig]
567
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
568
+ #
569
+ # @return [::Google::Cloud::Kms::V1::EkmConfig]
570
+ #
571
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
572
+ def update_ekm_config request, options = nil
573
+ raise ::ArgumentError, "request must be provided" if request.nil?
574
+
575
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::UpdateEkmConfigRequest
576
+
577
+ # Converts hash and nil to an options object
578
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
579
+
580
+ # Customize the options with defaults
581
+ call_metadata = @config.rpcs.update_ekm_config.metadata.to_h
582
+
583
+ # Set x-goog-api-client and x-goog-user-project headers
584
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
585
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
586
+ gapic_version: ::Google::Cloud::Kms::V1::VERSION,
587
+ transports_version_send: [:rest]
588
+
589
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
590
+
591
+ options.apply_defaults timeout: @config.rpcs.update_ekm_config.timeout,
592
+ metadata: call_metadata,
593
+ retry_policy: @config.rpcs.update_ekm_config.retry_policy
594
+
595
+ options.apply_defaults timeout: @config.timeout,
596
+ metadata: @config.metadata,
597
+ retry_policy: @config.retry_policy
598
+
599
+ @ekm_service_stub.update_ekm_config request, options do |result, operation|
600
+ yield result, operation if block_given?
601
+ return result
602
+ end
603
+ rescue ::Gapic::Rest::Error => e
604
+ raise ::Google::Cloud::Error.from_error(e)
605
+ end
606
+
607
+ ##
608
+ # Configuration class for the EkmService REST API.
609
+ #
610
+ # This class represents the configuration for EkmService REST,
611
+ # providing control over timeouts, retry behavior, logging, transport
612
+ # parameters, and other low-level controls. Certain parameters can also be
613
+ # applied individually to specific RPCs. See
614
+ # {::Google::Cloud::Kms::V1::EkmService::Rest::Client::Configuration::Rpcs}
615
+ # for a list of RPCs that can be configured independently.
616
+ #
617
+ # Configuration can be applied globally to all clients, or to a single client
618
+ # on construction.
619
+ #
620
+ # @example
621
+ #
622
+ # # Modify the global config, setting the timeout for
623
+ # # list_ekm_connections to 20 seconds,
624
+ # # and all remaining timeouts to 10 seconds.
625
+ # ::Google::Cloud::Kms::V1::EkmService::Rest::Client.configure do |config|
626
+ # config.timeout = 10.0
627
+ # config.rpcs.list_ekm_connections.timeout = 20.0
628
+ # end
629
+ #
630
+ # # Apply the above configuration only to a new client.
631
+ # client = ::Google::Cloud::Kms::V1::EkmService::Rest::Client.new do |config|
632
+ # config.timeout = 10.0
633
+ # config.rpcs.list_ekm_connections.timeout = 20.0
634
+ # end
635
+ #
636
+ # @!attribute [rw] endpoint
637
+ # The hostname or hostname:port of the service endpoint.
638
+ # Defaults to `"cloudkms.googleapis.com"`.
639
+ # @return [::String]
640
+ # @!attribute [rw] credentials
641
+ # Credentials to send with calls. You may provide any of the following types:
642
+ # * (`String`) The path to a service account key file in JSON format
643
+ # * (`Hash`) A service account key as a Hash
644
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
645
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
646
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
647
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
648
+ # * (`nil`) indicating no credentials
649
+ # @return [::Object]
650
+ # @!attribute [rw] scope
651
+ # The OAuth scopes
652
+ # @return [::Array<::String>]
653
+ # @!attribute [rw] lib_name
654
+ # The library name as recorded in instrumentation and logging
655
+ # @return [::String]
656
+ # @!attribute [rw] lib_version
657
+ # The library version as recorded in instrumentation and logging
658
+ # @return [::String]
659
+ # @!attribute [rw] timeout
660
+ # The call timeout in seconds.
661
+ # @return [::Numeric]
662
+ # @!attribute [rw] metadata
663
+ # Additional headers to be sent with the call.
664
+ # @return [::Hash{::Symbol=>::String}]
665
+ # @!attribute [rw] retry_policy
666
+ # The retry policy. The value is a hash with the following keys:
667
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
668
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
669
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
670
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
671
+ # trigger a retry.
672
+ # @return [::Hash]
673
+ # @!attribute [rw] quota_project
674
+ # A separate project against which to charge quota.
675
+ # @return [::String]
676
+ #
677
+ class Configuration
678
+ extend ::Gapic::Config
679
+
680
+ config_attr :endpoint, "cloudkms.googleapis.com", ::String
681
+ config_attr :credentials, nil do |value|
682
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
683
+ allowed.any? { |klass| klass === value }
684
+ end
685
+ config_attr :scope, nil, ::String, ::Array, nil
686
+ config_attr :lib_name, nil, ::String, nil
687
+ config_attr :lib_version, nil, ::String, nil
688
+ config_attr :timeout, nil, ::Numeric, nil
689
+ config_attr :metadata, nil, ::Hash, nil
690
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
691
+ config_attr :quota_project, nil, ::String, nil
692
+
693
+ # @private
694
+ # Overrides for http bindings for the RPCs of this service
695
+ # are only used when this service is used as mixin, and only
696
+ # by the host service.
697
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
698
+ config_attr :bindings_override, {}, ::Hash, nil
699
+
700
+ # @private
701
+ def initialize parent_config = nil
702
+ @parent_config = parent_config unless parent_config.nil?
703
+
704
+ yield self if block_given?
705
+ end
706
+
707
+ ##
708
+ # Configurations for individual RPCs
709
+ # @return [Rpcs]
710
+ #
711
+ def rpcs
712
+ @rpcs ||= begin
713
+ parent_rpcs = nil
714
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
715
+ Rpcs.new parent_rpcs
716
+ end
717
+ end
718
+
719
+ ##
720
+ # Configuration RPC class for the EkmService API.
721
+ #
722
+ # Includes fields providing the configuration for each RPC in this service.
723
+ # Each configuration object is of type `Gapic::Config::Method` and includes
724
+ # the following configuration fields:
725
+ #
726
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
727
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
728
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
729
+ # include the following keys:
730
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
731
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
732
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
733
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
734
+ # trigger a retry.
735
+ #
736
+ class Rpcs
737
+ ##
738
+ # RPC-specific configuration for `list_ekm_connections`
739
+ # @return [::Gapic::Config::Method]
740
+ #
741
+ attr_reader :list_ekm_connections
742
+ ##
743
+ # RPC-specific configuration for `get_ekm_connection`
744
+ # @return [::Gapic::Config::Method]
745
+ #
746
+ attr_reader :get_ekm_connection
747
+ ##
748
+ # RPC-specific configuration for `create_ekm_connection`
749
+ # @return [::Gapic::Config::Method]
750
+ #
751
+ attr_reader :create_ekm_connection
752
+ ##
753
+ # RPC-specific configuration for `update_ekm_connection`
754
+ # @return [::Gapic::Config::Method]
755
+ #
756
+ attr_reader :update_ekm_connection
757
+ ##
758
+ # RPC-specific configuration for `get_ekm_config`
759
+ # @return [::Gapic::Config::Method]
760
+ #
761
+ attr_reader :get_ekm_config
762
+ ##
763
+ # RPC-specific configuration for `update_ekm_config`
764
+ # @return [::Gapic::Config::Method]
765
+ #
766
+ attr_reader :update_ekm_config
767
+
768
+ # @private
769
+ def initialize parent_rpcs = nil
770
+ list_ekm_connections_config = parent_rpcs.list_ekm_connections if parent_rpcs.respond_to? :list_ekm_connections
771
+ @list_ekm_connections = ::Gapic::Config::Method.new list_ekm_connections_config
772
+ get_ekm_connection_config = parent_rpcs.get_ekm_connection if parent_rpcs.respond_to? :get_ekm_connection
773
+ @get_ekm_connection = ::Gapic::Config::Method.new get_ekm_connection_config
774
+ create_ekm_connection_config = parent_rpcs.create_ekm_connection if parent_rpcs.respond_to? :create_ekm_connection
775
+ @create_ekm_connection = ::Gapic::Config::Method.new create_ekm_connection_config
776
+ update_ekm_connection_config = parent_rpcs.update_ekm_connection if parent_rpcs.respond_to? :update_ekm_connection
777
+ @update_ekm_connection = ::Gapic::Config::Method.new update_ekm_connection_config
778
+ get_ekm_config_config = parent_rpcs.get_ekm_config if parent_rpcs.respond_to? :get_ekm_config
779
+ @get_ekm_config = ::Gapic::Config::Method.new get_ekm_config_config
780
+ update_ekm_config_config = parent_rpcs.update_ekm_config if parent_rpcs.respond_to? :update_ekm_config
781
+ @update_ekm_config = ::Gapic::Config::Method.new update_ekm_config_config
782
+
783
+ yield self if block_given?
784
+ end
785
+ end
786
+ end
787
+ end
788
+ end
789
+ end
790
+ end
791
+ end
792
+ end
793
+ end