google-cloud-redis-cluster-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.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +144 -0
  6. data/lib/google/cloud/redis/cluster/v1/bindings_override.rb +104 -0
  7. data/lib/google/cloud/redis/cluster/v1/cloud_redis_cluster/client.rb +918 -0
  8. data/lib/google/cloud/redis/cluster/v1/cloud_redis_cluster/credentials.rb +49 -0
  9. data/lib/google/cloud/redis/cluster/v1/cloud_redis_cluster/operations.rb +781 -0
  10. data/lib/google/cloud/redis/cluster/v1/cloud_redis_cluster/paths.rb +71 -0
  11. data/lib/google/cloud/redis/cluster/v1/cloud_redis_cluster/rest/client.rb +861 -0
  12. data/lib/google/cloud/redis/cluster/v1/cloud_redis_cluster/rest/operations.rb +871 -0
  13. data/lib/google/cloud/redis/cluster/v1/cloud_redis_cluster/rest/service_stub.rb +347 -0
  14. data/lib/google/cloud/redis/cluster/v1/cloud_redis_cluster/rest.rb +76 -0
  15. data/lib/google/cloud/redis/cluster/v1/cloud_redis_cluster.rb +78 -0
  16. data/lib/google/cloud/redis/cluster/v1/cloud_redis_cluster_pb.rb +71 -0
  17. data/lib/google/cloud/redis/cluster/v1/cloud_redis_cluster_services_pb.rb +95 -0
  18. data/lib/google/cloud/redis/cluster/v1/rest.rb +40 -0
  19. data/lib/google/cloud/redis/cluster/v1/version.rb +30 -0
  20. data/lib/google/cloud/redis/cluster/v1.rb +47 -0
  21. data/lib/google-cloud-redis-cluster-v1.rb +21 -0
  22. data/proto_docs/README.md +4 -0
  23. data/proto_docs/google/api/client.rb +381 -0
  24. data/proto_docs/google/api/field_behavior.rb +85 -0
  25. data/proto_docs/google/api/launch_stage.rb +71 -0
  26. data/proto_docs/google/api/resource.rb +222 -0
  27. data/proto_docs/google/cloud/redis/cluster/v1/cloud_redis_cluster.rb +353 -0
  28. data/proto_docs/google/longrunning/operations.rb +164 -0
  29. data/proto_docs/google/protobuf/any.rb +144 -0
  30. data/proto_docs/google/protobuf/duration.rb +98 -0
  31. data/proto_docs/google/protobuf/empty.rb +34 -0
  32. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  33. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  34. data/proto_docs/google/rpc/status.rb +48 -0
  35. metadata +244 -0
