google-cloud-redis-v1 0.1.0

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