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