google-cloud-api_keys-v2 0.1.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,1140 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 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/api/apikeys/v2/apikeys_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module ApiKeys
25
+ module V2
26
+ module ApiKeys
27
+ ##
28
+ # Client for the ApiKeys service.
29
+ #
30
+ # Manages the API keys associated with projects.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :api_keys_stub
37
+
38
+ ##
39
+ # Configure the ApiKeys Client class.
40
+ #
41
+ # See {::Google::Cloud::ApiKeys::V2::ApiKeys::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all ApiKeys clients
47
+ # ::Google::Cloud::ApiKeys::V2::ApiKeys::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
50
+ #
51
+ # @yield [config] Configure the Client client.
52
+ # @yieldparam config [Client::Configuration]
53
+ #
54
+ # @return [Client::Configuration]
55
+ #
56
+ def self.configure
57
+ @configure ||= begin
58
+ namespace = ["Google", "Cloud", "ApiKeys", "V2"]
59
+ parent_config = while namespace.any?
60
+ parent_name = namespace.join "::"
61
+ parent_const = const_get parent_name
62
+ break parent_const.configure if parent_const.respond_to? :configure
63
+ namespace.pop
64
+ end
65
+ default_config = Client::Configuration.new parent_config
66
+
67
+ default_config.timeout = 10.0
68
+
69
+ default_config
70
+ end
71
+ yield @configure if block_given?
72
+ @configure
73
+ end
74
+
75
+ ##
76
+ # Configure the ApiKeys Client instance.
77
+ #
78
+ # The configuration is set to the derived mode, meaning that values can be changed,
79
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
80
+ # should be made on {Client.configure}.
81
+ #
82
+ # See {::Google::Cloud::ApiKeys::V2::ApiKeys::Client::Configuration}
83
+ # for a description of the configuration fields.
84
+ #
85
+ # @yield [config] Configure the Client client.
86
+ # @yieldparam config [Client::Configuration]
87
+ #
88
+ # @return [Client::Configuration]
89
+ #
90
+ def configure
91
+ yield @config if block_given?
92
+ @config
93
+ end
94
+
95
+ ##
96
+ # Create a new ApiKeys client object.
97
+ #
98
+ # @example
99
+ #
100
+ # # Create a client using the default configuration
101
+ # client = ::Google::Cloud::ApiKeys::V2::ApiKeys::Client.new
102
+ #
103
+ # # Create a client using a custom configuration
104
+ # client = ::Google::Cloud::ApiKeys::V2::ApiKeys::Client.new do |config|
105
+ # config.timeout = 10.0
106
+ # end
107
+ #
108
+ # @yield [config] Configure the ApiKeys client.
109
+ # @yieldparam config [Client::Configuration]
110
+ #
111
+ def initialize
112
+ # These require statements are intentionally placed here to initialize
113
+ # the gRPC module only when it's required.
114
+ # See https://github.com/googleapis/toolkit/issues/446
115
+ require "gapic/grpc"
116
+ require "google/api/apikeys/v2/apikeys_services_pb"
117
+
118
+ # Create the configuration object
119
+ @config = Configuration.new Client.configure
120
+
121
+ # Yield the configuration if needed
122
+ yield @config if block_given?
123
+
124
+ # Create credentials
125
+ credentials = @config.credentials
126
+ # Use self-signed JWT if the endpoint is unchanged from default,
127
+ # but only if the default endpoint does not have a region prefix.
128
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
129
+ !@config.endpoint.split(".").first.include?("-")
130
+ credentials ||= Credentials.default scope: @config.scope,
131
+ enable_self_signed_jwt: enable_self_signed_jwt
132
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
133
+ credentials = Credentials.new credentials, scope: @config.scope
134
+ end
135
+ @quota_project_id = @config.quota_project
136
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
137
+
138
+ @operations_client = Operations.new do |config|
139
+ config.credentials = credentials
140
+ config.quota_project = @quota_project_id
141
+ config.endpoint = @config.endpoint
142
+ end
143
+
144
+ @api_keys_stub = ::Gapic::ServiceStub.new(
145
+ ::Google::Cloud::ApiKeys::V2::ApiKeys::Stub,
146
+ credentials: credentials,
147
+ endpoint: @config.endpoint,
148
+ channel_args: @config.channel_args,
149
+ interceptors: @config.interceptors
150
+ )
151
+ end
152
+
153
+ ##
154
+ # Get the associated client for long-running operations.
155
+ #
156
+ # @return [::Google::Cloud::ApiKeys::V2::ApiKeys::Operations]
157
+ #
158
+ attr_reader :operations_client
159
+
160
+ # Service calls
161
+
162
+ ##
163
+ # Creates a new API key.
164
+ #
165
+ # NOTE: Key is a global resource; hence the only supported value for
166
+ # location is `global`.
167
+ #
168
+ # @overload create_key(request, options = nil)
169
+ # Pass arguments to `create_key` via a request object, either of type
170
+ # {::Google::Cloud::ApiKeys::V2::CreateKeyRequest} or an equivalent Hash.
171
+ #
172
+ # @param request [::Google::Cloud::ApiKeys::V2::CreateKeyRequest, ::Hash]
173
+ # A request object representing the call parameters. Required. To specify no
174
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
175
+ # @param options [::Gapic::CallOptions, ::Hash]
176
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
177
+ #
178
+ # @overload create_key(parent: nil, key: nil, key_id: nil)
179
+ # Pass arguments to `create_key` via keyword arguments. Note that at
180
+ # least one keyword argument is required. To specify no parameters, or to keep all
181
+ # the default parameter values, pass an empty Hash as a request object (see above).
182
+ #
183
+ # @param parent [::String]
184
+ # Required. The project in which the API key is created.
185
+ # @param key [::Google::Cloud::ApiKeys::V2::Key, ::Hash]
186
+ # Required. The API key fields to set at creation time.
187
+ # You can configure only the `display_name`, `restrictions`, and
188
+ # `annotations` fields.
189
+ # @param key_id [::String]
190
+ # User specified key id (optional). If specified, it will become the final
191
+ # component of the key resource name.
192
+ #
193
+ # The id must be unique within the project, must conform with RFC-1034,
194
+ # is restricted to lower-cased letters, and has a maximum length of 63
195
+ # characters. In another word, the id must match the regular
196
+ # expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
197
+ #
198
+ # The id must NOT be a UUID-like string.
199
+ #
200
+ # @yield [response, operation] Access the result along with the RPC operation
201
+ # @yieldparam response [::Gapic::Operation]
202
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
203
+ #
204
+ # @return [::Gapic::Operation]
205
+ #
206
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
207
+ #
208
+ # @example Basic example
209
+ # require "google/cloud/api_keys/v2"
210
+ #
211
+ # # Create a client object. The client can be reused for multiple calls.
212
+ # client = Google::Cloud::ApiKeys::V2::ApiKeys::Client.new
213
+ #
214
+ # # Create a request. To set request fields, pass in keyword arguments.
215
+ # request = Google::Cloud::ApiKeys::V2::CreateKeyRequest.new
216
+ #
217
+ # # Call the create_key method.
218
+ # result = client.create_key request
219
+ #
220
+ # # The returned object is of type Gapic::Operation. You can use this
221
+ # # object to check the status of an operation, cancel it, or wait
222
+ # # for results. Here is how to block until completion:
223
+ # result.wait_until_done! timeout: 60
224
+ # if result.response?
225
+ # p result.response
226
+ # else
227
+ # puts "Error!"
228
+ # end
229
+ #
230
+ def create_key request, options = nil
231
+ raise ::ArgumentError, "request must be provided" if request.nil?
232
+
233
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiKeys::V2::CreateKeyRequest
234
+
235
+ # Converts hash and nil to an options object
236
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
237
+
238
+ # Customize the options with defaults
239
+ metadata = @config.rpcs.create_key.metadata.to_h
240
+
241
+ # Set x-goog-api-client and x-goog-user-project headers
242
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
243
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
244
+ gapic_version: ::Google::Cloud::ApiKeys::V2::VERSION
245
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
246
+
247
+ header_params = {}
248
+ if request.parent
249
+ header_params["parent"] = request.parent
250
+ end
251
+
252
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
253
+ metadata[:"x-goog-request-params"] ||= request_params_header
254
+
255
+ options.apply_defaults timeout: @config.rpcs.create_key.timeout,
256
+ metadata: metadata,
257
+ retry_policy: @config.rpcs.create_key.retry_policy
258
+
259
+ options.apply_defaults timeout: @config.timeout,
260
+ metadata: @config.metadata,
261
+ retry_policy: @config.retry_policy
262
+
263
+ @api_keys_stub.call_rpc :create_key, request, options: options do |response, operation|
264
+ response = ::Gapic::Operation.new response, @operations_client, options: options
265
+ yield response, operation if block_given?
266
+ return response
267
+ end
268
+ rescue ::GRPC::BadStatus => e
269
+ raise ::Google::Cloud::Error.from_error(e)
270
+ end
271
+
272
+ ##
273
+ # Lists the API keys owned by a project. The key string of the API key
274
+ # isn't included in the response.
275
+ #
276
+ # NOTE: Key is a global resource; hence the only supported value for
277
+ # location is `global`.
278
+ #
279
+ # @overload list_keys(request, options = nil)
280
+ # Pass arguments to `list_keys` via a request object, either of type
281
+ # {::Google::Cloud::ApiKeys::V2::ListKeysRequest} or an equivalent Hash.
282
+ #
283
+ # @param request [::Google::Cloud::ApiKeys::V2::ListKeysRequest, ::Hash]
284
+ # A request object representing the call parameters. Required. To specify no
285
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
286
+ # @param options [::Gapic::CallOptions, ::Hash]
287
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
288
+ #
289
+ # @overload list_keys(parent: nil, page_size: nil, page_token: nil, show_deleted: nil)
290
+ # Pass arguments to `list_keys` via keyword arguments. Note that at
291
+ # least one keyword argument is required. To specify no parameters, or to keep all
292
+ # the default parameter values, pass an empty Hash as a request object (see above).
293
+ #
294
+ # @param parent [::String]
295
+ # Required. Lists all API keys associated with this project.
296
+ # @param page_size [::Integer]
297
+ # Optional. Specifies the maximum number of results to be returned at a time.
298
+ # @param page_token [::String]
299
+ # Optional. Requests a specific page of results.
300
+ # @param show_deleted [::Boolean]
301
+ # Optional. Indicate that keys deleted in the past 30 days should also be
302
+ # returned.
303
+ #
304
+ # @yield [response, operation] Access the result along with the RPC operation
305
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::ApiKeys::V2::Key>]
306
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
307
+ #
308
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::ApiKeys::V2::Key>]
309
+ #
310
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
311
+ #
312
+ # @example Basic example
313
+ # require "google/cloud/api_keys/v2"
314
+ #
315
+ # # Create a client object. The client can be reused for multiple calls.
316
+ # client = Google::Cloud::ApiKeys::V2::ApiKeys::Client.new
317
+ #
318
+ # # Create a request. To set request fields, pass in keyword arguments.
319
+ # request = Google::Cloud::ApiKeys::V2::ListKeysRequest.new
320
+ #
321
+ # # Call the list_keys method.
322
+ # result = client.list_keys request
323
+ #
324
+ # # The returned object is of type Gapic::PagedEnumerable. You can
325
+ # # iterate over all elements by calling #each, and the enumerable
326
+ # # will lazily make API calls to fetch subsequent pages. Other
327
+ # # methods are also available for managing paging directly.
328
+ # result.each do |response|
329
+ # # Each element is of type ::Google::Cloud::ApiKeys::V2::Key.
330
+ # p response
331
+ # end
332
+ #
333
+ def list_keys request, options = nil
334
+ raise ::ArgumentError, "request must be provided" if request.nil?
335
+
336
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiKeys::V2::ListKeysRequest
337
+
338
+ # Converts hash and nil to an options object
339
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
340
+
341
+ # Customize the options with defaults
342
+ metadata = @config.rpcs.list_keys.metadata.to_h
343
+
344
+ # Set x-goog-api-client and x-goog-user-project headers
345
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
346
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
347
+ gapic_version: ::Google::Cloud::ApiKeys::V2::VERSION
348
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
349
+
350
+ header_params = {}
351
+ if request.parent
352
+ header_params["parent"] = request.parent
353
+ end
354
+
355
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
356
+ metadata[:"x-goog-request-params"] ||= request_params_header
357
+
358
+ options.apply_defaults timeout: @config.rpcs.list_keys.timeout,
359
+ metadata: metadata,
360
+ retry_policy: @config.rpcs.list_keys.retry_policy
361
+
362
+ options.apply_defaults timeout: @config.timeout,
363
+ metadata: @config.metadata,
364
+ retry_policy: @config.retry_policy
365
+
366
+ @api_keys_stub.call_rpc :list_keys, request, options: options do |response, operation|
367
+ response = ::Gapic::PagedEnumerable.new @api_keys_stub, :list_keys, request, response, operation, options
368
+ yield response, operation if block_given?
369
+ return response
370
+ end
371
+ rescue ::GRPC::BadStatus => e
372
+ raise ::Google::Cloud::Error.from_error(e)
373
+ end
374
+
375
+ ##
376
+ # Gets the metadata for an API key. The key string of the API key
377
+ # isn't included in the response.
378
+ #
379
+ # NOTE: Key is a global resource; hence the only supported value for
380
+ # location is `global`.
381
+ #
382
+ # @overload get_key(request, options = nil)
383
+ # Pass arguments to `get_key` via a request object, either of type
384
+ # {::Google::Cloud::ApiKeys::V2::GetKeyRequest} or an equivalent Hash.
385
+ #
386
+ # @param request [::Google::Cloud::ApiKeys::V2::GetKeyRequest, ::Hash]
387
+ # A request object representing the call parameters. Required. To specify no
388
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
389
+ # @param options [::Gapic::CallOptions, ::Hash]
390
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
391
+ #
392
+ # @overload get_key(name: nil)
393
+ # Pass arguments to `get_key` via keyword arguments. Note that at
394
+ # least one keyword argument is required. To specify no parameters, or to keep all
395
+ # the default parameter values, pass an empty Hash as a request object (see above).
396
+ #
397
+ # @param name [::String]
398
+ # Required. The resource name of the API key to get.
399
+ #
400
+ # @yield [response, operation] Access the result along with the RPC operation
401
+ # @yieldparam response [::Google::Cloud::ApiKeys::V2::Key]
402
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
403
+ #
404
+ # @return [::Google::Cloud::ApiKeys::V2::Key]
405
+ #
406
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
407
+ #
408
+ # @example Basic example
409
+ # require "google/cloud/api_keys/v2"
410
+ #
411
+ # # Create a client object. The client can be reused for multiple calls.
412
+ # client = Google::Cloud::ApiKeys::V2::ApiKeys::Client.new
413
+ #
414
+ # # Create a request. To set request fields, pass in keyword arguments.
415
+ # request = Google::Cloud::ApiKeys::V2::GetKeyRequest.new
416
+ #
417
+ # # Call the get_key method.
418
+ # result = client.get_key request
419
+ #
420
+ # # The returned object is of type Google::Cloud::ApiKeys::V2::Key.
421
+ # p result
422
+ #
423
+ def get_key request, options = nil
424
+ raise ::ArgumentError, "request must be provided" if request.nil?
425
+
426
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiKeys::V2::GetKeyRequest
427
+
428
+ # Converts hash and nil to an options object
429
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
430
+
431
+ # Customize the options with defaults
432
+ metadata = @config.rpcs.get_key.metadata.to_h
433
+
434
+ # Set x-goog-api-client and x-goog-user-project headers
435
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
436
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
437
+ gapic_version: ::Google::Cloud::ApiKeys::V2::VERSION
438
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
439
+
440
+ header_params = {}
441
+ if request.name
442
+ header_params["name"] = request.name
443
+ end
444
+
445
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
446
+ metadata[:"x-goog-request-params"] ||= request_params_header
447
+
448
+ options.apply_defaults timeout: @config.rpcs.get_key.timeout,
449
+ metadata: metadata,
450
+ retry_policy: @config.rpcs.get_key.retry_policy
451
+
452
+ options.apply_defaults timeout: @config.timeout,
453
+ metadata: @config.metadata,
454
+ retry_policy: @config.retry_policy
455
+
456
+ @api_keys_stub.call_rpc :get_key, request, options: options do |response, operation|
457
+ yield response, operation if block_given?
458
+ return response
459
+ end
460
+ rescue ::GRPC::BadStatus => e
461
+ raise ::Google::Cloud::Error.from_error(e)
462
+ end
463
+
464
+ ##
465
+ # Get the key string for an API key.
466
+ #
467
+ # NOTE: Key is a global resource; hence the only supported value for
468
+ # location is `global`.
469
+ #
470
+ # @overload get_key_string(request, options = nil)
471
+ # Pass arguments to `get_key_string` via a request object, either of type
472
+ # {::Google::Cloud::ApiKeys::V2::GetKeyStringRequest} or an equivalent Hash.
473
+ #
474
+ # @param request [::Google::Cloud::ApiKeys::V2::GetKeyStringRequest, ::Hash]
475
+ # A request object representing the call parameters. Required. To specify no
476
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
477
+ # @param options [::Gapic::CallOptions, ::Hash]
478
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
479
+ #
480
+ # @overload get_key_string(name: nil)
481
+ # Pass arguments to `get_key_string` via keyword arguments. Note that at
482
+ # least one keyword argument is required. To specify no parameters, or to keep all
483
+ # the default parameter values, pass an empty Hash as a request object (see above).
484
+ #
485
+ # @param name [::String]
486
+ # Required. The resource name of the API key to be retrieved.
487
+ #
488
+ # @yield [response, operation] Access the result along with the RPC operation
489
+ # @yieldparam response [::Google::Cloud::ApiKeys::V2::GetKeyStringResponse]
490
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
491
+ #
492
+ # @return [::Google::Cloud::ApiKeys::V2::GetKeyStringResponse]
493
+ #
494
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
495
+ #
496
+ # @example Basic example
497
+ # require "google/cloud/api_keys/v2"
498
+ #
499
+ # # Create a client object. The client can be reused for multiple calls.
500
+ # client = Google::Cloud::ApiKeys::V2::ApiKeys::Client.new
501
+ #
502
+ # # Create a request. To set request fields, pass in keyword arguments.
503
+ # request = Google::Cloud::ApiKeys::V2::GetKeyStringRequest.new
504
+ #
505
+ # # Call the get_key_string method.
506
+ # result = client.get_key_string request
507
+ #
508
+ # # The returned object is of type Google::Cloud::ApiKeys::V2::GetKeyStringResponse.
509
+ # p result
510
+ #
511
+ def get_key_string request, options = nil
512
+ raise ::ArgumentError, "request must be provided" if request.nil?
513
+
514
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiKeys::V2::GetKeyStringRequest
515
+
516
+ # Converts hash and nil to an options object
517
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
518
+
519
+ # Customize the options with defaults
520
+ metadata = @config.rpcs.get_key_string.metadata.to_h
521
+
522
+ # Set x-goog-api-client and x-goog-user-project headers
523
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
524
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
525
+ gapic_version: ::Google::Cloud::ApiKeys::V2::VERSION
526
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
527
+
528
+ header_params = {}
529
+ if request.name
530
+ header_params["name"] = request.name
531
+ end
532
+
533
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
534
+ metadata[:"x-goog-request-params"] ||= request_params_header
535
+
536
+ options.apply_defaults timeout: @config.rpcs.get_key_string.timeout,
537
+ metadata: metadata,
538
+ retry_policy: @config.rpcs.get_key_string.retry_policy
539
+
540
+ options.apply_defaults timeout: @config.timeout,
541
+ metadata: @config.metadata,
542
+ retry_policy: @config.retry_policy
543
+
544
+ @api_keys_stub.call_rpc :get_key_string, request, options: options do |response, operation|
545
+ yield response, operation if block_given?
546
+ return response
547
+ end
548
+ rescue ::GRPC::BadStatus => e
549
+ raise ::Google::Cloud::Error.from_error(e)
550
+ end
551
+
552
+ ##
553
+ # Patches the modifiable fields of an API key.
554
+ # The key string of the API key isn't included in the response.
555
+ #
556
+ # NOTE: Key is a global resource; hence the only supported value for
557
+ # location is `global`.
558
+ #
559
+ # @overload update_key(request, options = nil)
560
+ # Pass arguments to `update_key` via a request object, either of type
561
+ # {::Google::Cloud::ApiKeys::V2::UpdateKeyRequest} or an equivalent Hash.
562
+ #
563
+ # @param request [::Google::Cloud::ApiKeys::V2::UpdateKeyRequest, ::Hash]
564
+ # A request object representing the call parameters. Required. To specify no
565
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
566
+ # @param options [::Gapic::CallOptions, ::Hash]
567
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
568
+ #
569
+ # @overload update_key(key: nil, update_mask: nil)
570
+ # Pass arguments to `update_key` via keyword arguments. Note that at
571
+ # least one keyword argument is required. To specify no parameters, or to keep all
572
+ # the default parameter values, pass an empty Hash as a request object (see above).
573
+ #
574
+ # @param key [::Google::Cloud::ApiKeys::V2::Key, ::Hash]
575
+ # Required. Set the `name` field to the resource name of the API key to be
576
+ # updated. You can update only the `display_name`, `restrictions`, and
577
+ # `annotations` fields.
578
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
579
+ # The field mask specifies which fields to be updated as part of this
580
+ # request. All other fields are ignored.
581
+ # Mutable fields are: `display_name`, `restrictions`, and `annotations`.
582
+ # If an update mask is not provided, the service treats it as an implied mask
583
+ # equivalent to all allowed fields that are set on the wire. If the field
584
+ # mask has a special value "*", the service treats it equivalent to replace
585
+ # all allowed mutable fields.
586
+ #
587
+ # @yield [response, operation] Access the result along with the RPC operation
588
+ # @yieldparam response [::Gapic::Operation]
589
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
590
+ #
591
+ # @return [::Gapic::Operation]
592
+ #
593
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
594
+ #
595
+ # @example Basic example
596
+ # require "google/cloud/api_keys/v2"
597
+ #
598
+ # # Create a client object. The client can be reused for multiple calls.
599
+ # client = Google::Cloud::ApiKeys::V2::ApiKeys::Client.new
600
+ #
601
+ # # Create a request. To set request fields, pass in keyword arguments.
602
+ # request = Google::Cloud::ApiKeys::V2::UpdateKeyRequest.new
603
+ #
604
+ # # Call the update_key method.
605
+ # result = client.update_key request
606
+ #
607
+ # # The returned object is of type Gapic::Operation. You can use this
608
+ # # object to check the status of an operation, cancel it, or wait
609
+ # # for results. Here is how to block until completion:
610
+ # result.wait_until_done! timeout: 60
611
+ # if result.response?
612
+ # p result.response
613
+ # else
614
+ # puts "Error!"
615
+ # end
616
+ #
617
+ def update_key request, options = nil
618
+ raise ::ArgumentError, "request must be provided" if request.nil?
619
+
620
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiKeys::V2::UpdateKeyRequest
621
+
622
+ # Converts hash and nil to an options object
623
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
624
+
625
+ # Customize the options with defaults
626
+ metadata = @config.rpcs.update_key.metadata.to_h
627
+
628
+ # Set x-goog-api-client and x-goog-user-project headers
629
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
630
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
631
+ gapic_version: ::Google::Cloud::ApiKeys::V2::VERSION
632
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
633
+
634
+ header_params = {}
635
+ if request.key&.name
636
+ header_params["key.name"] = request.key.name
637
+ end
638
+
639
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
640
+ metadata[:"x-goog-request-params"] ||= request_params_header
641
+
642
+ options.apply_defaults timeout: @config.rpcs.update_key.timeout,
643
+ metadata: metadata,
644
+ retry_policy: @config.rpcs.update_key.retry_policy
645
+
646
+ options.apply_defaults timeout: @config.timeout,
647
+ metadata: @config.metadata,
648
+ retry_policy: @config.retry_policy
649
+
650
+ @api_keys_stub.call_rpc :update_key, request, options: options do |response, operation|
651
+ response = ::Gapic::Operation.new response, @operations_client, options: options
652
+ yield response, operation if block_given?
653
+ return response
654
+ end
655
+ rescue ::GRPC::BadStatus => e
656
+ raise ::Google::Cloud::Error.from_error(e)
657
+ end
658
+
659
+ ##
660
+ # Deletes an API key. Deleted key can be retrieved within 30 days of
661
+ # deletion. Afterward, key will be purged from the project.
662
+ #
663
+ # NOTE: Key is a global resource; hence the only supported value for
664
+ # location is `global`.
665
+ #
666
+ # @overload delete_key(request, options = nil)
667
+ # Pass arguments to `delete_key` via a request object, either of type
668
+ # {::Google::Cloud::ApiKeys::V2::DeleteKeyRequest} or an equivalent Hash.
669
+ #
670
+ # @param request [::Google::Cloud::ApiKeys::V2::DeleteKeyRequest, ::Hash]
671
+ # A request object representing the call parameters. Required. To specify no
672
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
673
+ # @param options [::Gapic::CallOptions, ::Hash]
674
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
675
+ #
676
+ # @overload delete_key(name: nil, etag: nil)
677
+ # Pass arguments to `delete_key` via keyword arguments. Note that at
678
+ # least one keyword argument is required. To specify no parameters, or to keep all
679
+ # the default parameter values, pass an empty Hash as a request object (see above).
680
+ #
681
+ # @param name [::String]
682
+ # Required. The resource name of the API key to be deleted.
683
+ # @param etag [::String]
684
+ # Optional. The etag known to the client for the expected state of the key.
685
+ # This is to be used for optimistic concurrency.
686
+ #
687
+ # @yield [response, operation] Access the result along with the RPC operation
688
+ # @yieldparam response [::Gapic::Operation]
689
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
690
+ #
691
+ # @return [::Gapic::Operation]
692
+ #
693
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
694
+ #
695
+ # @example Basic example
696
+ # require "google/cloud/api_keys/v2"
697
+ #
698
+ # # Create a client object. The client can be reused for multiple calls.
699
+ # client = Google::Cloud::ApiKeys::V2::ApiKeys::Client.new
700
+ #
701
+ # # Create a request. To set request fields, pass in keyword arguments.
702
+ # request = Google::Cloud::ApiKeys::V2::DeleteKeyRequest.new
703
+ #
704
+ # # Call the delete_key method.
705
+ # result = client.delete_key request
706
+ #
707
+ # # The returned object is of type Gapic::Operation. You can use this
708
+ # # object to check the status of an operation, cancel it, or wait
709
+ # # for results. Here is how to block until completion:
710
+ # result.wait_until_done! timeout: 60
711
+ # if result.response?
712
+ # p result.response
713
+ # else
714
+ # puts "Error!"
715
+ # end
716
+ #
717
+ def delete_key request, options = nil
718
+ raise ::ArgumentError, "request must be provided" if request.nil?
719
+
720
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiKeys::V2::DeleteKeyRequest
721
+
722
+ # Converts hash and nil to an options object
723
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
724
+
725
+ # Customize the options with defaults
726
+ metadata = @config.rpcs.delete_key.metadata.to_h
727
+
728
+ # Set x-goog-api-client and x-goog-user-project headers
729
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
730
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
731
+ gapic_version: ::Google::Cloud::ApiKeys::V2::VERSION
732
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
733
+
734
+ header_params = {}
735
+ if request.name
736
+ header_params["name"] = request.name
737
+ end
738
+
739
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
740
+ metadata[:"x-goog-request-params"] ||= request_params_header
741
+
742
+ options.apply_defaults timeout: @config.rpcs.delete_key.timeout,
743
+ metadata: metadata,
744
+ retry_policy: @config.rpcs.delete_key.retry_policy
745
+
746
+ options.apply_defaults timeout: @config.timeout,
747
+ metadata: @config.metadata,
748
+ retry_policy: @config.retry_policy
749
+
750
+ @api_keys_stub.call_rpc :delete_key, request, options: options do |response, operation|
751
+ response = ::Gapic::Operation.new response, @operations_client, options: options
752
+ yield response, operation if block_given?
753
+ return response
754
+ end
755
+ rescue ::GRPC::BadStatus => e
756
+ raise ::Google::Cloud::Error.from_error(e)
757
+ end
758
+
759
+ ##
760
+ # Undeletes an API key which was deleted within 30 days.
761
+ #
762
+ # NOTE: Key is a global resource; hence the only supported value for
763
+ # location is `global`.
764
+ #
765
+ # @overload undelete_key(request, options = nil)
766
+ # Pass arguments to `undelete_key` via a request object, either of type
767
+ # {::Google::Cloud::ApiKeys::V2::UndeleteKeyRequest} or an equivalent Hash.
768
+ #
769
+ # @param request [::Google::Cloud::ApiKeys::V2::UndeleteKeyRequest, ::Hash]
770
+ # A request object representing the call parameters. Required. To specify no
771
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
772
+ # @param options [::Gapic::CallOptions, ::Hash]
773
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
774
+ #
775
+ # @overload undelete_key(name: nil)
776
+ # Pass arguments to `undelete_key` via keyword arguments. Note that at
777
+ # least one keyword argument is required. To specify no parameters, or to keep all
778
+ # the default parameter values, pass an empty Hash as a request object (see above).
779
+ #
780
+ # @param name [::String]
781
+ # Required. The resource name of the API key to be undeleted.
782
+ #
783
+ # @yield [response, operation] Access the result along with the RPC operation
784
+ # @yieldparam response [::Gapic::Operation]
785
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
786
+ #
787
+ # @return [::Gapic::Operation]
788
+ #
789
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
790
+ #
791
+ # @example Basic example
792
+ # require "google/cloud/api_keys/v2"
793
+ #
794
+ # # Create a client object. The client can be reused for multiple calls.
795
+ # client = Google::Cloud::ApiKeys::V2::ApiKeys::Client.new
796
+ #
797
+ # # Create a request. To set request fields, pass in keyword arguments.
798
+ # request = Google::Cloud::ApiKeys::V2::UndeleteKeyRequest.new
799
+ #
800
+ # # Call the undelete_key method.
801
+ # result = client.undelete_key request
802
+ #
803
+ # # The returned object is of type Gapic::Operation. You can use this
804
+ # # object to check the status of an operation, cancel it, or wait
805
+ # # for results. Here is how to block until completion:
806
+ # result.wait_until_done! timeout: 60
807
+ # if result.response?
808
+ # p result.response
809
+ # else
810
+ # puts "Error!"
811
+ # end
812
+ #
813
+ def undelete_key request, options = nil
814
+ raise ::ArgumentError, "request must be provided" if request.nil?
815
+
816
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiKeys::V2::UndeleteKeyRequest
817
+
818
+ # Converts hash and nil to an options object
819
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
820
+
821
+ # Customize the options with defaults
822
+ metadata = @config.rpcs.undelete_key.metadata.to_h
823
+
824
+ # Set x-goog-api-client and x-goog-user-project headers
825
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
826
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
827
+ gapic_version: ::Google::Cloud::ApiKeys::V2::VERSION
828
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
829
+
830
+ header_params = {}
831
+ if request.name
832
+ header_params["name"] = request.name
833
+ end
834
+
835
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
836
+ metadata[:"x-goog-request-params"] ||= request_params_header
837
+
838
+ options.apply_defaults timeout: @config.rpcs.undelete_key.timeout,
839
+ metadata: metadata,
840
+ retry_policy: @config.rpcs.undelete_key.retry_policy
841
+
842
+ options.apply_defaults timeout: @config.timeout,
843
+ metadata: @config.metadata,
844
+ retry_policy: @config.retry_policy
845
+
846
+ @api_keys_stub.call_rpc :undelete_key, request, options: options do |response, operation|
847
+ response = ::Gapic::Operation.new response, @operations_client, options: options
848
+ yield response, operation if block_given?
849
+ return response
850
+ end
851
+ rescue ::GRPC::BadStatus => e
852
+ raise ::Google::Cloud::Error.from_error(e)
853
+ end
854
+
855
+ ##
856
+ # Find the parent project and resource name of the API
857
+ # key that matches the key string in the request. If the API key has been
858
+ # purged, resource name will not be set.
859
+ # The service account must have the `apikeys.keys.lookup` permission
860
+ # on the parent project.
861
+ #
862
+ # @overload lookup_key(request, options = nil)
863
+ # Pass arguments to `lookup_key` via a request object, either of type
864
+ # {::Google::Cloud::ApiKeys::V2::LookupKeyRequest} or an equivalent Hash.
865
+ #
866
+ # @param request [::Google::Cloud::ApiKeys::V2::LookupKeyRequest, ::Hash]
867
+ # A request object representing the call parameters. Required. To specify no
868
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
869
+ # @param options [::Gapic::CallOptions, ::Hash]
870
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
871
+ #
872
+ # @overload lookup_key(key_string: nil)
873
+ # Pass arguments to `lookup_key` via keyword arguments. Note that at
874
+ # least one keyword argument is required. To specify no parameters, or to keep all
875
+ # the default parameter values, pass an empty Hash as a request object (see above).
876
+ #
877
+ # @param key_string [::String]
878
+ # Required. Finds the project that owns the key string value.
879
+ #
880
+ # @yield [response, operation] Access the result along with the RPC operation
881
+ # @yieldparam response [::Google::Cloud::ApiKeys::V2::LookupKeyResponse]
882
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
883
+ #
884
+ # @return [::Google::Cloud::ApiKeys::V2::LookupKeyResponse]
885
+ #
886
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
887
+ #
888
+ # @example Basic example
889
+ # require "google/cloud/api_keys/v2"
890
+ #
891
+ # # Create a client object. The client can be reused for multiple calls.
892
+ # client = Google::Cloud::ApiKeys::V2::ApiKeys::Client.new
893
+ #
894
+ # # Create a request. To set request fields, pass in keyword arguments.
895
+ # request = Google::Cloud::ApiKeys::V2::LookupKeyRequest.new
896
+ #
897
+ # # Call the lookup_key method.
898
+ # result = client.lookup_key request
899
+ #
900
+ # # The returned object is of type Google::Cloud::ApiKeys::V2::LookupKeyResponse.
901
+ # p result
902
+ #
903
+ def lookup_key request, options = nil
904
+ raise ::ArgumentError, "request must be provided" if request.nil?
905
+
906
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiKeys::V2::LookupKeyRequest
907
+
908
+ # Converts hash and nil to an options object
909
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
910
+
911
+ # Customize the options with defaults
912
+ metadata = @config.rpcs.lookup_key.metadata.to_h
913
+
914
+ # Set x-goog-api-client and x-goog-user-project headers
915
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
916
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
917
+ gapic_version: ::Google::Cloud::ApiKeys::V2::VERSION
918
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
919
+
920
+ options.apply_defaults timeout: @config.rpcs.lookup_key.timeout,
921
+ metadata: metadata,
922
+ retry_policy: @config.rpcs.lookup_key.retry_policy
923
+
924
+ options.apply_defaults timeout: @config.timeout,
925
+ metadata: @config.metadata,
926
+ retry_policy: @config.retry_policy
927
+
928
+ @api_keys_stub.call_rpc :lookup_key, request, options: options do |response, operation|
929
+ yield response, operation if block_given?
930
+ return response
931
+ end
932
+ rescue ::GRPC::BadStatus => e
933
+ raise ::Google::Cloud::Error.from_error(e)
934
+ end
935
+
936
+ ##
937
+ # Configuration class for the ApiKeys API.
938
+ #
939
+ # This class represents the configuration for ApiKeys,
940
+ # providing control over timeouts, retry behavior, logging, transport
941
+ # parameters, and other low-level controls. Certain parameters can also be
942
+ # applied individually to specific RPCs. See
943
+ # {::Google::Cloud::ApiKeys::V2::ApiKeys::Client::Configuration::Rpcs}
944
+ # for a list of RPCs that can be configured independently.
945
+ #
946
+ # Configuration can be applied globally to all clients, or to a single client
947
+ # on construction.
948
+ #
949
+ # @example
950
+ #
951
+ # # Modify the global config, setting the timeout for
952
+ # # create_key to 20 seconds,
953
+ # # and all remaining timeouts to 10 seconds.
954
+ # ::Google::Cloud::ApiKeys::V2::ApiKeys::Client.configure do |config|
955
+ # config.timeout = 10.0
956
+ # config.rpcs.create_key.timeout = 20.0
957
+ # end
958
+ #
959
+ # # Apply the above configuration only to a new client.
960
+ # client = ::Google::Cloud::ApiKeys::V2::ApiKeys::Client.new do |config|
961
+ # config.timeout = 10.0
962
+ # config.rpcs.create_key.timeout = 20.0
963
+ # end
964
+ #
965
+ # @!attribute [rw] endpoint
966
+ # The hostname or hostname:port of the service endpoint.
967
+ # Defaults to `"apikeys.googleapis.com"`.
968
+ # @return [::String]
969
+ # @!attribute [rw] credentials
970
+ # Credentials to send with calls. You may provide any of the following types:
971
+ # * (`String`) The path to a service account key file in JSON format
972
+ # * (`Hash`) A service account key as a Hash
973
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
974
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
975
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
976
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
977
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
978
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
979
+ # * (`nil`) indicating no credentials
980
+ # @return [::Object]
981
+ # @!attribute [rw] scope
982
+ # The OAuth scopes
983
+ # @return [::Array<::String>]
984
+ # @!attribute [rw] lib_name
985
+ # The library name as recorded in instrumentation and logging
986
+ # @return [::String]
987
+ # @!attribute [rw] lib_version
988
+ # The library version as recorded in instrumentation and logging
989
+ # @return [::String]
990
+ # @!attribute [rw] channel_args
991
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
992
+ # `GRPC::Core::Channel` object is provided as the credential.
993
+ # @return [::Hash]
994
+ # @!attribute [rw] interceptors
995
+ # An array of interceptors that are run before calls are executed.
996
+ # @return [::Array<::GRPC::ClientInterceptor>]
997
+ # @!attribute [rw] timeout
998
+ # The call timeout in seconds.
999
+ # @return [::Numeric]
1000
+ # @!attribute [rw] metadata
1001
+ # Additional gRPC headers to be sent with the call.
1002
+ # @return [::Hash{::Symbol=>::String}]
1003
+ # @!attribute [rw] retry_policy
1004
+ # The retry policy. The value is a hash with the following keys:
1005
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1006
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1007
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1008
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1009
+ # trigger a retry.
1010
+ # @return [::Hash]
1011
+ # @!attribute [rw] quota_project
1012
+ # A separate project against which to charge quota.
1013
+ # @return [::String]
1014
+ #
1015
+ class Configuration
1016
+ extend ::Gapic::Config
1017
+
1018
+ config_attr :endpoint, "apikeys.googleapis.com", ::String
1019
+ config_attr :credentials, nil do |value|
1020
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1021
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1022
+ allowed.any? { |klass| klass === value }
1023
+ end
1024
+ config_attr :scope, nil, ::String, ::Array, nil
1025
+ config_attr :lib_name, nil, ::String, nil
1026
+ config_attr :lib_version, nil, ::String, nil
1027
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1028
+ config_attr :interceptors, nil, ::Array, nil
1029
+ config_attr :timeout, nil, ::Numeric, nil
1030
+ config_attr :metadata, nil, ::Hash, nil
1031
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1032
+ config_attr :quota_project, nil, ::String, nil
1033
+
1034
+ # @private
1035
+ def initialize parent_config = nil
1036
+ @parent_config = parent_config unless parent_config.nil?
1037
+
1038
+ yield self if block_given?
1039
+ end
1040
+
1041
+ ##
1042
+ # Configurations for individual RPCs
1043
+ # @return [Rpcs]
1044
+ #
1045
+ def rpcs
1046
+ @rpcs ||= begin
1047
+ parent_rpcs = nil
1048
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1049
+ Rpcs.new parent_rpcs
1050
+ end
1051
+ end
1052
+
1053
+ ##
1054
+ # Configuration RPC class for the ApiKeys API.
1055
+ #
1056
+ # Includes fields providing the configuration for each RPC in this service.
1057
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1058
+ # the following configuration fields:
1059
+ #
1060
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1061
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1062
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1063
+ # include the following keys:
1064
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1065
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1066
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1067
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1068
+ # trigger a retry.
1069
+ #
1070
+ class Rpcs
1071
+ ##
1072
+ # RPC-specific configuration for `create_key`
1073
+ # @return [::Gapic::Config::Method]
1074
+ #
1075
+ attr_reader :create_key
1076
+ ##
1077
+ # RPC-specific configuration for `list_keys`
1078
+ # @return [::Gapic::Config::Method]
1079
+ #
1080
+ attr_reader :list_keys
1081
+ ##
1082
+ # RPC-specific configuration for `get_key`
1083
+ # @return [::Gapic::Config::Method]
1084
+ #
1085
+ attr_reader :get_key
1086
+ ##
1087
+ # RPC-specific configuration for `get_key_string`
1088
+ # @return [::Gapic::Config::Method]
1089
+ #
1090
+ attr_reader :get_key_string
1091
+ ##
1092
+ # RPC-specific configuration for `update_key`
1093
+ # @return [::Gapic::Config::Method]
1094
+ #
1095
+ attr_reader :update_key
1096
+ ##
1097
+ # RPC-specific configuration for `delete_key`
1098
+ # @return [::Gapic::Config::Method]
1099
+ #
1100
+ attr_reader :delete_key
1101
+ ##
1102
+ # RPC-specific configuration for `undelete_key`
1103
+ # @return [::Gapic::Config::Method]
1104
+ #
1105
+ attr_reader :undelete_key
1106
+ ##
1107
+ # RPC-specific configuration for `lookup_key`
1108
+ # @return [::Gapic::Config::Method]
1109
+ #
1110
+ attr_reader :lookup_key
1111
+
1112
+ # @private
1113
+ def initialize parent_rpcs = nil
1114
+ create_key_config = parent_rpcs.create_key if parent_rpcs.respond_to? :create_key
1115
+ @create_key = ::Gapic::Config::Method.new create_key_config
1116
+ list_keys_config = parent_rpcs.list_keys if parent_rpcs.respond_to? :list_keys
1117
+ @list_keys = ::Gapic::Config::Method.new list_keys_config
1118
+ get_key_config = parent_rpcs.get_key if parent_rpcs.respond_to? :get_key
1119
+ @get_key = ::Gapic::Config::Method.new get_key_config
1120
+ get_key_string_config = parent_rpcs.get_key_string if parent_rpcs.respond_to? :get_key_string
1121
+ @get_key_string = ::Gapic::Config::Method.new get_key_string_config
1122
+ update_key_config = parent_rpcs.update_key if parent_rpcs.respond_to? :update_key
1123
+ @update_key = ::Gapic::Config::Method.new update_key_config
1124
+ delete_key_config = parent_rpcs.delete_key if parent_rpcs.respond_to? :delete_key
1125
+ @delete_key = ::Gapic::Config::Method.new delete_key_config
1126
+ undelete_key_config = parent_rpcs.undelete_key if parent_rpcs.respond_to? :undelete_key
1127
+ @undelete_key = ::Gapic::Config::Method.new undelete_key_config
1128
+ lookup_key_config = parent_rpcs.lookup_key if parent_rpcs.respond_to? :lookup_key
1129
+ @lookup_key = ::Gapic::Config::Method.new lookup_key_config
1130
+
1131
+ yield self if block_given?
1132
+ end
1133
+ end
1134
+ end
1135
+ end
1136
+ end
1137
+ end
1138
+ end
1139
+ end
1140
+ end