google-cloud-redis-v1beta1 0.8.0 → 0.9.0

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