google-cloud-redis-cluster-v1beta1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +144 -0
  6. data/lib/google/cloud/redis/cluster/v1beta1/bindings_override.rb +104 -0
  7. data/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/client.rb +1048 -0
  8. data/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/credentials.rb +49 -0
  9. data/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/operations.rb +811 -0
  10. data/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/paths.rb +90 -0
  11. data/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest/client.rb +987 -0
  12. data/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest/operations.rb +903 -0
  13. data/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest/service_stub.rb +427 -0
  14. data/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest.rb +76 -0
  15. data/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster.rb +78 -0
  16. data/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_pb.rb +84 -0
  17. data/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_services_pb.rb +97 -0
  18. data/lib/google/cloud/redis/cluster/v1beta1/rest.rb +40 -0
  19. data/lib/google/cloud/redis/cluster/v1beta1/version.rb +30 -0
  20. data/lib/google/cloud/redis/cluster/v1beta1.rb +47 -0
  21. data/lib/google-cloud-redis-cluster-v1beta1.rb +21 -0
  22. data/proto_docs/README.md +4 -0
  23. data/proto_docs/google/api/client.rb +399 -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/v1beta1/cloud_redis_cluster.rb +564 -0
  28. data/proto_docs/google/longrunning/operations.rb +164 -0
  29. data/proto_docs/google/protobuf/any.rb +145 -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 +132 -0