@@ -0,0 +1,861 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/redis/cluster/v1/cloud_redis_cluster_pb"
21
+ require "google/cloud/redis/cluster/v1/cloud_redis_cluster/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Redis
27
+ module Cluster
28
+ module V1
29
+ module CloudRedisCluster
30
+ module Rest
31
+ ##
32
+ # REST client for the CloudRedisCluster service.
33
+ #
34
+ # Configures and manages Cloud Memorystore for Redis clusters
35
+ #
36
+ # Google Cloud Memorystore for Redis Cluster
37
+ #
38
+ # The `redis.googleapis.com` service implements the Google Cloud Memorystore
39
+ # for Redis API and defines the following resource model for managing Redis
40
+ # clusters:
41
+ # * The service works with a collection of cloud projects, named: `/projects/*`
42
+ # * Each project has a collection of available locations, named: `/locations/*`
43
+ # * Each location has a collection of Redis clusters, named: `/clusters/*`
44
+ # * As such, Redis clusters are resources of the form:
45
+ # `/projects/{project_id}/locations/{location_id}/clusters/{instance_id}`
46
+ #
47
+ # Note that location_id must be a GCP `region`; for example:
48
+ # * `projects/redpepper-1290/locations/us-central1/clusters/my-redis`
49
+ #
50
+ # We use API version selector for Flex APIs
51
+ # * The versioning strategy is release-based versioning
52
+ # * Our backend CLH only deals with the superset version (called v1main)
53
+ # * Existing backend for Redis Gen1 and MRR is not touched.
54
+ # * More details in go/redis-flex-api-versioning
55
+ #
56
+ class Client
57
+ include Paths
58
+
59
+ # @private
60
+ attr_reader :cloud_redis_cluster_stub
61
+
62
+ ##
63
+ # Configure the CloudRedisCluster Client class.
64
+ #
65
+ # See {::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client::Configuration}
66
+ # for a description of the configuration fields.
67
+ #
68
+ # @example
69
+ #
70
+ # # Modify the configuration for all CloudRedisCluster clients
71
+ # ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.configure do |config|
72
+ # config.timeout = 10.0
73
+ # end
74
+ #
75
+ # @yield [config] Configure the Client client.
76
+ # @yieldparam config [Client::Configuration]
77
+ #
78
+ # @return [Client::Configuration]
79
+ #
80
+ def self.configure
81
+ @configure ||= begin
82
+ namespace = ["Google", "Cloud", "Redis", "Cluster", "V1"]
83
+ parent_config = while namespace.any?
84
+ parent_name = namespace.join "::"
85
+ parent_const = const_get parent_name
86
+ break parent_const.configure if parent_const.respond_to? :configure
87
+ namespace.pop
88
+ end
89
+ default_config = Client::Configuration.new parent_config
90
+
91
+ default_config.rpcs.list_clusters.timeout = 600.0
92
+
93
+ default_config.rpcs.get_cluster.timeout = 600.0
94
+
95
+ default_config.rpcs.update_cluster.timeout = 600.0
96
+
97
+ default_config.rpcs.delete_cluster.timeout = 600.0
98
+
99
+ default_config.rpcs.create_cluster.timeout = 600.0
100
+
101
+ default_config
102
+ end
103
+ yield @configure if block_given?
104
+ @configure
105
+ end
106
+
107
+ ##
108
+ # Configure the CloudRedisCluster Client instance.
109
+ #
110
+ # The configuration is set to the derived mode, meaning that values can be changed,
111
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
112
+ # should be made on {Client.configure}.
113
+ #
114
+ # See {::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client::Configuration}
115
+ # for a description of the configuration fields.
116
+ #
117
+ # @yield [config] Configure the Client client.
118
+ # @yieldparam config [Client::Configuration]
119
+ #
120
+ # @return [Client::Configuration]
121
+ #
122
+ def configure
123
+ yield @config if block_given?
124
+ @config
125
+ end
126
+
127
+ ##
128
+ # Create a new CloudRedisCluster REST client object.
129
+ #
130
+ # @example
131
+ #
132
+ # # Create a client using the default configuration
133
+ # client = ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
134
+ #
135
+ # # Create a client using a custom configuration
136
+ # client = ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new do |config|
137
+ # config.timeout = 10.0
138
+ # end
139
+ #
140
+ # @yield [config] Configure the CloudRedisCluster client.
141
+ # @yieldparam config [Client::Configuration]
142
+ #
143
+ def initialize
144
+ # Create the configuration object
145
+ @config = Configuration.new Client.configure
146
+
147
+ # Yield the configuration if needed
148
+ yield @config if block_given?
149
+
150
+ # Create credentials
151
+ credentials = @config.credentials
152
+ # Use self-signed JWT if the endpoint is unchanged from default,
153
+ # but only if the default endpoint does not have a region prefix.
154
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
155
+ !@config.endpoint.split(".").first.include?("-")
156
+ credentials ||= Credentials.default scope: @config.scope,
157
+ enable_self_signed_jwt: enable_self_signed_jwt
158
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
159
+ credentials = Credentials.new credentials, scope: @config.scope
160
+ end
161
+
162
+ @quota_project_id = @config.quota_project
163
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
164
+
165
+ @operations_client = ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Operations.new do |config|
166
+ config.credentials = credentials
167
+ config.quota_project = @quota_project_id
168
+ config.endpoint = @config.endpoint
169
+ end
170
+
171
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
172
+ config.credentials = credentials
173
+ config.quota_project = @quota_project_id
174
+ config.endpoint = @config.endpoint
175
+ config.bindings_override = @config.bindings_override
176
+ end
177
+
178
+ @cloud_redis_cluster_stub = ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
179
+ end
180
+
181
+ ##
182
+ # Get the associated client for long-running operations.
183
+ #
184
+ # @return [::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Operations]
185
+ #
186
+ attr_reader :operations_client
187
+
188
+ ##
189
+ # Get the associated client for mix-in of the Locations.
190
+ #
191
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
192
+ #
193
+ attr_reader :location_client
194
+
195
+ # Service calls
196
+
197
+ ##
198
+ # Lists all Redis clusters owned by a project in either the specified
199
+ # location (region) or all locations.
200
+ #
201
+ # The location should have the following format:
202
+ #
203
+ # * `projects/{project_id}/locations/{location_id}`
204
+ #
205
+ # If `location_id` is specified as `-` (wildcard), then all regions
206
+ # available to the project are queried, and the results are aggregated.
207
+ #
208
+ # @overload list_clusters(request, options = nil)
209
+ # Pass arguments to `list_clusters` via a request object, either of type
210
+ # {::Google::Cloud::Redis::Cluster::V1::ListClustersRequest} or an equivalent Hash.
211
+ #
212
+ # @param request [::Google::Cloud::Redis::Cluster::V1::ListClustersRequest, ::Hash]
213
+ # A request object representing the call parameters. Required. To specify no
214
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
215
+ # @param options [::Gapic::CallOptions, ::Hash]
216
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
217
+ #
218
+ # @overload list_clusters(parent: nil, page_size: nil, page_token: nil)
219
+ # Pass arguments to `list_clusters` via keyword arguments. Note that at
220
+ # least one keyword argument is required. To specify no parameters, or to keep all
221
+ # the default parameter values, pass an empty Hash as a request object (see above).
222
+ #
223
+ # @param parent [::String]
224
+ # Required. The resource name of the cluster location using the form:
225
+ # `projects/{project_id}/locations/{location_id}`
226
+ # where `location_id` refers to a GCP region.
227
+ # @param page_size [::Integer]
228
+ # The maximum number of items to return.
229
+ #
230
+ # If not specified, a default value of 1000 will be used by the service.
231
+ # Regardless of the page_size value, the response may include a partial list
232
+ # and a caller should only rely on response's
233
+ # {::Google::Cloud::Redis::Cluster::V1::ListClustersResponse#next_page_token `next_page_token`}
234
+ # to determine if there are more clusters left to be queried.
235
+ # @param page_token [::String]
236
+ # The `next_page_token` value returned from a previous
237
+ # [ListClusters][CloudRedis.ListClusters] request, if any.
238
+ # @yield [result, operation] Access the result along with the TransportOperation object
239
+ # @yieldparam result [::Google::Cloud::Redis::Cluster::V1::ListClustersResponse]
240
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
241
+ #
242
+ # @return [::Google::Cloud::Redis::Cluster::V1::ListClustersResponse]
243
+ #
244
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
245
+ #
246
+ # @example Basic example
247
+ # require "google/cloud/redis/cluster/v1"
248
+ #
249
+ # # Create a client object. The client can be reused for multiple calls.
250
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
251
+ #
252
+ # # Create a request. To set request fields, pass in keyword arguments.
253
+ # request = Google::Cloud::Redis::Cluster::V1::ListClustersRequest.new
254
+ #
255
+ # # Call the list_clusters method.
256
+ # result = client.list_clusters request
257
+ #
258
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
259
+ # # over elements, and API calls will be issued to fetch pages as needed.
260
+ # result.each do |item|
261
+ # # Each element is of type ::Google::Cloud::Redis::Cluster::V1::Cluster.
262
+ # p item
263
+ # end
264
+ #
265
+ def list_clusters request, options = nil
266
+ raise ::ArgumentError, "request must be provided" if request.nil?
267
+
268
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::ListClustersRequest
269
+
270
+ # Converts hash and nil to an options object
271
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
272
+
273
+ # Customize the options with defaults
274
+ call_metadata = @config.rpcs.list_clusters.metadata.to_h
275
+
276
+ # Set x-goog-api-client and x-goog-user-project headers
277
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
278
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
279
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION,
280
+ transports_version_send: [:rest]
281
+
282
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
283
+
284
+ options.apply_defaults timeout: @config.rpcs.list_clusters.timeout,
285
+ metadata: call_metadata,
286
+ retry_policy: @config.rpcs.list_clusters.retry_policy
287
+
288
+ options.apply_defaults timeout: @config.timeout,
289
+ metadata: @config.metadata,
290
+ retry_policy: @config.retry_policy
291
+
292
+ @cloud_redis_cluster_stub.list_clusters request, options do |result, operation|
293
+ yield result, operation if block_given?
294
+ return result
295
+ end
296
+ rescue ::Gapic::Rest::Error => e
297
+ raise ::Google::Cloud::Error.from_error(e)
298
+ end
299
+
300
+ ##
301
+ # Gets the details of a specific Redis cluster.
302
+ #
303
+ # @overload get_cluster(request, options = nil)
304
+ # Pass arguments to `get_cluster` via a request object, either of type
305
+ # {::Google::Cloud::Redis::Cluster::V1::GetClusterRequest} or an equivalent Hash.
306
+ #
307
+ # @param request [::Google::Cloud::Redis::Cluster::V1::GetClusterRequest, ::Hash]
308
+ # A request object representing the call parameters. Required. To specify no
309
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
310
+ # @param options [::Gapic::CallOptions, ::Hash]
311
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
312
+ #
313
+ # @overload get_cluster(name: nil)
314
+ # Pass arguments to `get_cluster` via keyword arguments. Note that at
315
+ # least one keyword argument is required. To specify no parameters, or to keep all
316
+ # the default parameter values, pass an empty Hash as a request object (see above).
317
+ #
318
+ # @param name [::String]
319
+ # Required. Redis cluster resource name using the form:
320
+ # `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
321
+ # where `location_id` refers to a GCP region.
322
+ # @yield [result, operation] Access the result along with the TransportOperation object
323
+ # @yieldparam result [::Google::Cloud::Redis::Cluster::V1::Cluster]
324
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
325
+ #
326
+ # @return [::Google::Cloud::Redis::Cluster::V1::Cluster]
327
+ #
328
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
329
+ #
330
+ # @example Basic example
331
+ # require "google/cloud/redis/cluster/v1"
332
+ #
333
+ # # Create a client object. The client can be reused for multiple calls.
334
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
335
+ #
336
+ # # Create a request. To set request fields, pass in keyword arguments.
337
+ # request = Google::Cloud::Redis::Cluster::V1::GetClusterRequest.new
338
+ #
339
+ # # Call the get_cluster method.
340
+ # result = client.get_cluster request
341
+ #
342
+ # # The returned object is of type Google::Cloud::Redis::Cluster::V1::Cluster.
343
+ # p result
344
+ #
345
+ def get_cluster request, options = nil
346
+ raise ::ArgumentError, "request must be provided" if request.nil?
347
+
348
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::GetClusterRequest
349
+
350
+ # Converts hash and nil to an options object
351
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
352
+
353
+ # Customize the options with defaults
354
+ call_metadata = @config.rpcs.get_cluster.metadata.to_h
355
+
356
+ # Set x-goog-api-client and x-goog-user-project headers
357
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
358
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
359
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION,
360
+ transports_version_send: [:rest]
361
+
362
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
363
+
364
+ options.apply_defaults timeout: @config.rpcs.get_cluster.timeout,
365
+ metadata: call_metadata,
366
+ retry_policy: @config.rpcs.get_cluster.retry_policy
367
+
368
+ options.apply_defaults timeout: @config.timeout,
369
+ metadata: @config.metadata,
370
+ retry_policy: @config.retry_policy
371
+
372
+ @cloud_redis_cluster_stub.get_cluster request, options do |result, operation|
373
+ yield result, operation if block_given?
374
+ return result
375
+ end
376
+ rescue ::Gapic::Rest::Error => e
377
+ raise ::Google::Cloud::Error.from_error(e)
378
+ end
379
+
380
+ ##
381
+ # Updates the metadata and configuration of a specific Redis cluster.
382
+ #
383
+ # Completed longrunning.Operation will contain the new cluster object
384
+ # in the response field. The returned operation is automatically deleted
385
+ # after a few hours, so there is no need to call DeleteOperation.
386
+ #
387
+ # @overload update_cluster(request, options = nil)
388
+ # Pass arguments to `update_cluster` via a request object, either of type
389
+ # {::Google::Cloud::Redis::Cluster::V1::UpdateClusterRequest} or an equivalent Hash.
390
+ #
391
+ # @param request [::Google::Cloud::Redis::Cluster::V1::UpdateClusterRequest, ::Hash]
392
+ # A request object representing the call parameters. Required. To specify no
393
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
394
+ # @param options [::Gapic::CallOptions, ::Hash]
395
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
396
+ #
397
+ # @overload update_cluster(update_mask: nil, cluster: nil, request_id: nil)
398
+ # Pass arguments to `update_cluster` via keyword arguments. Note that at
399
+ # least one keyword argument is required. To specify no parameters, or to keep all
400
+ # the default parameter values, pass an empty Hash as a request object (see above).
401
+ #
402
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
403
+ # Required. Mask of fields to update. At least one path must be supplied in
404
+ # this field. The elements of the repeated paths field may only include these
405
+ # fields from {::Google::Cloud::Redis::Cluster::V1::Cluster Cluster}:
406
+ #
407
+ # * `size_gb`
408
+ # * `replica_count`
409
+ # @param cluster [::Google::Cloud::Redis::Cluster::V1::Cluster, ::Hash]
410
+ # Required. Update description.
411
+ # Only fields specified in update_mask are updated.
412
+ # @param request_id [::String]
413
+ # Idempotent request UUID.
414
+ # @yield [result, operation] Access the result along with the TransportOperation object
415
+ # @yieldparam result [::Gapic::Operation]
416
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
417
+ #
418
+ # @return [::Gapic::Operation]
419
+ #
420
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
421
+ #
422
+ # @example Basic example
423
+ # require "google/cloud/redis/cluster/v1"
424
+ #
425
+ # # Create a client object. The client can be reused for multiple calls.
426
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
427
+ #
428
+ # # Create a request. To set request fields, pass in keyword arguments.
429
+ # request = Google::Cloud::Redis::Cluster::V1::UpdateClusterRequest.new
430
+ #
431
+ # # Call the update_cluster method.
432
+ # result = client.update_cluster request
433
+ #
434
+ # # The returned object is of type Gapic::Operation. You can use it to
435
+ # # check the status of an operation, cancel it, or wait for results.
436
+ # # Here is how to wait for a response.
437
+ # result.wait_until_done! timeout: 60
438
+ # if result.response?
439
+ # p result.response
440
+ # else
441
+ # puts "No response received."
442
+ # end
443
+ #
444
+ def update_cluster request, options = nil
445
+ raise ::ArgumentError, "request must be provided" if request.nil?
446
+
447
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::UpdateClusterRequest
448
+
449
+ # Converts hash and nil to an options object
450
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
451
+
452
+ # Customize the options with defaults
453
+ call_metadata = @config.rpcs.update_cluster.metadata.to_h
454
+
455
+ # Set x-goog-api-client and x-goog-user-project headers
456
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
457
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
458
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION,
459
+ transports_version_send: [:rest]
460
+
461
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
462
+
463
+ options.apply_defaults timeout: @config.rpcs.update_cluster.timeout,
464
+ metadata: call_metadata,
465
+ retry_policy: @config.rpcs.update_cluster.retry_policy
466
+
467
+ options.apply_defaults timeout: @config.timeout,
468
+ metadata: @config.metadata,
469
+ retry_policy: @config.retry_policy
470
+
471
+ @cloud_redis_cluster_stub.update_cluster request, options do |result, operation|
472
+ result = ::Gapic::Operation.new result, @operations_client, options: options
473
+ yield result, operation if block_given?
474
+ return result
475
+ end
476
+ rescue ::Gapic::Rest::Error => e
477
+ raise ::Google::Cloud::Error.from_error(e)
478
+ end
479
+
480
+ ##
481
+ # Deletes a specific Redis cluster. Cluster stops serving and data is
482
+ # deleted.
483
+ #
484
+ # @overload delete_cluster(request, options = nil)
485
+ # Pass arguments to `delete_cluster` via a request object, either of type
486
+ # {::Google::Cloud::Redis::Cluster::V1::DeleteClusterRequest} or an equivalent Hash.
487
+ #
488
+ # @param request [::Google::Cloud::Redis::Cluster::V1::DeleteClusterRequest, ::Hash]
489
+ # A request object representing the call parameters. Required. To specify no
490
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
491
+ # @param options [::Gapic::CallOptions, ::Hash]
492
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
493
+ #
494
+ # @overload delete_cluster(name: nil, request_id: nil)
495
+ # Pass arguments to `delete_cluster` via keyword arguments. Note that at
496
+ # least one keyword argument is required. To specify no parameters, or to keep all
497
+ # the default parameter values, pass an empty Hash as a request object (see above).
498
+ #
499
+ # @param name [::String]
500
+ # Required. Redis cluster resource name using the form:
501
+ # `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
502
+ # where `location_id` refers to a GCP region.
503
+ # @param request_id [::String]
504
+ # Idempotent request UUID.
505
+ # @yield [result, operation] Access the result along with the TransportOperation object
506
+ # @yieldparam result [::Gapic::Operation]
507
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
508
+ #
509
+ # @return [::Gapic::Operation]
510
+ #
511
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
512
+ #
513
+ # @example Basic example
514
+ # require "google/cloud/redis/cluster/v1"
515
+ #
516
+ # # Create a client object. The client can be reused for multiple calls.
517
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
518
+ #
519
+ # # Create a request. To set request fields, pass in keyword arguments.
520
+ # request = Google::Cloud::Redis::Cluster::V1::DeleteClusterRequest.new
521
+ #
522
+ # # Call the delete_cluster method.
523
+ # result = client.delete_cluster request
524
+ #
525
+ # # The returned object is of type Gapic::Operation. You can use it to
526
+ # # check the status of an operation, cancel it, or wait for results.
527
+ # # Here is how to wait for a response.
528
+ # result.wait_until_done! timeout: 60
529
+ # if result.response?
530
+ # p result.response
531
+ # else
532
+ # puts "No response received."
533
+ # end
534
+ #
535
+ def delete_cluster request, options = nil
536
+ raise ::ArgumentError, "request must be provided" if request.nil?
537
+
538
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::DeleteClusterRequest
539
+
540
+ # Converts hash and nil to an options object
541
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
542
+
543
+ # Customize the options with defaults
544
+ call_metadata = @config.rpcs.delete_cluster.metadata.to_h
545
+
546
+ # Set x-goog-api-client and x-goog-user-project headers
547
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
548
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
549
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION,
550
+ transports_version_send: [:rest]
551
+
552
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
553
+
554
+ options.apply_defaults timeout: @config.rpcs.delete_cluster.timeout,
555
+ metadata: call_metadata,
556
+ retry_policy: @config.rpcs.delete_cluster.retry_policy
557
+
558
+ options.apply_defaults timeout: @config.timeout,
559
+ metadata: @config.metadata,
560
+ retry_policy: @config.retry_policy
561
+
562
+ @cloud_redis_cluster_stub.delete_cluster request, options do |result, operation|
563
+ result = ::Gapic::Operation.new result, @operations_client, options: options
564
+ yield result, operation if block_given?
565
+ return result
566
+ end
567
+ rescue ::Gapic::Rest::Error => e
568
+ raise ::Google::Cloud::Error.from_error(e)
569
+ end
570
+
571
+ ##
572
+ # Creates a Redis cluster based on the specified properties.
573
+ # The creation is executed asynchronously and callers may check the returned
574
+ # operation to track its progress. Once the operation is completed the Redis
575
+ # cluster will be fully functional. The completed longrunning.Operation will
576
+ # contain the new cluster object in the response field.
577
+ #
578
+ # The returned operation is automatically deleted after a few hours, so there
579
+ # is no need to call DeleteOperation.
580
+ #
581
+ # @overload create_cluster(request, options = nil)
582
+ # Pass arguments to `create_cluster` via a request object, either of type
583
+ # {::Google::Cloud::Redis::Cluster::V1::CreateClusterRequest} or an equivalent Hash.
584
+ #
585
+ # @param request [::Google::Cloud::Redis::Cluster::V1::CreateClusterRequest, ::Hash]
586
+ # A request object representing the call parameters. Required. To specify no
587
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
588
+ # @param options [::Gapic::CallOptions, ::Hash]
589
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
590
+ #
591
+ # @overload create_cluster(parent: nil, cluster_id: nil, cluster: nil, request_id: nil)
592
+ # Pass arguments to `create_cluster` via keyword arguments. Note that at
593
+ # least one keyword argument is required. To specify no parameters, or to keep all
594
+ # the default parameter values, pass an empty Hash as a request object (see above).
595
+ #
596
+ # @param parent [::String]
597
+ # Required. The resource name of the cluster location using the form:
598
+ # `projects/{project_id}/locations/{location_id}`
599
+ # where `location_id` refers to a GCP region.
600
+ # @param cluster_id [::String]
601
+ # Required. The logical name of the Redis cluster in the customer project
602
+ # with the following restrictions:
603
+ #
604
+ # * Must contain only lowercase letters, numbers, and hyphens.
605
+ # * Must start with a letter.
606
+ # * Must be between 1-63 characters.
607
+ # * Must end with a number or a letter.
608
+ # * Must be unique within the customer project / location
609
+ # @param cluster [::Google::Cloud::Redis::Cluster::V1::Cluster, ::Hash]
610
+ # Required. The cluster that is to be created.
611
+ # @param request_id [::String]
612
+ # Idempotent request UUID.
613
+ # @yield [result, operation] Access the result along with the TransportOperation object
614
+ # @yieldparam result [::Gapic::Operation]
615
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
616
+ #
617
+ # @return [::Gapic::Operation]
618
+ #
619
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
620
+ #
621
+ # @example Basic example
622
+ # require "google/cloud/redis/cluster/v1"
623
+ #
624
+ # # Create a client object. The client can be reused for multiple calls.
625
+ # client = Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new
626
+ #
627
+ # # Create a request. To set request fields, pass in keyword arguments.
628
+ # request = Google::Cloud::Redis::Cluster::V1::CreateClusterRequest.new
629
+ #
630
+ # # Call the create_cluster method.
631
+ # result = client.create_cluster request
632
+ #
633
+ # # The returned object is of type Gapic::Operation. You can use it to
634
+ # # check the status of an operation, cancel it, or wait for results.
635
+ # # Here is how to wait for a response.
636
+ # result.wait_until_done! timeout: 60
637
+ # if result.response?
638
+ # p result.response
639
+ # else
640
+ # puts "No response received."
641
+ # end
642
+ #
643
+ def create_cluster request, options = nil
644
+ raise ::ArgumentError, "request must be provided" if request.nil?
645
+
646
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1::CreateClusterRequest
647
+
648
+ # Converts hash and nil to an options object
649
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
650
+
651
+ # Customize the options with defaults
652
+ call_metadata = @config.rpcs.create_cluster.metadata.to_h
653
+
654
+ # Set x-goog-api-client and x-goog-user-project headers
655
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
656
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
657
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1::VERSION,
658
+ transports_version_send: [:rest]
659
+
660
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
661
+
662
+ options.apply_defaults timeout: @config.rpcs.create_cluster.timeout,
663
+ metadata: call_metadata,
664
+ retry_policy: @config.rpcs.create_cluster.retry_policy
665
+
666
+ options.apply_defaults timeout: @config.timeout,
667
+ metadata: @config.metadata,
668
+ retry_policy: @config.retry_policy
669
+
670
+ @cloud_redis_cluster_stub.create_cluster request, options do |result, operation|
671
+ result = ::Gapic::Operation.new result, @operations_client, options: options
672
+ yield result, operation if block_given?
673
+ return result
674
+ end
675
+ rescue ::Gapic::Rest::Error => e
676
+ raise ::Google::Cloud::Error.from_error(e)
677
+ end
678
+
679
+ ##
680
+ # Configuration class for the CloudRedisCluster REST API.
681
+ #
682
+ # This class represents the configuration for CloudRedisCluster REST,
683
+ # providing control over timeouts, retry behavior, logging, transport
684
+ # parameters, and other low-level controls. Certain parameters can also be
685
+ # applied individually to specific RPCs. See
686
+ # {::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client::Configuration::Rpcs}
687
+ # for a list of RPCs that can be configured independently.
688
+ #
689
+ # Configuration can be applied globally to all clients, or to a single client
690
+ # on construction.
691
+ #
692
+ # @example
693
+ #
694
+ # # Modify the global config, setting the timeout for
695
+ # # list_clusters to 20 seconds,
696
+ # # and all remaining timeouts to 10 seconds.
697
+ # ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.configure do |config|
698
+ # config.timeout = 10.0
699
+ # config.rpcs.list_clusters.timeout = 20.0
700
+ # end
701
+ #
702
+ # # Apply the above configuration only to a new client.
703
+ # client = ::Google::Cloud::Redis::Cluster::V1::CloudRedisCluster::Rest::Client.new do |config|
704
+ # config.timeout = 10.0
705
+ # config.rpcs.list_clusters.timeout = 20.0
706
+ # end
707
+ #
708
+ # @!attribute [rw] endpoint
709
+ # The hostname or hostname:port of the service endpoint.
710
+ # Defaults to `"redis.googleapis.com"`.
711
+ # @return [::String]
712
+ # @!attribute [rw] credentials
713
+ # Credentials to send with calls. You may provide any of the following types:
714
+ # * (`String`) The path to a service account key file in JSON format
715
+ # * (`Hash`) A service account key as a Hash
716
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
717
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
718
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
719
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
720
+ # * (`nil`) indicating no credentials
721
+ # @return [::Object]
722
+ # @!attribute [rw] scope
723
+ # The OAuth scopes
724
+ # @return [::Array<::String>]
725
+ # @!attribute [rw] lib_name
726
+ # The library name as recorded in instrumentation and logging
727
+ # @return [::String]
728
+ # @!attribute [rw] lib_version
729
+ # The library version as recorded in instrumentation and logging
730
+ # @return [::String]
731
+ # @!attribute [rw] timeout
732
+ # The call timeout in seconds.
733
+ # @return [::Numeric]
734
+ # @!attribute [rw] metadata
735
+ # Additional headers to be sent with the call.
736
+ # @return [::Hash{::Symbol=>::String}]
737
+ # @!attribute [rw] retry_policy
738
+ # The retry policy. The value is a hash with the following keys:
739
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
740
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
741
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
742
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
743
+ # trigger a retry.
744
+ # @return [::Hash]
745
+ # @!attribute [rw] quota_project
746
+ # A separate project against which to charge quota.
747
+ # @return [::String]
748
+ #
749
+ class Configuration
750
+ extend ::Gapic::Config
751
+
752
+ DEFAULT_ENDPOINT = "redis.googleapis.com"
753
+
754
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
755
+ config_attr :credentials, nil do |value|
756
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
757
+ allowed.any? { |klass| klass === value }
758
+ end
759
+ config_attr :scope, nil, ::String, ::Array, nil
760
+ config_attr :lib_name, nil, ::String, nil
761
+ config_attr :lib_version, nil, ::String, nil
762
+ config_attr :timeout, nil, ::Numeric, nil
763
+ config_attr :metadata, nil, ::Hash, nil
764
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
765
+ config_attr :quota_project, nil, ::String, nil
766
+
767
+ # @private
768
+ # Overrides for http bindings for the RPCs of this service
769
+ # are only used when this service is used as mixin, and only
770
+ # by the host service.
771
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
772
+ config_attr :bindings_override, {}, ::Hash, nil
773
+
774
+ # @private
775
+ def initialize parent_config = nil
776
+ @parent_config = parent_config unless parent_config.nil?
777
+
778
+ yield self if block_given?
779
+ end
780
+
781
+ ##
782
+ # Configurations for individual RPCs
783
+ # @return [Rpcs]
784
+ #
785
+ def rpcs
786
+ @rpcs ||= begin
787
+ parent_rpcs = nil
788
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
789
+ Rpcs.new parent_rpcs
790
+ end
791
+ end
792
+
793
+ ##
794
+ # Configuration RPC class for the CloudRedisCluster API.
795
+ #
796
+ # Includes fields providing the configuration for each RPC in this service.
797
+ # Each configuration object is of type `Gapic::Config::Method` and includes
798
+ # the following configuration fields:
799
+ #
800
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
801
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
802
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
803
+ # include the following keys:
804
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
805
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
806
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
807
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
808
+ # trigger a retry.
809
+ #
810
+ class Rpcs
811
+ ##
812
+ # RPC-specific configuration for `list_clusters`
813
+ # @return [::Gapic::Config::Method]
814
+ #
815
+ attr_reader :list_clusters
816
+ ##
817
+ # RPC-specific configuration for `get_cluster`
818
+ # @return [::Gapic::Config::Method]
819
+ #
820
+ attr_reader :get_cluster
821
+ ##
822
+ # RPC-specific configuration for `update_cluster`
823
+ # @return [::Gapic::Config::Method]
824
+ #
825
+ attr_reader :update_cluster
826
+ ##
827
+ # RPC-specific configuration for `delete_cluster`
828
+ # @return [::Gapic::Config::Method]
829
+ #
830
+ attr_reader :delete_cluster
831
+ ##
832
+ # RPC-specific configuration for `create_cluster`
833
+ # @return [::Gapic::Config::Method]
834
+ #
835
+ attr_reader :create_cluster
836
+
837
+ # @private
838
+ def initialize parent_rpcs = nil
839
+ list_clusters_config = parent_rpcs.list_clusters if parent_rpcs.respond_to? :list_clusters
840
+ @list_clusters = ::Gapic::Config::Method.new list_clusters_config
841
+ get_cluster_config = parent_rpcs.get_cluster if parent_rpcs.respond_to? :get_cluster
842
+ @get_cluster = ::Gapic::Config::Method.new get_cluster_config
843
+ update_cluster_config = parent_rpcs.update_cluster if parent_rpcs.respond_to? :update_cluster
844
+ @update_cluster = ::Gapic::Config::Method.new update_cluster_config
845
+ delete_cluster_config = parent_rpcs.delete_cluster if parent_rpcs.respond_to? :delete_cluster
846
+ @delete_cluster = ::Gapic::Config::Method.new delete_cluster_config
847
+ create_cluster_config = parent_rpcs.create_cluster if parent_rpcs.respond_to? :create_cluster
848
+ @create_cluster = ::Gapic::Config::Method.new create_cluster_config
849
+
850
+ yield self if block_given?
851
+ end
852
+ end
853
+ end
854
+ end
855
+ end
856
+ end
857
+ end
858
+ end
859
+ end
860
+ end
861
+ end