google-cloud-redis-v1 0.8.0 → 0.10.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,1224 @@
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/redis/v1/cloud_redis_pb"
21
+ require "google/cloud/redis/v1/cloud_redis/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Redis
27
+ module V1
28
+ module CloudRedis
29
+ module Rest
30
+ ##
31
+ # REST client for the CloudRedis service.
32
+ #
33
+ # Configures and manages Cloud Memorystore for Redis instances
34
+ #
35
+ # Google Cloud Memorystore for Redis v1
36
+ #
37
+ # The `redis.googleapis.com` service implements the Google Cloud Memorystore
38
+ # for Redis API and defines the following resource model for managing Redis
39
+ # instances:
40
+ # * The service works with a collection of cloud projects, named: `/projects/*`
41
+ # * Each project has a collection of available locations, named: `/locations/*`
42
+ # * Each location has a collection of Redis instances, named: `/instances/*`
43
+ # * As such, Redis instances are resources of the form:
44
+ # `/projects/{project_id}/locations/{location_id}/instances/{instance_id}`
45
+ #
46
+ # Note that location_id must be referring to a GCP `region`; for example:
47
+ # * `projects/redpepper-1290/locations/us-central1/instances/my-redis`
48
+ #
49
+ class Client
50
+ include Paths
51
+
52
+ # @private
53
+ attr_reader :cloud_redis_stub
54
+
55
+ ##
56
+ # Configure the CloudRedis Client class.
57
+ #
58
+ # See {::Google::Cloud::Redis::V1::CloudRedis::Rest::Client::Configuration}
59
+ # for a description of the configuration fields.
60
+ #
61
+ # @example
62
+ #
63
+ # # Modify the configuration for all CloudRedis clients
64
+ # ::Google::Cloud::Redis::V1::CloudRedis::Rest::Client.configure do |config|
65
+ # config.timeout = 10.0
66
+ # end
67
+ #
68
+ # @yield [config] Configure the Client client.
69
+ # @yieldparam config [Client::Configuration]
70
+ #
71
+ # @return [Client::Configuration]
72
+ #
73
+ def self.configure
74
+ @configure ||= begin
75
+ namespace = ["Google", "Cloud", "Redis", "V1"]
76
+ parent_config = while namespace.any?
77
+ parent_name = namespace.join "::"
78
+ parent_const = const_get parent_name
79
+ break parent_const.configure if parent_const.respond_to? :configure
80
+ namespace.pop
81
+ end
82
+ default_config = Client::Configuration.new parent_config
83
+
84
+ default_config.rpcs.list_instances.timeout = 600.0
85
+
86
+ default_config.rpcs.get_instance.timeout = 600.0
87
+
88
+ default_config.rpcs.get_instance_auth_string.timeout = 600.0
89
+
90
+ default_config.rpcs.create_instance.timeout = 600.0
91
+
92
+ default_config.rpcs.update_instance.timeout = 600.0
93
+
94
+ default_config.rpcs.upgrade_instance.timeout = 600.0
95
+
96
+ default_config.rpcs.import_instance.timeout = 600.0
97
+
98
+ default_config.rpcs.export_instance.timeout = 600.0
99
+
100
+ default_config.rpcs.failover_instance.timeout = 600.0
101
+
102
+ default_config.rpcs.delete_instance.timeout = 600.0
103
+
104
+ default_config.rpcs.reschedule_maintenance.timeout = 600.0
105
+
106
+ default_config
107
+ end
108
+ yield @configure if block_given?
109
+ @configure
110
+ end
111
+
112
+ ##
113
+ # Configure the CloudRedis Client instance.
114
+ #
115
+ # The configuration is set to the derived mode, meaning that values can be changed,
116
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
117
+ # should be made on {Client.configure}.
118
+ #
119
+ # See {::Google::Cloud::Redis::V1::CloudRedis::Rest::Client::Configuration}
120
+ # for a description of the configuration fields.
121
+ #
122
+ # @yield [config] Configure the Client client.
123
+ # @yieldparam config [Client::Configuration]
124
+ #
125
+ # @return [Client::Configuration]
126
+ #
127
+ def configure
128
+ yield @config if block_given?
129
+ @config
130
+ end
131
+
132
+ ##
133
+ # Create a new CloudRedis REST client object.
134
+ #
135
+ # @example
136
+ #
137
+ # # Create a client using the default configuration
138
+ # client = ::Google::Cloud::Redis::V1::CloudRedis::Rest::Client.new
139
+ #
140
+ # # Create a client using a custom configuration
141
+ # client = ::Google::Cloud::Redis::V1::CloudRedis::Rest::Client.new do |config|
142
+ # config.timeout = 10.0
143
+ # end
144
+ #
145
+ # @yield [config] Configure the CloudRedis client.
146
+ # @yieldparam config [Client::Configuration]
147
+ #
148
+ def initialize
149
+ # Create the configuration object
150
+ @config = Configuration.new Client.configure
151
+
152
+ # Yield the configuration if needed
153
+ yield @config if block_given?
154
+
155
+ # Create credentials
156
+ credentials = @config.credentials
157
+ # Use self-signed JWT if the endpoint is unchanged from default,
158
+ # but only if the default endpoint does not have a region prefix.
159
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
160
+ !@config.endpoint.split(".").first.include?("-")
161
+ credentials ||= Credentials.default scope: @config.scope,
162
+ enable_self_signed_jwt: enable_self_signed_jwt
163
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
164
+ credentials = Credentials.new credentials, scope: @config.scope
165
+ end
166
+
167
+ @quota_project_id = @config.quota_project
168
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
169
+
170
+ @operations_client = ::Google::Cloud::Redis::V1::CloudRedis::Rest::Operations.new do |config|
171
+ config.credentials = credentials
172
+ config.quota_project = @quota_project_id
173
+ config.endpoint = @config.endpoint
174
+ end
175
+
176
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
177
+ config.credentials = credentials
178
+ config.quota_project = @quota_project_id
179
+ config.endpoint = @config.endpoint
180
+ config.bindings_override = @config.bindings_override
181
+ end
182
+
183
+ @cloud_redis_stub = ::Google::Cloud::Redis::V1::CloudRedis::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
184
+ end
185
+
186
+ ##
187
+ # Get the associated client for long-running operations.
188
+ #
189
+ # @return [::Google::Cloud::Redis::V1::CloudRedis::Rest::Operations]
190
+ #
191
+ attr_reader :operations_client
192
+
193
+ ##
194
+ # Get the associated client for mix-in of the Locations.
195
+ #
196
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
197
+ #
198
+ attr_reader :location_client
199
+
200
+ # Service calls
201
+
202
+ ##
203
+ # Lists all Redis instances owned by a project in either the specified
204
+ # location (region) or all locations.
205
+ #
206
+ # The location should have the following format:
207
+ #
208
+ # * `projects/{project_id}/locations/{location_id}`
209
+ #
210
+ # If `location_id` is specified as `-` (wildcard), then all regions
211
+ # available to the project are queried, and the results are aggregated.
212
+ #
213
+ # @overload list_instances(request, options = nil)
214
+ # Pass arguments to `list_instances` via a request object, either of type
215
+ # {::Google::Cloud::Redis::V1::ListInstancesRequest} or an equivalent Hash.
216
+ #
217
+ # @param request [::Google::Cloud::Redis::V1::ListInstancesRequest, ::Hash]
218
+ # A request object representing the call parameters. Required. To specify no
219
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
220
+ # @param options [::Gapic::CallOptions, ::Hash]
221
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
222
+ #
223
+ # @overload list_instances(parent: nil, page_size: nil, page_token: nil)
224
+ # Pass arguments to `list_instances` via keyword arguments. Note that at
225
+ # least one keyword argument is required. To specify no parameters, or to keep all
226
+ # the default parameter values, pass an empty Hash as a request object (see above).
227
+ #
228
+ # @param parent [::String]
229
+ # Required. The resource name of the instance location using the form:
230
+ # `projects/{project_id}/locations/{location_id}`
231
+ # where `location_id` refers to a GCP region.
232
+ # @param page_size [::Integer]
233
+ # The maximum number of items to return.
234
+ #
235
+ # If not specified, a default value of 1000 will be used by the service.
236
+ # Regardless of the page_size value, the response may include a partial list
237
+ # and a caller should only rely on response's
238
+ # {::Google::Cloud::Redis::V1::ListInstancesResponse#next_page_token `next_page_token`}
239
+ # to determine if there are more instances left to be queried.
240
+ # @param page_token [::String]
241
+ # The `next_page_token` value returned from a previous
242
+ # {::Google::Cloud::Redis::V1::CloudRedis::Rest::Client#list_instances ListInstances} request, if
243
+ # any.
244
+ # @yield [result, operation] Access the result along with the TransportOperation object
245
+ # @yieldparam result [::Google::Cloud::Redis::V1::ListInstancesResponse]
246
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
247
+ #
248
+ # @return [::Google::Cloud::Redis::V1::ListInstancesResponse]
249
+ #
250
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
251
+ def list_instances request, options = nil
252
+ raise ::ArgumentError, "request must be provided" if request.nil?
253
+
254
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::ListInstancesRequest
255
+
256
+ # Converts hash and nil to an options object
257
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
258
+
259
+ # Customize the options with defaults
260
+ call_metadata = @config.rpcs.list_instances.metadata.to_h
261
+
262
+ # Set x-goog-api-client and x-goog-user-project headers
263
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
264
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
265
+ gapic_version: ::Google::Cloud::Redis::V1::VERSION,
266
+ transports_version_send: [:rest]
267
+
268
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
269
+
270
+ options.apply_defaults timeout: @config.rpcs.list_instances.timeout,
271
+ metadata: call_metadata,
272
+ retry_policy: @config.rpcs.list_instances.retry_policy
273
+
274
+ options.apply_defaults timeout: @config.timeout,
275
+ metadata: @config.metadata,
276
+ retry_policy: @config.retry_policy
277
+
278
+ @cloud_redis_stub.list_instances request, options do |result, operation|
279
+ yield result, operation if block_given?
280
+ return result
281
+ end
282
+ rescue ::Gapic::Rest::Error => e
283
+ raise ::Google::Cloud::Error.from_error(e)
284
+ end
285
+
286
+ ##
287
+ # Gets the details of a specific Redis instance.
288
+ #
289
+ # @overload get_instance(request, options = nil)
290
+ # Pass arguments to `get_instance` via a request object, either of type
291
+ # {::Google::Cloud::Redis::V1::GetInstanceRequest} or an equivalent Hash.
292
+ #
293
+ # @param request [::Google::Cloud::Redis::V1::GetInstanceRequest, ::Hash]
294
+ # A request object representing the call parameters. Required. To specify no
295
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
296
+ # @param options [::Gapic::CallOptions, ::Hash]
297
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
298
+ #
299
+ # @overload get_instance(name: nil)
300
+ # Pass arguments to `get_instance` via keyword arguments. Note that at
301
+ # least one keyword argument is required. To specify no parameters, or to keep all
302
+ # the default parameter values, pass an empty Hash as a request object (see above).
303
+ #
304
+ # @param name [::String]
305
+ # Required. Redis instance resource name using the form:
306
+ # `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
307
+ # where `location_id` refers to a GCP region.
308
+ # @yield [result, operation] Access the result along with the TransportOperation object
309
+ # @yieldparam result [::Google::Cloud::Redis::V1::Instance]
310
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
311
+ #
312
+ # @return [::Google::Cloud::Redis::V1::Instance]
313
+ #
314
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
315
+ def get_instance request, options = nil
316
+ raise ::ArgumentError, "request must be provided" if request.nil?
317
+
318
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::GetInstanceRequest
319
+
320
+ # Converts hash and nil to an options object
321
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
322
+
323
+ # Customize the options with defaults
324
+ call_metadata = @config.rpcs.get_instance.metadata.to_h
325
+
326
+ # Set x-goog-api-client and x-goog-user-project headers
327
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
328
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
329
+ gapic_version: ::Google::Cloud::Redis::V1::VERSION,
330
+ transports_version_send: [:rest]
331
+
332
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
333
+
334
+ options.apply_defaults timeout: @config.rpcs.get_instance.timeout,
335
+ metadata: call_metadata,
336
+ retry_policy: @config.rpcs.get_instance.retry_policy
337
+
338
+ options.apply_defaults timeout: @config.timeout,
339
+ metadata: @config.metadata,
340
+ retry_policy: @config.retry_policy
341
+
342
+ @cloud_redis_stub.get_instance request, options do |result, operation|
343
+ yield result, operation if block_given?
344
+ return result
345
+ end
346
+ rescue ::Gapic::Rest::Error => e
347
+ raise ::Google::Cloud::Error.from_error(e)
348
+ end
349
+
350
+ ##
351
+ # Gets the AUTH string for a Redis instance. If AUTH is not enabled for the
352
+ # instance the response will be empty. This information is not included in
353
+ # the details returned to GetInstance.
354
+ #
355
+ # @overload get_instance_auth_string(request, options = nil)
356
+ # Pass arguments to `get_instance_auth_string` via a request object, either of type
357
+ # {::Google::Cloud::Redis::V1::GetInstanceAuthStringRequest} or an equivalent Hash.
358
+ #
359
+ # @param request [::Google::Cloud::Redis::V1::GetInstanceAuthStringRequest, ::Hash]
360
+ # A request object representing the call parameters. Required. To specify no
361
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
362
+ # @param options [::Gapic::CallOptions, ::Hash]
363
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
364
+ #
365
+ # @overload get_instance_auth_string(name: nil)
366
+ # Pass arguments to `get_instance_auth_string` via keyword arguments. Note that at
367
+ # least one keyword argument is required. To specify no parameters, or to keep all
368
+ # the default parameter values, pass an empty Hash as a request object (see above).
369
+ #
370
+ # @param name [::String]
371
+ # Required. Redis instance resource name using the form:
372
+ # `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
373
+ # where `location_id` refers to a GCP region.
374
+ # @yield [result, operation] Access the result along with the TransportOperation object
375
+ # @yieldparam result [::Google::Cloud::Redis::V1::InstanceAuthString]
376
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
377
+ #
378
+ # @return [::Google::Cloud::Redis::V1::InstanceAuthString]
379
+ #
380
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
381
+ def get_instance_auth_string request, options = nil
382
+ raise ::ArgumentError, "request must be provided" if request.nil?
383
+
384
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::GetInstanceAuthStringRequest
385
+
386
+ # Converts hash and nil to an options object
387
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
388
+
389
+ # Customize the options with defaults
390
+ call_metadata = @config.rpcs.get_instance_auth_string.metadata.to_h
391
+
392
+ # Set x-goog-api-client and x-goog-user-project headers
393
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
394
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
395
+ gapic_version: ::Google::Cloud::Redis::V1::VERSION,
396
+ transports_version_send: [:rest]
397
+
398
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
399
+
400
+ options.apply_defaults timeout: @config.rpcs.get_instance_auth_string.timeout,
401
+ metadata: call_metadata,
402
+ retry_policy: @config.rpcs.get_instance_auth_string.retry_policy
403
+
404
+ options.apply_defaults timeout: @config.timeout,
405
+ metadata: @config.metadata,
406
+ retry_policy: @config.retry_policy
407
+
408
+ @cloud_redis_stub.get_instance_auth_string request, options do |result, operation|
409
+ yield result, operation if block_given?
410
+ return result
411
+ end
412
+ rescue ::Gapic::Rest::Error => e
413
+ raise ::Google::Cloud::Error.from_error(e)
414
+ end
415
+
416
+ ##
417
+ # Creates a Redis instance based on the specified tier and memory size.
418
+ #
419
+ # By default, the instance is accessible from the project's
420
+ # [default network](https://cloud.google.com/vpc/docs/vpc).
421
+ #
422
+ # The creation is executed asynchronously and callers may check the returned
423
+ # operation to track its progress. Once the operation is completed the Redis
424
+ # instance will be fully functional. Completed longrunning.Operation will
425
+ # contain the new instance object in the response field.
426
+ #
427
+ # The returned operation is automatically deleted after a few hours, so there
428
+ # is no need to call DeleteOperation.
429
+ #
430
+ # @overload create_instance(request, options = nil)
431
+ # Pass arguments to `create_instance` via a request object, either of type
432
+ # {::Google::Cloud::Redis::V1::CreateInstanceRequest} or an equivalent Hash.
433
+ #
434
+ # @param request [::Google::Cloud::Redis::V1::CreateInstanceRequest, ::Hash]
435
+ # A request object representing the call parameters. Required. To specify no
436
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
437
+ # @param options [::Gapic::CallOptions, ::Hash]
438
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
439
+ #
440
+ # @overload create_instance(parent: nil, instance_id: nil, instance: nil)
441
+ # Pass arguments to `create_instance` via keyword arguments. Note that at
442
+ # least one keyword argument is required. To specify no parameters, or to keep all
443
+ # the default parameter values, pass an empty Hash as a request object (see above).
444
+ #
445
+ # @param parent [::String]
446
+ # Required. The resource name of the instance location using the form:
447
+ # `projects/{project_id}/locations/{location_id}`
448
+ # where `location_id` refers to a GCP region.
449
+ # @param instance_id [::String]
450
+ # Required. The logical name of the Redis instance in the customer project
451
+ # with the following restrictions:
452
+ #
453
+ # * Must contain only lowercase letters, numbers, and hyphens.
454
+ # * Must start with a letter.
455
+ # * Must be between 1-40 characters.
456
+ # * Must end with a number or a letter.
457
+ # * Must be unique within the customer project / location
458
+ # @param instance [::Google::Cloud::Redis::V1::Instance, ::Hash]
459
+ # Required. A Redis [Instance] resource
460
+ # @yield [result, operation] Access the result along with the TransportOperation object
461
+ # @yieldparam result [::Gapic::Operation]
462
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
463
+ #
464
+ # @return [::Gapic::Operation]
465
+ #
466
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
467
+ def create_instance request, options = nil
468
+ raise ::ArgumentError, "request must be provided" if request.nil?
469
+
470
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::CreateInstanceRequest
471
+
472
+ # Converts hash and nil to an options object
473
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
474
+
475
+ # Customize the options with defaults
476
+ call_metadata = @config.rpcs.create_instance.metadata.to_h
477
+
478
+ # Set x-goog-api-client and x-goog-user-project headers
479
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
480
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
481
+ gapic_version: ::Google::Cloud::Redis::V1::VERSION,
482
+ transports_version_send: [:rest]
483
+
484
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
485
+
486
+ options.apply_defaults timeout: @config.rpcs.create_instance.timeout,
487
+ metadata: call_metadata,
488
+ retry_policy: @config.rpcs.create_instance.retry_policy
489
+
490
+ options.apply_defaults timeout: @config.timeout,
491
+ metadata: @config.metadata,
492
+ retry_policy: @config.retry_policy
493
+
494
+ @cloud_redis_stub.create_instance request, options do |result, operation|
495
+ result = ::Gapic::Operation.new result, @operations_client, options: options
496
+ yield result, operation if block_given?
497
+ return result
498
+ end
499
+ rescue ::Gapic::Rest::Error => e
500
+ raise ::Google::Cloud::Error.from_error(e)
501
+ end
502
+
503
+ ##
504
+ # Updates the metadata and configuration of a specific Redis instance.
505
+ #
506
+ # Completed longrunning.Operation will contain the new instance object
507
+ # in the response field. The returned operation is automatically deleted
508
+ # after a few hours, so there is no need to call DeleteOperation.
509
+ #
510
+ # @overload update_instance(request, options = nil)
511
+ # Pass arguments to `update_instance` via a request object, either of type
512
+ # {::Google::Cloud::Redis::V1::UpdateInstanceRequest} or an equivalent Hash.
513
+ #
514
+ # @param request [::Google::Cloud::Redis::V1::UpdateInstanceRequest, ::Hash]
515
+ # A request object representing the call parameters. Required. To specify no
516
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
517
+ # @param options [::Gapic::CallOptions, ::Hash]
518
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
519
+ #
520
+ # @overload update_instance(update_mask: nil, instance: nil)
521
+ # Pass arguments to `update_instance` via keyword arguments. Note that at
522
+ # least one keyword argument is required. To specify no parameters, or to keep all
523
+ # the default parameter values, pass an empty Hash as a request object (see above).
524
+ #
525
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
526
+ # Required. Mask of fields to update. At least one path must be supplied in
527
+ # this field. The elements of the repeated paths field may only include these
528
+ # fields from {::Google::Cloud::Redis::V1::Instance Instance}:
529
+ #
530
+ # * `displayName`
531
+ # * `labels`
532
+ # * `memorySizeGb`
533
+ # * `redisConfig`
534
+ # * `replica_count`
535
+ # @param instance [::Google::Cloud::Redis::V1::Instance, ::Hash]
536
+ # Required. Update description.
537
+ # Only fields specified in update_mask are updated.
538
+ # @yield [result, operation] Access the result along with the TransportOperation object
539
+ # @yieldparam result [::Gapic::Operation]
540
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
541
+ #
542
+ # @return [::Gapic::Operation]
543
+ #
544
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
545
+ def update_instance request, options = nil
546
+ raise ::ArgumentError, "request must be provided" if request.nil?
547
+
548
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::UpdateInstanceRequest
549
+
550
+ # Converts hash and nil to an options object
551
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
552
+
553
+ # Customize the options with defaults
554
+ call_metadata = @config.rpcs.update_instance.metadata.to_h
555
+
556
+ # Set x-goog-api-client and x-goog-user-project headers
557
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
558
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
559
+ gapic_version: ::Google::Cloud::Redis::V1::VERSION,
560
+ transports_version_send: [:rest]
561
+
562
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
563
+
564
+ options.apply_defaults timeout: @config.rpcs.update_instance.timeout,
565
+ metadata: call_metadata,
566
+ retry_policy: @config.rpcs.update_instance.retry_policy
567
+
568
+ options.apply_defaults timeout: @config.timeout,
569
+ metadata: @config.metadata,
570
+ retry_policy: @config.retry_policy
571
+
572
+ @cloud_redis_stub.update_instance request, options do |result, operation|
573
+ result = ::Gapic::Operation.new result, @operations_client, options: options
574
+ yield result, operation if block_given?
575
+ return result
576
+ end
577
+ rescue ::Gapic::Rest::Error => e
578
+ raise ::Google::Cloud::Error.from_error(e)
579
+ end
580
+
581
+ ##
582
+ # Upgrades Redis instance to the newer Redis version specified in the
583
+ # request.
584
+ #
585
+ # @overload upgrade_instance(request, options = nil)
586
+ # Pass arguments to `upgrade_instance` via a request object, either of type
587
+ # {::Google::Cloud::Redis::V1::UpgradeInstanceRequest} or an equivalent Hash.
588
+ #
589
+ # @param request [::Google::Cloud::Redis::V1::UpgradeInstanceRequest, ::Hash]
590
+ # A request object representing the call parameters. Required. To specify no
591
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
592
+ # @param options [::Gapic::CallOptions, ::Hash]
593
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
594
+ #
595
+ # @overload upgrade_instance(name: nil, redis_version: nil)
596
+ # Pass arguments to `upgrade_instance` via keyword arguments. Note that at
597
+ # least one keyword argument is required. To specify no parameters, or to keep all
598
+ # the default parameter values, pass an empty Hash as a request object (see above).
599
+ #
600
+ # @param name [::String]
601
+ # Required. Redis instance resource name using the form:
602
+ # `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
603
+ # where `location_id` refers to a GCP region.
604
+ # @param redis_version [::String]
605
+ # Required. Specifies the target version of Redis software to upgrade to.
606
+ # @yield [result, operation] Access the result along with the TransportOperation object
607
+ # @yieldparam result [::Gapic::Operation]
608
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
609
+ #
610
+ # @return [::Gapic::Operation]
611
+ #
612
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
613
+ def upgrade_instance request, options = nil
614
+ raise ::ArgumentError, "request must be provided" if request.nil?
615
+
616
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::UpgradeInstanceRequest
617
+
618
+ # Converts hash and nil to an options object
619
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
620
+
621
+ # Customize the options with defaults
622
+ call_metadata = @config.rpcs.upgrade_instance.metadata.to_h
623
+
624
+ # Set x-goog-api-client and x-goog-user-project headers
625
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
626
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
627
+ gapic_version: ::Google::Cloud::Redis::V1::VERSION,
628
+ transports_version_send: [:rest]
629
+
630
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
631
+
632
+ options.apply_defaults timeout: @config.rpcs.upgrade_instance.timeout,
633
+ metadata: call_metadata,
634
+ retry_policy: @config.rpcs.upgrade_instance.retry_policy
635
+
636
+ options.apply_defaults timeout: @config.timeout,
637
+ metadata: @config.metadata,
638
+ retry_policy: @config.retry_policy
639
+
640
+ @cloud_redis_stub.upgrade_instance request, options do |result, operation|
641
+ result = ::Gapic::Operation.new result, @operations_client, options: options
642
+ yield result, operation if block_given?
643
+ return result
644
+ end
645
+ rescue ::Gapic::Rest::Error => e
646
+ raise ::Google::Cloud::Error.from_error(e)
647
+ end
648
+
649
+ ##
650
+ # Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
651
+ #
652
+ # Redis may stop serving during this operation. Instance state will be
653
+ # IMPORTING for entire operation. When complete, the instance will contain
654
+ # only data from the imported file.
655
+ #
656
+ # The returned operation is automatically deleted after a few hours, so
657
+ # there is no need to call DeleteOperation.
658
+ #
659
+ # @overload import_instance(request, options = nil)
660
+ # Pass arguments to `import_instance` via a request object, either of type
661
+ # {::Google::Cloud::Redis::V1::ImportInstanceRequest} or an equivalent Hash.
662
+ #
663
+ # @param request [::Google::Cloud::Redis::V1::ImportInstanceRequest, ::Hash]
664
+ # A request object representing the call parameters. Required. To specify no
665
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
666
+ # @param options [::Gapic::CallOptions, ::Hash]
667
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
668
+ #
669
+ # @overload import_instance(name: nil, input_config: nil)
670
+ # Pass arguments to `import_instance` via keyword arguments. Note that at
671
+ # least one keyword argument is required. To specify no parameters, or to keep all
672
+ # the default parameter values, pass an empty Hash as a request object (see above).
673
+ #
674
+ # @param name [::String]
675
+ # Required. Redis instance resource name using the form:
676
+ # `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
677
+ # where `location_id` refers to a GCP region.
678
+ # @param input_config [::Google::Cloud::Redis::V1::InputConfig, ::Hash]
679
+ # Required. Specify data to be imported.
680
+ # @yield [result, operation] Access the result along with the TransportOperation object
681
+ # @yieldparam result [::Gapic::Operation]
682
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
683
+ #
684
+ # @return [::Gapic::Operation]
685
+ #
686
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
687
+ def import_instance request, options = nil
688
+ raise ::ArgumentError, "request must be provided" if request.nil?
689
+
690
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::ImportInstanceRequest
691
+
692
+ # Converts hash and nil to an options object
693
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
694
+
695
+ # Customize the options with defaults
696
+ call_metadata = @config.rpcs.import_instance.metadata.to_h
697
+
698
+ # Set x-goog-api-client and x-goog-user-project headers
699
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
700
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
701
+ gapic_version: ::Google::Cloud::Redis::V1::VERSION,
702
+ transports_version_send: [:rest]
703
+
704
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
705
+
706
+ options.apply_defaults timeout: @config.rpcs.import_instance.timeout,
707
+ metadata: call_metadata,
708
+ retry_policy: @config.rpcs.import_instance.retry_policy
709
+
710
+ options.apply_defaults timeout: @config.timeout,
711
+ metadata: @config.metadata,
712
+ retry_policy: @config.retry_policy
713
+
714
+ @cloud_redis_stub.import_instance request, options do |result, operation|
715
+ result = ::Gapic::Operation.new result, @operations_client, options: options
716
+ yield result, operation if block_given?
717
+ return result
718
+ end
719
+ rescue ::Gapic::Rest::Error => e
720
+ raise ::Google::Cloud::Error.from_error(e)
721
+ end
722
+
723
+ ##
724
+ # Export Redis instance data into a Redis RDB format file in Cloud Storage.
725
+ #
726
+ # Redis will continue serving during this operation.
727
+ #
728
+ # The returned operation is automatically deleted after a few hours, so
729
+ # there is no need to call DeleteOperation.
730
+ #
731
+ # @overload export_instance(request, options = nil)
732
+ # Pass arguments to `export_instance` via a request object, either of type
733
+ # {::Google::Cloud::Redis::V1::ExportInstanceRequest} or an equivalent Hash.
734
+ #
735
+ # @param request [::Google::Cloud::Redis::V1::ExportInstanceRequest, ::Hash]
736
+ # A request object representing the call parameters. Required. To specify no
737
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
738
+ # @param options [::Gapic::CallOptions, ::Hash]
739
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
740
+ #
741
+ # @overload export_instance(name: nil, output_config: nil)
742
+ # Pass arguments to `export_instance` via keyword arguments. Note that at
743
+ # least one keyword argument is required. To specify no parameters, or to keep all
744
+ # the default parameter values, pass an empty Hash as a request object (see above).
745
+ #
746
+ # @param name [::String]
747
+ # Required. Redis instance resource name using the form:
748
+ # `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
749
+ # where `location_id` refers to a GCP region.
750
+ # @param output_config [::Google::Cloud::Redis::V1::OutputConfig, ::Hash]
751
+ # Required. Specify data to be exported.
752
+ # @yield [result, operation] Access the result along with the TransportOperation object
753
+ # @yieldparam result [::Gapic::Operation]
754
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
755
+ #
756
+ # @return [::Gapic::Operation]
757
+ #
758
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
759
+ def export_instance request, options = nil
760
+ raise ::ArgumentError, "request must be provided" if request.nil?
761
+
762
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::ExportInstanceRequest
763
+
764
+ # Converts hash and nil to an options object
765
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
766
+
767
+ # Customize the options with defaults
768
+ call_metadata = @config.rpcs.export_instance.metadata.to_h
769
+
770
+ # Set x-goog-api-client and x-goog-user-project headers
771
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
772
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
773
+ gapic_version: ::Google::Cloud::Redis::V1::VERSION,
774
+ transports_version_send: [:rest]
775
+
776
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
777
+
778
+ options.apply_defaults timeout: @config.rpcs.export_instance.timeout,
779
+ metadata: call_metadata,
780
+ retry_policy: @config.rpcs.export_instance.retry_policy
781
+
782
+ options.apply_defaults timeout: @config.timeout,
783
+ metadata: @config.metadata,
784
+ retry_policy: @config.retry_policy
785
+
786
+ @cloud_redis_stub.export_instance request, options do |result, operation|
787
+ result = ::Gapic::Operation.new result, @operations_client, options: options
788
+ yield result, operation if block_given?
789
+ return result
790
+ end
791
+ rescue ::Gapic::Rest::Error => e
792
+ raise ::Google::Cloud::Error.from_error(e)
793
+ end
794
+
795
+ ##
796
+ # Initiates a failover of the primary node to current replica node for a
797
+ # specific STANDARD tier Cloud Memorystore for Redis instance.
798
+ #
799
+ # @overload failover_instance(request, options = nil)
800
+ # Pass arguments to `failover_instance` via a request object, either of type
801
+ # {::Google::Cloud::Redis::V1::FailoverInstanceRequest} or an equivalent Hash.
802
+ #
803
+ # @param request [::Google::Cloud::Redis::V1::FailoverInstanceRequest, ::Hash]
804
+ # A request object representing the call parameters. Required. To specify no
805
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
806
+ # @param options [::Gapic::CallOptions, ::Hash]
807
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
808
+ #
809
+ # @overload failover_instance(name: nil, data_protection_mode: nil)
810
+ # Pass arguments to `failover_instance` via keyword arguments. Note that at
811
+ # least one keyword argument is required. To specify no parameters, or to keep all
812
+ # the default parameter values, pass an empty Hash as a request object (see above).
813
+ #
814
+ # @param name [::String]
815
+ # Required. Redis instance resource name using the form:
816
+ # `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
817
+ # where `location_id` refers to a GCP region.
818
+ # @param data_protection_mode [::Google::Cloud::Redis::V1::FailoverInstanceRequest::DataProtectionMode]
819
+ # Optional. Available data protection modes that the user can choose. If it's
820
+ # unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
821
+ # @yield [result, operation] Access the result along with the TransportOperation object
822
+ # @yieldparam result [::Gapic::Operation]
823
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
824
+ #
825
+ # @return [::Gapic::Operation]
826
+ #
827
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
828
+ def failover_instance request, options = nil
829
+ raise ::ArgumentError, "request must be provided" if request.nil?
830
+
831
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::FailoverInstanceRequest
832
+
833
+ # Converts hash and nil to an options object
834
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
835
+
836
+ # Customize the options with defaults
837
+ call_metadata = @config.rpcs.failover_instance.metadata.to_h
838
+
839
+ # Set x-goog-api-client and x-goog-user-project headers
840
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
841
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
842
+ gapic_version: ::Google::Cloud::Redis::V1::VERSION,
843
+ transports_version_send: [:rest]
844
+
845
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
846
+
847
+ options.apply_defaults timeout: @config.rpcs.failover_instance.timeout,
848
+ metadata: call_metadata,
849
+ retry_policy: @config.rpcs.failover_instance.retry_policy
850
+
851
+ options.apply_defaults timeout: @config.timeout,
852
+ metadata: @config.metadata,
853
+ retry_policy: @config.retry_policy
854
+
855
+ @cloud_redis_stub.failover_instance request, options do |result, operation|
856
+ result = ::Gapic::Operation.new result, @operations_client, options: options
857
+ yield result, operation if block_given?
858
+ return result
859
+ end
860
+ rescue ::Gapic::Rest::Error => e
861
+ raise ::Google::Cloud::Error.from_error(e)
862
+ end
863
+
864
+ ##
865
+ # Deletes a specific Redis instance. Instance stops serving and data is
866
+ # deleted.
867
+ #
868
+ # @overload delete_instance(request, options = nil)
869
+ # Pass arguments to `delete_instance` via a request object, either of type
870
+ # {::Google::Cloud::Redis::V1::DeleteInstanceRequest} or an equivalent Hash.
871
+ #
872
+ # @param request [::Google::Cloud::Redis::V1::DeleteInstanceRequest, ::Hash]
873
+ # A request object representing the call parameters. Required. To specify no
874
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
875
+ # @param options [::Gapic::CallOptions, ::Hash]
876
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
877
+ #
878
+ # @overload delete_instance(name: nil)
879
+ # Pass arguments to `delete_instance` via keyword arguments. Note that at
880
+ # least one keyword argument is required. To specify no parameters, or to keep all
881
+ # the default parameter values, pass an empty Hash as a request object (see above).
882
+ #
883
+ # @param name [::String]
884
+ # Required. Redis instance resource name using the form:
885
+ # `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
886
+ # where `location_id` refers to a GCP region.
887
+ # @yield [result, operation] Access the result along with the TransportOperation object
888
+ # @yieldparam result [::Gapic::Operation]
889
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
890
+ #
891
+ # @return [::Gapic::Operation]
892
+ #
893
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
894
+ def delete_instance request, options = nil
895
+ raise ::ArgumentError, "request must be provided" if request.nil?
896
+
897
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::DeleteInstanceRequest
898
+
899
+ # Converts hash and nil to an options object
900
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
901
+
902
+ # Customize the options with defaults
903
+ call_metadata = @config.rpcs.delete_instance.metadata.to_h
904
+
905
+ # Set x-goog-api-client and x-goog-user-project headers
906
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
907
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
908
+ gapic_version: ::Google::Cloud::Redis::V1::VERSION,
909
+ transports_version_send: [:rest]
910
+
911
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
912
+
913
+ options.apply_defaults timeout: @config.rpcs.delete_instance.timeout,
914
+ metadata: call_metadata,
915
+ retry_policy: @config.rpcs.delete_instance.retry_policy
916
+
917
+ options.apply_defaults timeout: @config.timeout,
918
+ metadata: @config.metadata,
919
+ retry_policy: @config.retry_policy
920
+
921
+ @cloud_redis_stub.delete_instance request, options do |result, operation|
922
+ result = ::Gapic::Operation.new result, @operations_client, options: options
923
+ yield result, operation if block_given?
924
+ return result
925
+ end
926
+ rescue ::Gapic::Rest::Error => e
927
+ raise ::Google::Cloud::Error.from_error(e)
928
+ end
929
+
930
+ ##
931
+ # Reschedule maintenance for a given instance in a given project and
932
+ # location.
933
+ #
934
+ # @overload reschedule_maintenance(request, options = nil)
935
+ # Pass arguments to `reschedule_maintenance` via a request object, either of type
936
+ # {::Google::Cloud::Redis::V1::RescheduleMaintenanceRequest} or an equivalent Hash.
937
+ #
938
+ # @param request [::Google::Cloud::Redis::V1::RescheduleMaintenanceRequest, ::Hash]
939
+ # A request object representing the call parameters. Required. To specify no
940
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
941
+ # @param options [::Gapic::CallOptions, ::Hash]
942
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
943
+ #
944
+ # @overload reschedule_maintenance(name: nil, reschedule_type: nil, schedule_time: nil)
945
+ # Pass arguments to `reschedule_maintenance` via keyword arguments. Note that at
946
+ # least one keyword argument is required. To specify no parameters, or to keep all
947
+ # the default parameter values, pass an empty Hash as a request object (see above).
948
+ #
949
+ # @param name [::String]
950
+ # Required. Redis instance resource name using the form:
951
+ # `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
952
+ # where `location_id` refers to a GCP region.
953
+ # @param reschedule_type [::Google::Cloud::Redis::V1::RescheduleMaintenanceRequest::RescheduleType]
954
+ # Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as
955
+ # well.
956
+ # @param schedule_time [::Google::Protobuf::Timestamp, ::Hash]
957
+ # Optional. Timestamp when the maintenance shall be rescheduled to if
958
+ # reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
959
+ # example `2012-11-15T16:19:00.094Z`.
960
+ # @yield [result, operation] Access the result along with the TransportOperation object
961
+ # @yieldparam result [::Gapic::Operation]
962
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
963
+ #
964
+ # @return [::Gapic::Operation]
965
+ #
966
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
967
+ def reschedule_maintenance request, options = nil
968
+ raise ::ArgumentError, "request must be provided" if request.nil?
969
+
970
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::RescheduleMaintenanceRequest
971
+
972
+ # Converts hash and nil to an options object
973
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
974
+
975
+ # Customize the options with defaults
976
+ call_metadata = @config.rpcs.reschedule_maintenance.metadata.to_h
977
+
978
+ # Set x-goog-api-client and x-goog-user-project headers
979
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
980
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
981
+ gapic_version: ::Google::Cloud::Redis::V1::VERSION,
982
+ transports_version_send: [:rest]
983
+
984
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
985
+
986
+ options.apply_defaults timeout: @config.rpcs.reschedule_maintenance.timeout,
987
+ metadata: call_metadata,
988
+ retry_policy: @config.rpcs.reschedule_maintenance.retry_policy
989
+
990
+ options.apply_defaults timeout: @config.timeout,
991
+ metadata: @config.metadata,
992
+ retry_policy: @config.retry_policy
993
+
994
+ @cloud_redis_stub.reschedule_maintenance request, options do |result, operation|
995
+ result = ::Gapic::Operation.new result, @operations_client, options: options
996
+ yield result, operation if block_given?
997
+ return result
998
+ end
999
+ rescue ::Gapic::Rest::Error => e
1000
+ raise ::Google::Cloud::Error.from_error(e)
1001
+ end
1002
+
1003
+ ##
1004
+ # Configuration class for the CloudRedis REST API.
1005
+ #
1006
+ # This class represents the configuration for CloudRedis REST,
1007
+ # providing control over timeouts, retry behavior, logging, transport
1008
+ # parameters, and other low-level controls. Certain parameters can also be
1009
+ # applied individually to specific RPCs. See
1010
+ # {::Google::Cloud::Redis::V1::CloudRedis::Rest::Client::Configuration::Rpcs}
1011
+ # for a list of RPCs that can be configured independently.
1012
+ #
1013
+ # Configuration can be applied globally to all clients, or to a single client
1014
+ # on construction.
1015
+ #
1016
+ # @example
1017
+ #
1018
+ # # Modify the global config, setting the timeout for
1019
+ # # list_instances to 20 seconds,
1020
+ # # and all remaining timeouts to 10 seconds.
1021
+ # ::Google::Cloud::Redis::V1::CloudRedis::Rest::Client.configure do |config|
1022
+ # config.timeout = 10.0
1023
+ # config.rpcs.list_instances.timeout = 20.0
1024
+ # end
1025
+ #
1026
+ # # Apply the above configuration only to a new client.
1027
+ # client = ::Google::Cloud::Redis::V1::CloudRedis::Rest::Client.new do |config|
1028
+ # config.timeout = 10.0
1029
+ # config.rpcs.list_instances.timeout = 20.0
1030
+ # end
1031
+ #
1032
+ # @!attribute [rw] endpoint
1033
+ # The hostname or hostname:port of the service endpoint.
1034
+ # Defaults to `"redis.googleapis.com"`.
1035
+ # @return [::String]
1036
+ # @!attribute [rw] credentials
1037
+ # Credentials to send with calls. You may provide any of the following types:
1038
+ # * (`String`) The path to a service account key file in JSON format
1039
+ # * (`Hash`) A service account key as a Hash
1040
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1041
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1042
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1043
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1044
+ # * (`nil`) indicating no credentials
1045
+ # @return [::Object]
1046
+ # @!attribute [rw] scope
1047
+ # The OAuth scopes
1048
+ # @return [::Array<::String>]
1049
+ # @!attribute [rw] lib_name
1050
+ # The library name as recorded in instrumentation and logging
1051
+ # @return [::String]
1052
+ # @!attribute [rw] lib_version
1053
+ # The library version as recorded in instrumentation and logging
1054
+ # @return [::String]
1055
+ # @!attribute [rw] timeout
1056
+ # The call timeout in seconds.
1057
+ # @return [::Numeric]
1058
+ # @!attribute [rw] metadata
1059
+ # Additional headers to be sent with the call.
1060
+ # @return [::Hash{::Symbol=>::String}]
1061
+ # @!attribute [rw] retry_policy
1062
+ # The retry policy. The value is a hash with the following keys:
1063
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1064
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1065
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1066
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1067
+ # trigger a retry.
1068
+ # @return [::Hash]
1069
+ # @!attribute [rw] quota_project
1070
+ # A separate project against which to charge quota.
1071
+ # @return [::String]
1072
+ #
1073
+ class Configuration
1074
+ extend ::Gapic::Config
1075
+
1076
+ config_attr :endpoint, "redis.googleapis.com", ::String
1077
+ config_attr :credentials, nil do |value|
1078
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1079
+ allowed.any? { |klass| klass === value }
1080
+ end
1081
+ config_attr :scope, nil, ::String, ::Array, nil
1082
+ config_attr :lib_name, nil, ::String, nil
1083
+ config_attr :lib_version, nil, ::String, nil
1084
+ config_attr :timeout, nil, ::Numeric, nil
1085
+ config_attr :metadata, nil, ::Hash, nil
1086
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1087
+ config_attr :quota_project, nil, ::String, nil
1088
+
1089
+ # @private
1090
+ # Overrides for http bindings for the RPCs of this service
1091
+ # are only used when this service is used as mixin, and only
1092
+ # by the host service.
1093
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1094
+ config_attr :bindings_override, {}, ::Hash, nil
1095
+
1096
+ # @private
1097
+ def initialize parent_config = nil
1098
+ @parent_config = parent_config unless parent_config.nil?
1099
+
1100
+ yield self if block_given?
1101
+ end
1102
+
1103
+ ##
1104
+ # Configurations for individual RPCs
1105
+ # @return [Rpcs]
1106
+ #
1107
+ def rpcs
1108
+ @rpcs ||= begin
1109
+ parent_rpcs = nil
1110
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1111
+ Rpcs.new parent_rpcs
1112
+ end
1113
+ end
1114
+
1115
+ ##
1116
+ # Configuration RPC class for the CloudRedis API.
1117
+ #
1118
+ # Includes fields providing the configuration for each RPC in this service.
1119
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1120
+ # the following configuration fields:
1121
+ #
1122
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1123
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1124
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1125
+ # include the following keys:
1126
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1127
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1128
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1129
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1130
+ # trigger a retry.
1131
+ #
1132
+ class Rpcs
1133
+ ##
1134
+ # RPC-specific configuration for `list_instances`
1135
+ # @return [::Gapic::Config::Method]
1136
+ #
1137
+ attr_reader :list_instances
1138
+ ##
1139
+ # RPC-specific configuration for `get_instance`
1140
+ # @return [::Gapic::Config::Method]
1141
+ #
1142
+ attr_reader :get_instance
1143
+ ##
1144
+ # RPC-specific configuration for `get_instance_auth_string`
1145
+ # @return [::Gapic::Config::Method]
1146
+ #
1147
+ attr_reader :get_instance_auth_string
1148
+ ##
1149
+ # RPC-specific configuration for `create_instance`
1150
+ # @return [::Gapic::Config::Method]
1151
+ #
1152
+ attr_reader :create_instance
1153
+ ##
1154
+ # RPC-specific configuration for `update_instance`
1155
+ # @return [::Gapic::Config::Method]
1156
+ #
1157
+ attr_reader :update_instance
1158
+ ##
1159
+ # RPC-specific configuration for `upgrade_instance`
1160
+ # @return [::Gapic::Config::Method]
1161
+ #
1162
+ attr_reader :upgrade_instance
1163
+ ##
1164
+ # RPC-specific configuration for `import_instance`
1165
+ # @return [::Gapic::Config::Method]
1166
+ #
1167
+ attr_reader :import_instance
1168
+ ##
1169
+ # RPC-specific configuration for `export_instance`
1170
+ # @return [::Gapic::Config::Method]
1171
+ #
1172
+ attr_reader :export_instance
1173
+ ##
1174
+ # RPC-specific configuration for `failover_instance`
1175
+ # @return [::Gapic::Config::Method]
1176
+ #
1177
+ attr_reader :failover_instance
1178
+ ##
1179
+ # RPC-specific configuration for `delete_instance`
1180
+ # @return [::Gapic::Config::Method]
1181
+ #
1182
+ attr_reader :delete_instance
1183
+ ##
1184
+ # RPC-specific configuration for `reschedule_maintenance`
1185
+ # @return [::Gapic::Config::Method]
1186
+ #
1187
+ attr_reader :reschedule_maintenance
1188
+
1189
+ # @private
1190
+ def initialize parent_rpcs = nil
1191
+ list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
1192
+ @list_instances = ::Gapic::Config::Method.new list_instances_config
1193
+ get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
1194
+ @get_instance = ::Gapic::Config::Method.new get_instance_config
1195
+ get_instance_auth_string_config = parent_rpcs.get_instance_auth_string if parent_rpcs.respond_to? :get_instance_auth_string
1196
+ @get_instance_auth_string = ::Gapic::Config::Method.new get_instance_auth_string_config
1197
+ create_instance_config = parent_rpcs.create_instance if parent_rpcs.respond_to? :create_instance
1198
+ @create_instance = ::Gapic::Config::Method.new create_instance_config
1199
+ update_instance_config = parent_rpcs.update_instance if parent_rpcs.respond_to? :update_instance
1200
+ @update_instance = ::Gapic::Config::Method.new update_instance_config
1201
+ upgrade_instance_config = parent_rpcs.upgrade_instance if parent_rpcs.respond_to? :upgrade_instance
1202
+ @upgrade_instance = ::Gapic::Config::Method.new upgrade_instance_config
1203
+ import_instance_config = parent_rpcs.import_instance if parent_rpcs.respond_to? :import_instance
1204
+ @import_instance = ::Gapic::Config::Method.new import_instance_config
1205
+ export_instance_config = parent_rpcs.export_instance if parent_rpcs.respond_to? :export_instance
1206
+ @export_instance = ::Gapic::Config::Method.new export_instance_config
1207
+ failover_instance_config = parent_rpcs.failover_instance if parent_rpcs.respond_to? :failover_instance
1208
+ @failover_instance = ::Gapic::Config::Method.new failover_instance_config
1209
+ delete_instance_config = parent_rpcs.delete_instance if parent_rpcs.respond_to? :delete_instance
1210
+ @delete_instance = ::Gapic::Config::Method.new delete_instance_config
1211
+ reschedule_maintenance_config = parent_rpcs.reschedule_maintenance if parent_rpcs.respond_to? :reschedule_maintenance
1212
+ @reschedule_maintenance = ::Gapic::Config::Method.new reschedule_maintenance_config
1213
+
1214
+ yield self if block_given?
1215
+ end
1216
+ end
1217
+ end
1218
+ end
1219
+ end
1220
+ end
1221
+ end
1222
+ end
1223
+ end
1224
+ end