@@ -0,0 +1,811 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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/operation"
20
+ require "google/longrunning/operations_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Redis
25
+ module Cluster
26
+ module V1beta1
27
+ module CloudRedisCluster
28
+ # Service that implements Longrunning Operations API.
29
+ class Operations
30
+ # @private
31
+ API_VERSION = ""
32
+
33
+ # @private
34
+ DEFAULT_ENDPOINT_TEMPLATE = "redis.$UNIVERSE_DOMAIN$"
35
+
36
+ # @private
37
+ attr_reader :operations_stub
38
+
39
+ ##
40
+ # Configuration for the CloudRedisCluster Operations API.
41
+ #
42
+ # @yield [config] Configure the Operations client.
43
+ # @yieldparam config [Operations::Configuration]
44
+ #
45
+ # @return [Operations::Configuration]
46
+ #
47
+ def self.configure
48
+ @configure ||= Operations::Configuration.new
49
+ yield @configure if block_given?
50
+ @configure
51
+ end
52
+
53
+ ##
54
+ # Configure the CloudRedisCluster Operations instance.
55
+ #
56
+ # The configuration is set to the derived mode, meaning that values can be changed,
57
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
58
+ # should be made on {Operations.configure}.
59
+ #
60
+ # @yield [config] Configure the Operations client.
61
+ # @yieldparam config [Operations::Configuration]
62
+ #
63
+ # @return [Operations::Configuration]
64
+ #
65
+ def configure
66
+ yield @config if block_given?
67
+ @config
68
+ end
69
+
70
+ ##
71
+ # The effective universe domain
72
+ #
73
+ # @return [String]
74
+ #
75
+ def universe_domain
76
+ @operations_stub.universe_domain
77
+ end
78
+
79
+ ##
80
+ # Create a new Operations client object.
81
+ #
82
+ # @yield [config] Configure the Client client.
83
+ # @yieldparam config [Operations::Configuration]
84
+ #
85
+ def initialize
86
+ # These require statements are intentionally placed here to initialize
87
+ # the gRPC module only when it's required.
88
+ # See https://github.com/googleapis/toolkit/issues/446
89
+ require "gapic/grpc"
90
+ require "google/longrunning/operations_services_pb"
91
+
92
+ # Create the configuration object
93
+ @config = Configuration.new Operations.configure
94
+
95
+ # Yield the configuration if needed
96
+ yield @config if block_given?
97
+
98
+ # Create credentials
99
+ credentials = @config.credentials
100
+ credentials ||= Credentials.default scope: @config.scope
101
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
102
+ credentials = Credentials.new credentials, scope: @config.scope
103
+ end
104
+ @quota_project_id = @config.quota_project
105
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
106
+
107
+ @operations_stub = ::Gapic::ServiceStub.new(
108
+ ::Google::Longrunning::Operations::Stub,
109
+ credentials: credentials,
110
+ endpoint: @config.endpoint,
111
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
112
+ universe_domain: @config.universe_domain,
113
+ channel_args: @config.channel_args,
114
+ interceptors: @config.interceptors,
115
+ channel_pool_config: @config.channel_pool
116
+ )
117
+
118
+ # Used by an LRO wrapper for some methods of this service
119
+ @operations_client = self
120
+ end
121
+
122
+ # Service calls
123
+
124
+ ##
125
+ # Lists operations that match the specified filter in the request. If the
126
+ # server doesn't support this method, it returns `UNIMPLEMENTED`.
127
+ #
128
+ # NOTE: the `name` binding allows API services to override the binding
129
+ # to use different resource name schemes, such as `users/*/operations`. To
130
+ # override the binding, API services can add a binding such as
131
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
132
+ # For backwards compatibility, the default name includes the operations
133
+ # collection id, however overriding users must ensure the name binding
134
+ # is the parent resource, without the operations collection id.
135
+ #
136
+ # @overload list_operations(request, options = nil)
137
+ # Pass arguments to `list_operations` via a request object, either of type
138
+ # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
139
+ #
140
+ # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
141
+ # A request object representing the call parameters. Required. To specify no
142
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
143
+ # @param options [::Gapic::CallOptions, ::Hash]
144
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
145
+ #
146
+ # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
147
+ # Pass arguments to `list_operations` via keyword arguments. Note that at
148
+ # least one keyword argument is required. To specify no parameters, or to keep all
149
+ # the default parameter values, pass an empty Hash as a request object (see above).
150
+ #
151
+ # @param name [::String]
152
+ # The name of the operation's parent resource.
153
+ # @param filter [::String]
154
+ # The standard list filter.
155
+ # @param page_size [::Integer]
156
+ # The standard list page size.
157
+ # @param page_token [::String]
158
+ # The standard list page token.
159
+ #
160
+ # @yield [response, operation] Access the result along with the RPC operation
161
+ # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>]
162
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
163
+ #
164
+ # @return [::Gapic::PagedEnumerable<::Gapic::Operation>]
165
+ #
166
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
167
+ #
168
+ # @example Basic example
169
+ # require "google/longrunning"
170
+ #
171
+ # # Create a client object. The client can be reused for multiple calls.
172
+ # client = Google::Longrunning::Operations::Client.new
173
+ #
174
+ # # Create a request. To set request fields, pass in keyword arguments.
175
+ # request = Google::Longrunning::ListOperationsRequest.new
176
+ #
177
+ # # Call the list_operations method.
178
+ # result = client.list_operations request
179
+ #
180
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
181
+ # # over elements, and API calls will be issued to fetch pages as needed.
182
+ # result.each do |item|
183
+ # # Each element is of type ::Google::Longrunning::Operation.
184
+ # p item
185
+ # end
186
+ #
187
+ def list_operations request, options = nil
188
+ raise ::ArgumentError, "request must be provided" if request.nil?
189
+
190
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
191
+
192
+ # Converts hash and nil to an options object
193
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
194
+
195
+ # Customize the options with defaults
196
+ metadata = @config.rpcs.list_operations.metadata.to_h
197
+
198
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
199
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
200
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
201
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1beta1::VERSION
202
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
203
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
204
+
205
+ header_params = {}
206
+ if request.name
207
+ header_params["name"] = request.name
208
+ end
209
+
210
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
211
+ metadata[:"x-goog-request-params"] ||= request_params_header
212
+
213
+ options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
214
+ metadata: metadata,
215
+ retry_policy: @config.rpcs.list_operations.retry_policy
216
+
217
+ options.apply_defaults timeout: @config.timeout,
218
+ metadata: @config.metadata,
219
+ retry_policy: @config.retry_policy
220
+
221
+ @operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
222
+ wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
223
+ response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
224
+ yield response, operation if block_given?
225
+ return response
226
+ end
227
+ rescue ::GRPC::BadStatus => e
228
+ raise ::Google::Cloud::Error.from_error(e)
229
+ end
230
+
231
+ ##
232
+ # Gets the latest state of a long-running operation. Clients can use this
233
+ # method to poll the operation result at intervals as recommended by the API
234
+ # service.
235
+ #
236
+ # @overload get_operation(request, options = nil)
237
+ # Pass arguments to `get_operation` via a request object, either of type
238
+ # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
239
+ #
240
+ # @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
241
+ # A request object representing the call parameters. Required. To specify no
242
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
243
+ # @param options [::Gapic::CallOptions, ::Hash]
244
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
245
+ #
246
+ # @overload get_operation(name: nil)
247
+ # Pass arguments to `get_operation` via keyword arguments. Note that at
248
+ # least one keyword argument is required. To specify no parameters, or to keep all
249
+ # the default parameter values, pass an empty Hash as a request object (see above).
250
+ #
251
+ # @param name [::String]
252
+ # The name of the operation resource.
253
+ #
254
+ # @yield [response, operation] Access the result along with the RPC operation
255
+ # @yieldparam response [::Gapic::Operation]
256
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
257
+ #
258
+ # @return [::Gapic::Operation]
259
+ #
260
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
261
+ #
262
+ # @example Basic example
263
+ # require "google/longrunning"
264
+ #
265
+ # # Create a client object. The client can be reused for multiple calls.
266
+ # client = Google::Longrunning::Operations::Client.new
267
+ #
268
+ # # Create a request. To set request fields, pass in keyword arguments.
269
+ # request = Google::Longrunning::GetOperationRequest.new
270
+ #
271
+ # # Call the get_operation method.
272
+ # result = client.get_operation request
273
+ #
274
+ # # The returned object is of type Gapic::Operation. You can use it to
275
+ # # check the status of an operation, cancel it, or wait for results.
276
+ # # Here is how to wait for a response.
277
+ # result.wait_until_done! timeout: 60
278
+ # if result.response?
279
+ # p result.response
280
+ # else
281
+ # puts "No response received."
282
+ # end
283
+ #
284
+ def get_operation request, options = nil
285
+ raise ::ArgumentError, "request must be provided" if request.nil?
286
+
287
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
288
+
289
+ # Converts hash and nil to an options object
290
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
291
+
292
+ # Customize the options with defaults
293
+ metadata = @config.rpcs.get_operation.metadata.to_h
294
+
295
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
296
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
297
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
298
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1beta1::VERSION
299
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
300
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
301
+
302
+ header_params = {}
303
+ if request.name
304
+ header_params["name"] = request.name
305
+ end
306
+
307
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
308
+ metadata[:"x-goog-request-params"] ||= request_params_header
309
+
310
+ options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
311
+ metadata: metadata,
312
+ retry_policy: @config.rpcs.get_operation.retry_policy
313
+
314
+ options.apply_defaults timeout: @config.timeout,
315
+ metadata: @config.metadata,
316
+ retry_policy: @config.retry_policy
317
+
318
+ @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
319
+ response = ::Gapic::Operation.new response, @operations_client, options: options
320
+ yield response, operation if block_given?
321
+ return response
322
+ end
323
+ rescue ::GRPC::BadStatus => e
324
+ raise ::Google::Cloud::Error.from_error(e)
325
+ end
326
+
327
+ ##
328
+ # Deletes a long-running operation. This method indicates that the client is
329
+ # no longer interested in the operation result. It does not cancel the
330
+ # operation. If the server doesn't support this method, it returns
331
+ # `google.rpc.Code.UNIMPLEMENTED`.
332
+ #
333
+ # @overload delete_operation(request, options = nil)
334
+ # Pass arguments to `delete_operation` via a request object, either of type
335
+ # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
336
+ #
337
+ # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
338
+ # A request object representing the call parameters. Required. To specify no
339
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
340
+ # @param options [::Gapic::CallOptions, ::Hash]
341
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
342
+ #
343
+ # @overload delete_operation(name: nil)
344
+ # Pass arguments to `delete_operation` via keyword arguments. Note that at
345
+ # least one keyword argument is required. To specify no parameters, or to keep all
346
+ # the default parameter values, pass an empty Hash as a request object (see above).
347
+ #
348
+ # @param name [::String]
349
+ # The name of the operation resource to be deleted.
350
+ #
351
+ # @yield [response, operation] Access the result along with the RPC operation
352
+ # @yieldparam response [::Google::Protobuf::Empty]
353
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
354
+ #
355
+ # @return [::Google::Protobuf::Empty]
356
+ #
357
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
358
+ #
359
+ # @example Basic example
360
+ # require "google/longrunning"
361
+ #
362
+ # # Create a client object. The client can be reused for multiple calls.
363
+ # client = Google::Longrunning::Operations::Client.new
364
+ #
365
+ # # Create a request. To set request fields, pass in keyword arguments.
366
+ # request = Google::Longrunning::DeleteOperationRequest.new
367
+ #
368
+ # # Call the delete_operation method.
369
+ # result = client.delete_operation request
370
+ #
371
+ # # The returned object is of type Google::Protobuf::Empty.
372
+ # p result
373
+ #
374
+ def delete_operation request, options = nil
375
+ raise ::ArgumentError, "request must be provided" if request.nil?
376
+
377
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
378
+
379
+ # Converts hash and nil to an options object
380
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
381
+
382
+ # Customize the options with defaults
383
+ metadata = @config.rpcs.delete_operation.metadata.to_h
384
+
385
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
386
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
387
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
388
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1beta1::VERSION
389
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
390
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
391
+
392
+ header_params = {}
393
+ if request.name
394
+ header_params["name"] = request.name
395
+ end
396
+
397
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
398
+ metadata[:"x-goog-request-params"] ||= request_params_header
399
+
400
+ options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
401
+ metadata: metadata,
402
+ retry_policy: @config.rpcs.delete_operation.retry_policy
403
+
404
+ options.apply_defaults timeout: @config.timeout,
405
+ metadata: @config.metadata,
406
+ retry_policy: @config.retry_policy
407
+
408
+ @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
409
+ yield response, operation if block_given?
410
+ return response
411
+ end
412
+ rescue ::GRPC::BadStatus => e
413
+ raise ::Google::Cloud::Error.from_error(e)
414
+ end
415
+
416
+ ##
417
+ # Starts asynchronous cancellation on a long-running operation. The server
418
+ # makes a best effort to cancel the operation, but success is not
419
+ # guaranteed. If the server doesn't support this method, it returns
420
+ # `google.rpc.Code.UNIMPLEMENTED`. Clients can use
421
+ # Operations.GetOperation or
422
+ # other methods to check whether the cancellation succeeded or whether the
423
+ # operation completed despite cancellation. On successful cancellation,
424
+ # the operation is not deleted; instead, it becomes an operation with
425
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
426
+ # corresponding to `Code.CANCELLED`.
427
+ #
428
+ # @overload cancel_operation(request, options = nil)
429
+ # Pass arguments to `cancel_operation` via a request object, either of type
430
+ # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
431
+ #
432
+ # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
433
+ # A request object representing the call parameters. Required. To specify no
434
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
435
+ # @param options [::Gapic::CallOptions, ::Hash]
436
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
437
+ #
438
+ # @overload cancel_operation(name: nil)
439
+ # Pass arguments to `cancel_operation` via keyword arguments. Note that at
440
+ # least one keyword argument is required. To specify no parameters, or to keep all
441
+ # the default parameter values, pass an empty Hash as a request object (see above).
442
+ #
443
+ # @param name [::String]
444
+ # The name of the operation resource to be cancelled.
445
+ #
446
+ # @yield [response, operation] Access the result along with the RPC operation
447
+ # @yieldparam response [::Google::Protobuf::Empty]
448
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
449
+ #
450
+ # @return [::Google::Protobuf::Empty]
451
+ #
452
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
453
+ #
454
+ # @example Basic example
455
+ # require "google/longrunning"
456
+ #
457
+ # # Create a client object. The client can be reused for multiple calls.
458
+ # client = Google::Longrunning::Operations::Client.new
459
+ #
460
+ # # Create a request. To set request fields, pass in keyword arguments.
461
+ # request = Google::Longrunning::CancelOperationRequest.new
462
+ #
463
+ # # Call the cancel_operation method.
464
+ # result = client.cancel_operation request
465
+ #
466
+ # # The returned object is of type Google::Protobuf::Empty.
467
+ # p result
468
+ #
469
+ def cancel_operation request, options = nil
470
+ raise ::ArgumentError, "request must be provided" if request.nil?
471
+
472
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
473
+
474
+ # Converts hash and nil to an options object
475
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
476
+
477
+ # Customize the options with defaults
478
+ metadata = @config.rpcs.cancel_operation.metadata.to_h
479
+
480
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
481
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
482
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
483
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1beta1::VERSION
484
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
485
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
486
+
487
+ header_params = {}
488
+ if request.name
489
+ header_params["name"] = request.name
490
+ end
491
+
492
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
493
+ metadata[:"x-goog-request-params"] ||= request_params_header
494
+
495
+ options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
496
+ metadata: metadata,
497
+ retry_policy: @config.rpcs.cancel_operation.retry_policy
498
+
499
+ options.apply_defaults timeout: @config.timeout,
500
+ metadata: @config.metadata,
501
+ retry_policy: @config.retry_policy
502
+
503
+ @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
504
+ yield response, operation if block_given?
505
+ return response
506
+ end
507
+ rescue ::GRPC::BadStatus => e
508
+ raise ::Google::Cloud::Error.from_error(e)
509
+ end
510
+
511
+ ##
512
+ # Waits until the specified long-running operation is done or reaches at most
513
+ # a specified timeout, returning the latest state. If the operation is
514
+ # already done, the latest state is immediately returned. If the timeout
515
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
516
+ # timeout is used. If the server does not support this method, it returns
517
+ # `google.rpc.Code.UNIMPLEMENTED`.
518
+ # Note that this method is on a best-effort basis. It may return the latest
519
+ # state before the specified timeout (including immediately), meaning even an
520
+ # immediate response is no guarantee that the operation is done.
521
+ #
522
+ # @overload wait_operation(request, options = nil)
523
+ # Pass arguments to `wait_operation` via a request object, either of type
524
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
525
+ #
526
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::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 wait_operation(name: nil, timeout: nil)
533
+ # Pass arguments to `wait_operation` 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
+ # The name of the operation resource to wait on.
539
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
540
+ # The maximum duration to wait before timing out. If left blank, the wait
541
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
542
+ # If RPC context deadline is also specified, the shorter one will be used.
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
+ # @example Basic example
553
+ # require "google/longrunning"
554
+ #
555
+ # # Create a client object. The client can be reused for multiple calls.
556
+ # client = Google::Longrunning::Operations::Client.new
557
+ #
558
+ # # Create a request. To set request fields, pass in keyword arguments.
559
+ # request = Google::Longrunning::WaitOperationRequest.new
560
+ #
561
+ # # Call the wait_operation method.
562
+ # result = client.wait_operation request
563
+ #
564
+ # # The returned object is of type Gapic::Operation. You can use it to
565
+ # # check the status of an operation, cancel it, or wait for results.
566
+ # # Here is how to wait for a response.
567
+ # result.wait_until_done! timeout: 60
568
+ # if result.response?
569
+ # p result.response
570
+ # else
571
+ # puts "No response received."
572
+ # end
573
+ #
574
+ def wait_operation request, options = nil
575
+ raise ::ArgumentError, "request must be provided" if request.nil?
576
+
577
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
578
+
579
+ # Converts hash and nil to an options object
580
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
581
+
582
+ # Customize the options with defaults
583
+ metadata = @config.rpcs.wait_operation.metadata.to_h
584
+
585
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
586
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
587
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
588
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1beta1::VERSION
589
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
590
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
591
+
592
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
593
+ metadata: metadata,
594
+ retry_policy: @config.rpcs.wait_operation.retry_policy
595
+
596
+ options.apply_defaults timeout: @config.timeout,
597
+ metadata: @config.metadata,
598
+ retry_policy: @config.retry_policy
599
+
600
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
601
+ response = ::Gapic::Operation.new response, @operations_client, options: options
602
+ yield response, operation if block_given?
603
+ return response
604
+ end
605
+ rescue ::GRPC::BadStatus => e
606
+ raise ::Google::Cloud::Error.from_error(e)
607
+ end
608
+
609
+ ##
610
+ # Configuration class for the Operations API.
611
+ #
612
+ # This class represents the configuration for Operations,
613
+ # providing control over timeouts, retry behavior, logging, transport
614
+ # parameters, and other low-level controls. Certain parameters can also be
615
+ # applied individually to specific RPCs. See
616
+ # {::Google::Longrunning::Operations::Client::Configuration::Rpcs}
617
+ # for a list of RPCs that can be configured independently.
618
+ #
619
+ # Configuration can be applied globally to all clients, or to a single client
620
+ # on construction.
621
+ #
622
+ # @example
623
+ #
624
+ # # Modify the global config, setting the timeout for
625
+ # # list_operations to 20 seconds,
626
+ # # and all remaining timeouts to 10 seconds.
627
+ # ::Google::Longrunning::Operations::Client.configure do |config|
628
+ # config.timeout = 10.0
629
+ # config.rpcs.list_operations.timeout = 20.0
630
+ # end
631
+ #
632
+ # # Apply the above configuration only to a new client.
633
+ # client = ::Google::Longrunning::Operations::Client.new do |config|
634
+ # config.timeout = 10.0
635
+ # config.rpcs.list_operations.timeout = 20.0
636
+ # end
637
+ #
638
+ # @!attribute [rw] endpoint
639
+ # A custom service endpoint, as a hostname or hostname:port. The default is
640
+ # nil, indicating to use the default endpoint in the current universe domain.
641
+ # @return [::String,nil]
642
+ # @!attribute [rw] credentials
643
+ # Credentials to send with calls. You may provide any of the following types:
644
+ # * (`String`) The path to a service account key file in JSON format
645
+ # * (`Hash`) A service account key as a Hash
646
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
647
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
648
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
649
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
650
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
651
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
652
+ # * (`nil`) indicating no credentials
653
+ # @return [::Object]
654
+ # @!attribute [rw] scope
655
+ # The OAuth scopes
656
+ # @return [::Array<::String>]
657
+ # @!attribute [rw] lib_name
658
+ # The library name as recorded in instrumentation and logging
659
+ # @return [::String]
660
+ # @!attribute [rw] lib_version
661
+ # The library version as recorded in instrumentation and logging
662
+ # @return [::String]
663
+ # @!attribute [rw] channel_args
664
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
665
+ # `GRPC::Core::Channel` object is provided as the credential.
666
+ # @return [::Hash]
667
+ # @!attribute [rw] interceptors
668
+ # An array of interceptors that are run before calls are executed.
669
+ # @return [::Array<::GRPC::ClientInterceptor>]
670
+ # @!attribute [rw] timeout
671
+ # The call timeout in seconds.
672
+ # @return [::Numeric]
673
+ # @!attribute [rw] metadata
674
+ # Additional gRPC headers to be sent with the call.
675
+ # @return [::Hash{::Symbol=>::String}]
676
+ # @!attribute [rw] retry_policy
677
+ # The retry policy. The value is a hash with the following keys:
678
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
679
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
680
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
681
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
682
+ # trigger a retry.
683
+ # @return [::Hash]
684
+ # @!attribute [rw] quota_project
685
+ # A separate project against which to charge quota.
686
+ # @return [::String]
687
+ # @!attribute [rw] universe_domain
688
+ # The universe domain within which to make requests. This determines the
689
+ # default endpoint URL. The default value of nil uses the environment
690
+ # universe (usually the default "googleapis.com" universe).
691
+ # @return [::String,nil]
692
+ #
693
+ class Configuration
694
+ extend ::Gapic::Config
695
+
696
+ # @private
697
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
698
+ DEFAULT_ENDPOINT = "redis.googleapis.com"
699
+
700
+ config_attr :endpoint, nil, ::String, nil
701
+ config_attr :credentials, nil do |value|
702
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
703
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
704
+ allowed.any? { |klass| klass === value }
705
+ end
706
+ config_attr :scope, nil, ::String, ::Array, nil
707
+ config_attr :lib_name, nil, ::String, nil
708
+ config_attr :lib_version, nil, ::String, nil
709
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
710
+ config_attr :interceptors, nil, ::Array, nil
711
+ config_attr :timeout, nil, ::Numeric, nil
712
+ config_attr :metadata, nil, ::Hash, nil
713
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
714
+ config_attr :quota_project, nil, ::String, nil
715
+ config_attr :universe_domain, nil, ::String, nil
716
+
717
+ # @private
718
+ def initialize parent_config = nil
719
+ @parent_config = parent_config unless parent_config.nil?
720
+
721
+ yield self if block_given?
722
+ end
723
+
724
+ ##
725
+ # Configurations for individual RPCs
726
+ # @return [Rpcs]
727
+ #
728
+ def rpcs
729
+ @rpcs ||= begin
730
+ parent_rpcs = nil
731
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
732
+ Rpcs.new parent_rpcs
733
+ end
734
+ end
735
+
736
+ ##
737
+ # Configuration for the channel pool
738
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
739
+ #
740
+ def channel_pool
741
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
742
+ end
743
+
744
+ ##
745
+ # Configuration RPC class for the Operations API.
746
+ #
747
+ # Includes fields providing the configuration for each RPC in this service.
748
+ # Each configuration object is of type `Gapic::Config::Method` and includes
749
+ # the following configuration fields:
750
+ #
751
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
752
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
753
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
754
+ # include the following keys:
755
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
756
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
757
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
758
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
759
+ # trigger a retry.
760
+ #
761
+ class Rpcs
762
+ ##
763
+ # RPC-specific configuration for `list_operations`
764
+ # @return [::Gapic::Config::Method]
765
+ #
766
+ attr_reader :list_operations
767
+ ##
768
+ # RPC-specific configuration for `get_operation`
769
+ # @return [::Gapic::Config::Method]
770
+ #
771
+ attr_reader :get_operation
772
+ ##
773
+ # RPC-specific configuration for `delete_operation`
774
+ # @return [::Gapic::Config::Method]
775
+ #
776
+ attr_reader :delete_operation
777
+ ##
778
+ # RPC-specific configuration for `cancel_operation`
779
+ # @return [::Gapic::Config::Method]
780
+ #
781
+ attr_reader :cancel_operation
782
+ ##
783
+ # RPC-specific configuration for `wait_operation`
784
+ # @return [::Gapic::Config::Method]
785
+ #
786
+ attr_reader :wait_operation
787
+
788
+ # @private
789
+ def initialize parent_rpcs = nil
790
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
791
+ @list_operations = ::Gapic::Config::Method.new list_operations_config
792
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
793
+ @get_operation = ::Gapic::Config::Method.new get_operation_config
794
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
795
+ @delete_operation = ::Gapic::Config::Method.new delete_operation_config
796
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
797
+ @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
798
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
799
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
800
+
801
+ yield self if block_given?
802
+ end
803
+ end
804
+ end
805
+ end
806
+ end
807
+ end
808
+ end
809
+ end
810
+ end
811
+ end