google-cloud-redis-cluster-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.
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,903 @@
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
+
21
+ module Google
22
+ module Cloud
23
+ module Redis
24
+ module Cluster
25
+ module V1beta1
26
+ module CloudRedisCluster
27
+ module Rest
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
+ # Create the configuration object
87
+ @config = Configuration.new Operations.configure
88
+
89
+ # Yield the configuration if needed
90
+ yield @config if block_given?
91
+
92
+ # Create credentials
93
+ credentials = @config.credentials
94
+ credentials ||= Credentials.default scope: @config.scope
95
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
96
+ credentials = Credentials.new credentials, scope: @config.scope
97
+ end
98
+
99
+ @quota_project_id = @config.quota_project
100
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
101
+
102
+ @operations_stub = OperationsServiceStub.new(
103
+ endpoint: @config.endpoint,
104
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
105
+ universe_domain: @config.universe_domain,
106
+ credentials: credentials
107
+ )
108
+
109
+ # Used by an LRO wrapper for some methods of this service
110
+ @operations_client = self
111
+ end
112
+
113
+ # Service calls
114
+
115
+ ##
116
+ # Lists operations that match the specified filter in the request. If the
117
+ # server doesn't support this method, it returns `UNIMPLEMENTED`.
118
+ #
119
+ # NOTE: the `name` binding allows API services to override the binding
120
+ # to use different resource name schemes, such as `users/*/operations`. To
121
+ # override the binding, API services can add a binding such as
122
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
123
+ # For backwards compatibility, the default name includes the operations
124
+ # collection id, however overriding users must ensure the name binding
125
+ # is the parent resource, without the operations collection id.
126
+ #
127
+ # @overload list_operations(request, options = nil)
128
+ # Pass arguments to `list_operations` via a request object, either of type
129
+ # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
130
+ #
131
+ # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
132
+ # A request object representing the call parameters. Required. To specify no
133
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
134
+ # @param options [::Gapic::CallOptions, ::Hash]
135
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
136
+ #
137
+ # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
138
+ # Pass arguments to `list_operations` via keyword arguments. Note that at
139
+ # least one keyword argument is required. To specify no parameters, or to keep all
140
+ # the default parameter values, pass an empty Hash as a request object (see above).
141
+ #
142
+ # @param name [::String]
143
+ # The name of the operation's parent resource.
144
+ # @param filter [::String]
145
+ # The standard list filter.
146
+ # @param page_size [::Integer]
147
+ # The standard list page size.
148
+ # @param page_token [::String]
149
+ # The standard list page token.
150
+ # @yield [result, operation] Access the result along with the TransportOperation object
151
+ # @yieldparam result [::Gapic::Operation]
152
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
153
+ #
154
+ # @return [::Gapic::Operation]
155
+ #
156
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
157
+ #
158
+ # @example Basic example
159
+ # require "google/longrunning"
160
+ #
161
+ # # Create a client object. The client can be reused for multiple calls.
162
+ # client = Google::Longrunning::Operations::Rest::Client.new
163
+ #
164
+ # # Create a request. To set request fields, pass in keyword arguments.
165
+ # request = Google::Longrunning::ListOperationsRequest.new
166
+ #
167
+ # # Call the list_operations method.
168
+ # result = client.list_operations request
169
+ #
170
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
171
+ # # over elements, and API calls will be issued to fetch pages as needed.
172
+ # result.each do |item|
173
+ # # Each element is of type ::Google::Longrunning::Operation.
174
+ # p item
175
+ # end
176
+ #
177
+ def list_operations request, options = nil
178
+ raise ::ArgumentError, "request must be provided" if request.nil?
179
+
180
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
181
+
182
+ # Converts hash and nil to an options object
183
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
184
+
185
+ # Customize the options with defaults
186
+ call_metadata = @config.rpcs.list_operations.metadata.to_h
187
+
188
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
189
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
190
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
191
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1beta1::VERSION,
192
+ transports_version_send: [:rest]
193
+
194
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
195
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
196
+
197
+ options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
198
+ metadata: call_metadata,
199
+ retry_policy: @config.rpcs.list_operations.retry_policy
200
+
201
+ options.apply_defaults timeout: @config.timeout,
202
+ metadata: @config.metadata,
203
+ retry_policy: @config.retry_policy
204
+
205
+ @operations_stub.list_operations request, options do |result, operation|
206
+ result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
207
+ yield result, operation if block_given?
208
+ return result
209
+ end
210
+ rescue ::Gapic::Rest::Error => e
211
+ raise ::Google::Cloud::Error.from_error(e)
212
+ end
213
+
214
+ ##
215
+ # Gets the latest state of a long-running operation. Clients can use this
216
+ # method to poll the operation result at intervals as recommended by the API
217
+ # service.
218
+ #
219
+ # @overload get_operation(request, options = nil)
220
+ # Pass arguments to `get_operation` via a request object, either of type
221
+ # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
222
+ #
223
+ # @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
224
+ # A request object representing the call parameters. Required. To specify no
225
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
226
+ # @param options [::Gapic::CallOptions, ::Hash]
227
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
228
+ #
229
+ # @overload get_operation(name: nil)
230
+ # Pass arguments to `get_operation` via keyword arguments. Note that at
231
+ # least one keyword argument is required. To specify no parameters, or to keep all
232
+ # the default parameter values, pass an empty Hash as a request object (see above).
233
+ #
234
+ # @param name [::String]
235
+ # The name of the operation resource.
236
+ # @yield [result, operation] Access the result along with the TransportOperation object
237
+ # @yieldparam result [::Gapic::Operation]
238
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
239
+ #
240
+ # @return [::Gapic::Operation]
241
+ #
242
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
243
+ #
244
+ # @example Basic example
245
+ # require "google/longrunning"
246
+ #
247
+ # # Create a client object. The client can be reused for multiple calls.
248
+ # client = Google::Longrunning::Operations::Rest::Client.new
249
+ #
250
+ # # Create a request. To set request fields, pass in keyword arguments.
251
+ # request = Google::Longrunning::GetOperationRequest.new
252
+ #
253
+ # # Call the get_operation method.
254
+ # result = client.get_operation request
255
+ #
256
+ # # The returned object is of type Gapic::Operation. You can use it to
257
+ # # check the status of an operation, cancel it, or wait for results.
258
+ # # Here is how to wait for a response.
259
+ # result.wait_until_done! timeout: 60
260
+ # if result.response?
261
+ # p result.response
262
+ # else
263
+ # puts "No response received."
264
+ # end
265
+ #
266
+ def get_operation request, options = nil
267
+ raise ::ArgumentError, "request must be provided" if request.nil?
268
+
269
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
270
+
271
+ # Converts hash and nil to an options object
272
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
273
+
274
+ # Customize the options with defaults
275
+ call_metadata = @config.rpcs.get_operation.metadata.to_h
276
+
277
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
278
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
279
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
280
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1beta1::VERSION,
281
+ transports_version_send: [:rest]
282
+
283
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
284
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
285
+
286
+ options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
287
+ metadata: call_metadata,
288
+ retry_policy: @config.rpcs.get_operation.retry_policy
289
+
290
+ options.apply_defaults timeout: @config.timeout,
291
+ metadata: @config.metadata,
292
+ retry_policy: @config.retry_policy
293
+
294
+ @operations_stub.get_operation request, options do |result, operation|
295
+ result = ::Gapic::Operation.new result, @operations_client, options: options
296
+ yield result, operation if block_given?
297
+ return result
298
+ end
299
+ rescue ::Gapic::Rest::Error => e
300
+ raise ::Google::Cloud::Error.from_error(e)
301
+ end
302
+
303
+ ##
304
+ # Deletes a long-running operation. This method indicates that the client is
305
+ # no longer interested in the operation result. It does not cancel the
306
+ # operation. If the server doesn't support this method, it returns
307
+ # `google.rpc.Code.UNIMPLEMENTED`.
308
+ #
309
+ # @overload delete_operation(request, options = nil)
310
+ # Pass arguments to `delete_operation` via a request object, either of type
311
+ # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
312
+ #
313
+ # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
314
+ # A request object representing the call parameters. Required. To specify no
315
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
316
+ # @param options [::Gapic::CallOptions, ::Hash]
317
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
318
+ #
319
+ # @overload delete_operation(name: nil)
320
+ # Pass arguments to `delete_operation` via keyword arguments. Note that at
321
+ # least one keyword argument is required. To specify no parameters, or to keep all
322
+ # the default parameter values, pass an empty Hash as a request object (see above).
323
+ #
324
+ # @param name [::String]
325
+ # The name of the operation resource to be deleted.
326
+ # @yield [result, operation] Access the result along with the TransportOperation object
327
+ # @yieldparam result [::Google::Protobuf::Empty]
328
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
329
+ #
330
+ # @return [::Google::Protobuf::Empty]
331
+ #
332
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
333
+ #
334
+ # @example Basic example
335
+ # require "google/longrunning"
336
+ #
337
+ # # Create a client object. The client can be reused for multiple calls.
338
+ # client = Google::Longrunning::Operations::Rest::Client.new
339
+ #
340
+ # # Create a request. To set request fields, pass in keyword arguments.
341
+ # request = Google::Longrunning::DeleteOperationRequest.new
342
+ #
343
+ # # Call the delete_operation method.
344
+ # result = client.delete_operation request
345
+ #
346
+ # # The returned object is of type Google::Protobuf::Empty.
347
+ # p result
348
+ #
349
+ def delete_operation request, options = nil
350
+ raise ::ArgumentError, "request must be provided" if request.nil?
351
+
352
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
353
+
354
+ # Converts hash and nil to an options object
355
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
356
+
357
+ # Customize the options with defaults
358
+ call_metadata = @config.rpcs.delete_operation.metadata.to_h
359
+
360
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
361
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
362
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
363
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1beta1::VERSION,
364
+ transports_version_send: [:rest]
365
+
366
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
367
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
368
+
369
+ options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
370
+ metadata: call_metadata,
371
+ retry_policy: @config.rpcs.delete_operation.retry_policy
372
+
373
+ options.apply_defaults timeout: @config.timeout,
374
+ metadata: @config.metadata,
375
+ retry_policy: @config.retry_policy
376
+
377
+ @operations_stub.delete_operation request, options do |result, operation|
378
+ yield result, operation if block_given?
379
+ return result
380
+ end
381
+ rescue ::Gapic::Rest::Error => e
382
+ raise ::Google::Cloud::Error.from_error(e)
383
+ end
384
+
385
+ ##
386
+ # Starts asynchronous cancellation on a long-running operation. The server
387
+ # makes a best effort to cancel the operation, but success is not
388
+ # guaranteed. If the server doesn't support this method, it returns
389
+ # `google.rpc.Code.UNIMPLEMENTED`. Clients can use
390
+ # Operations.GetOperation or
391
+ # other methods to check whether the cancellation succeeded or whether the
392
+ # operation completed despite cancellation. On successful cancellation,
393
+ # the operation is not deleted; instead, it becomes an operation with
394
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
395
+ # corresponding to `Code.CANCELLED`.
396
+ #
397
+ # @overload cancel_operation(request, options = nil)
398
+ # Pass arguments to `cancel_operation` via a request object, either of type
399
+ # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
400
+ #
401
+ # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
402
+ # A request object representing the call parameters. Required. To specify no
403
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
404
+ # @param options [::Gapic::CallOptions, ::Hash]
405
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
406
+ #
407
+ # @overload cancel_operation(name: nil)
408
+ # Pass arguments to `cancel_operation` via keyword arguments. Note that at
409
+ # least one keyword argument is required. To specify no parameters, or to keep all
410
+ # the default parameter values, pass an empty Hash as a request object (see above).
411
+ #
412
+ # @param name [::String]
413
+ # The name of the operation resource to be cancelled.
414
+ # @yield [result, operation] Access the result along with the TransportOperation object
415
+ # @yieldparam result [::Google::Protobuf::Empty]
416
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
417
+ #
418
+ # @return [::Google::Protobuf::Empty]
419
+ #
420
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
421
+ #
422
+ # @example Basic example
423
+ # require "google/longrunning"
424
+ #
425
+ # # Create a client object. The client can be reused for multiple calls.
426
+ # client = Google::Longrunning::Operations::Rest::Client.new
427
+ #
428
+ # # Create a request. To set request fields, pass in keyword arguments.
429
+ # request = Google::Longrunning::CancelOperationRequest.new
430
+ #
431
+ # # Call the cancel_operation method.
432
+ # result = client.cancel_operation request
433
+ #
434
+ # # The returned object is of type Google::Protobuf::Empty.
435
+ # p result
436
+ #
437
+ def cancel_operation request, options = nil
438
+ raise ::ArgumentError, "request must be provided" if request.nil?
439
+
440
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
441
+
442
+ # Converts hash and nil to an options object
443
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
444
+
445
+ # Customize the options with defaults
446
+ call_metadata = @config.rpcs.cancel_operation.metadata.to_h
447
+
448
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
449
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
450
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
451
+ gapic_version: ::Google::Cloud::Redis::Cluster::V1beta1::VERSION,
452
+ transports_version_send: [:rest]
453
+
454
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
455
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
456
+
457
+ options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
458
+ metadata: call_metadata,
459
+ retry_policy: @config.rpcs.cancel_operation.retry_policy
460
+
461
+ options.apply_defaults timeout: @config.timeout,
462
+ metadata: @config.metadata,
463
+ retry_policy: @config.retry_policy
464
+
465
+ @operations_stub.cancel_operation request, options do |result, operation|
466
+ yield result, operation if block_given?
467
+ return result
468
+ end
469
+ rescue ::Gapic::Rest::Error => e
470
+ raise ::Google::Cloud::Error.from_error(e)
471
+ end
472
+
473
+ ##
474
+ # Configuration class for the Operations REST API.
475
+ #
476
+ # This class represents the configuration for Operations REST,
477
+ # providing control over timeouts, retry behavior, logging, transport
478
+ # parameters, and other low-level controls. Certain parameters can also be
479
+ # applied individually to specific RPCs. See
480
+ # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs}
481
+ # for a list of RPCs that can be configured independently.
482
+ #
483
+ # Configuration can be applied globally to all clients, or to a single client
484
+ # on construction.
485
+ #
486
+ # @example
487
+ #
488
+ # # Modify the global config, setting the timeout for
489
+ # # list_operations to 20 seconds,
490
+ # # and all remaining timeouts to 10 seconds.
491
+ # ::Google::Longrunning::Operations::Rest::Client.configure do |config|
492
+ # config.timeout = 10.0
493
+ # config.rpcs.list_operations.timeout = 20.0
494
+ # end
495
+ #
496
+ # # Apply the above configuration only to a new client.
497
+ # client = ::Google::Longrunning::Operations::Rest::Client.new do |config|
498
+ # config.timeout = 10.0
499
+ # config.rpcs.list_operations.timeout = 20.0
500
+ # end
501
+ #
502
+ # @!attribute [rw] endpoint
503
+ # A custom service endpoint, as a hostname or hostname:port. The default is
504
+ # nil, indicating to use the default endpoint in the current universe domain.
505
+ # @return [::String,nil]
506
+ # @!attribute [rw] credentials
507
+ # Credentials to send with calls. You may provide any of the following types:
508
+ # * (`String`) The path to a service account key file in JSON format
509
+ # * (`Hash`) A service account key as a Hash
510
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
511
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
512
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
513
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
514
+ # * (`nil`) indicating no credentials
515
+ # @return [::Object]
516
+ # @!attribute [rw] scope
517
+ # The OAuth scopes
518
+ # @return [::Array<::String>]
519
+ # @!attribute [rw] lib_name
520
+ # The library name as recorded in instrumentation and logging
521
+ # @return [::String]
522
+ # @!attribute [rw] lib_version
523
+ # The library version as recorded in instrumentation and logging
524
+ # @return [::String]
525
+ # @!attribute [rw] timeout
526
+ # The call timeout in seconds.
527
+ # @return [::Numeric]
528
+ # @!attribute [rw] metadata
529
+ # Additional headers to be sent with the call.
530
+ # @return [::Hash{::Symbol=>::String}]
531
+ # @!attribute [rw] retry_policy
532
+ # The retry policy. The value is a hash with the following keys:
533
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
534
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
535
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
536
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
537
+ # trigger a retry.
538
+ # @return [::Hash]
539
+ # @!attribute [rw] quota_project
540
+ # A separate project against which to charge quota.
541
+ # @return [::String]
542
+ # @!attribute [rw] universe_domain
543
+ # The universe domain within which to make requests. This determines the
544
+ # default endpoint URL. The default value of nil uses the environment
545
+ # universe (usually the default "googleapis.com" universe).
546
+ # @return [::String,nil]
547
+ #
548
+ class Configuration
549
+ extend ::Gapic::Config
550
+
551
+ # @private
552
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
553
+ DEFAULT_ENDPOINT = "redis.googleapis.com"
554
+
555
+ config_attr :endpoint, nil, ::String, nil
556
+ config_attr :credentials, nil do |value|
557
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
558
+ allowed.any? { |klass| klass === value }
559
+ end
560
+ config_attr :scope, nil, ::String, ::Array, nil
561
+ config_attr :lib_name, nil, ::String, nil
562
+ config_attr :lib_version, nil, ::String, nil
563
+ config_attr :timeout, nil, ::Numeric, nil
564
+ config_attr :metadata, nil, ::Hash, nil
565
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
566
+ config_attr :quota_project, nil, ::String, nil
567
+ config_attr :universe_domain, nil, ::String, nil
568
+
569
+ # @private
570
+ def initialize parent_config = nil
571
+ @parent_config = parent_config unless parent_config.nil?
572
+
573
+ yield self if block_given?
574
+ end
575
+
576
+ ##
577
+ # Configurations for individual RPCs
578
+ # @return [Rpcs]
579
+ #
580
+ def rpcs
581
+ @rpcs ||= begin
582
+ parent_rpcs = nil
583
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
584
+ Rpcs.new parent_rpcs
585
+ end
586
+ end
587
+
588
+ ##
589
+ # Configuration RPC class for the Operations API.
590
+ #
591
+ # Includes fields providing the configuration for each RPC in this service.
592
+ # Each configuration object is of type `Gapic::Config::Method` and includes
593
+ # the following configuration fields:
594
+ #
595
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
596
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
597
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
598
+ # include the following keys:
599
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
600
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
601
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
602
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
603
+ # trigger a retry.
604
+ #
605
+ class Rpcs
606
+ ##
607
+ # RPC-specific configuration for `list_operations`
608
+ # @return [::Gapic::Config::Method]
609
+ #
610
+ attr_reader :list_operations
611
+ ##
612
+ # RPC-specific configuration for `get_operation`
613
+ # @return [::Gapic::Config::Method]
614
+ #
615
+ attr_reader :get_operation
616
+ ##
617
+ # RPC-specific configuration for `delete_operation`
618
+ # @return [::Gapic::Config::Method]
619
+ #
620
+ attr_reader :delete_operation
621
+ ##
622
+ # RPC-specific configuration for `cancel_operation`
623
+ # @return [::Gapic::Config::Method]
624
+ #
625
+ attr_reader :cancel_operation
626
+
627
+ # @private
628
+ def initialize parent_rpcs = nil
629
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
630
+ @list_operations = ::Gapic::Config::Method.new list_operations_config
631
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
632
+ @get_operation = ::Gapic::Config::Method.new get_operation_config
633
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
634
+ @delete_operation = ::Gapic::Config::Method.new delete_operation_config
635
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
636
+ @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
637
+
638
+ yield self if block_given?
639
+ end
640
+ end
641
+ end
642
+ end
643
+
644
+ ##
645
+ # @private
646
+ # REST service stub for the Longrunning Operations API.
647
+ # Service stub contains baseline method implementations
648
+ # including transcoding, making the REST call, and deserialing the response.
649
+ class OperationsServiceStub
650
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
651
+ # These require statements are intentionally placed here to initialize
652
+ # the REST modules only when it's required.
653
+ require "gapic/rest"
654
+
655
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
656
+ endpoint_template: endpoint_template,
657
+ universe_domain: universe_domain,
658
+ credentials: credentials
659
+ end
660
+
661
+ ##
662
+ # Baseline implementation for the list_operations REST call
663
+ #
664
+ # @param request_pb [::Google::Longrunning::ListOperationsRequest]
665
+ # A request object representing the call parameters. Required.
666
+ # @param options [::Gapic::CallOptions]
667
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
668
+ #
669
+ # @yield [result, operation] Access the result along with the TransportOperation object
670
+ # @yieldparam result [::Google::Longrunning::ListOperationsResponse]
671
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
672
+ #
673
+ # @return [::Google::Longrunning::ListOperationsResponse]
674
+ # A result object deserialized from the server's reply
675
+ def list_operations request_pb, options = nil
676
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
677
+
678
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb
679
+ query_string_params = if query_string_params.any?
680
+ query_string_params.to_h { |p| p.split "=", 2 }
681
+ else
682
+ {}
683
+ end
684
+
685
+ response = @client_stub.make_http_request(
686
+ verb,
687
+ uri: uri,
688
+ body: body || "",
689
+ params: query_string_params,
690
+ options: options
691
+ )
692
+ operation = ::Gapic::Rest::TransportOperation.new response
693
+ result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
694
+
695
+ yield result, operation if block_given?
696
+ result
697
+ end
698
+
699
+ ##
700
+ # Baseline implementation for the get_operation REST call
701
+ #
702
+ # @param request_pb [::Google::Longrunning::GetOperationRequest]
703
+ # A request object representing the call parameters. Required.
704
+ # @param options [::Gapic::CallOptions]
705
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
706
+ #
707
+ # @yield [result, operation] Access the result along with the TransportOperation object
708
+ # @yieldparam result [::Google::Longrunning::Operation]
709
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
710
+ #
711
+ # @return [::Google::Longrunning::Operation]
712
+ # A result object deserialized from the server's reply
713
+ def get_operation request_pb, options = nil
714
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
715
+
716
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb
717
+ query_string_params = if query_string_params.any?
718
+ query_string_params.to_h { |p| p.split "=", 2 }
719
+ else
720
+ {}
721
+ end
722
+
723
+ response = @client_stub.make_http_request(
724
+ verb,
725
+ uri: uri,
726
+ body: body || "",
727
+ params: query_string_params,
728
+ options: options
729
+ )
730
+ operation = ::Gapic::Rest::TransportOperation.new response
731
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
732
+
733
+ yield result, operation if block_given?
734
+ result
735
+ end
736
+
737
+ ##
738
+ # Baseline implementation for the delete_operation REST call
739
+ #
740
+ # @param request_pb [::Google::Longrunning::DeleteOperationRequest]
741
+ # A request object representing the call parameters. Required.
742
+ # @param options [::Gapic::CallOptions]
743
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
744
+ #
745
+ # @yield [result, operation] Access the result along with the TransportOperation object
746
+ # @yieldparam result [::Google::Protobuf::Empty]
747
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
748
+ #
749
+ # @return [::Google::Protobuf::Empty]
750
+ # A result object deserialized from the server's reply
751
+ def delete_operation request_pb, options = nil
752
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
753
+
754
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb
755
+ query_string_params = if query_string_params.any?
756
+ query_string_params.to_h { |p| p.split "=", 2 }
757
+ else
758
+ {}
759
+ end
760
+
761
+ response = @client_stub.make_http_request(
762
+ verb,
763
+ uri: uri,
764
+ body: body || "",
765
+ params: query_string_params,
766
+ options: options
767
+ )
768
+ operation = ::Gapic::Rest::TransportOperation.new response
769
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
770
+
771
+ yield result, operation if block_given?
772
+ result
773
+ end
774
+
775
+ ##
776
+ # Baseline implementation for the cancel_operation REST call
777
+ #
778
+ # @param request_pb [::Google::Longrunning::CancelOperationRequest]
779
+ # A request object representing the call parameters. Required.
780
+ # @param options [::Gapic::CallOptions]
781
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
782
+ #
783
+ # @yield [result, operation] Access the result along with the TransportOperation object
784
+ # @yieldparam result [::Google::Protobuf::Empty]
785
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
786
+ #
787
+ # @return [::Google::Protobuf::Empty]
788
+ # A result object deserialized from the server's reply
789
+ def cancel_operation request_pb, options = nil
790
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
791
+
792
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb
793
+ query_string_params = if query_string_params.any?
794
+ query_string_params.to_h { |p| p.split "=", 2 }
795
+ else
796
+ {}
797
+ end
798
+
799
+ response = @client_stub.make_http_request(
800
+ verb,
801
+ uri: uri,
802
+ body: body || "",
803
+ params: query_string_params,
804
+ options: options
805
+ )
806
+ operation = ::Gapic::Rest::TransportOperation.new response
807
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
808
+
809
+ yield result, operation if block_given?
810
+ result
811
+ end
812
+
813
+ ##
814
+ # @private
815
+ #
816
+ # GRPC transcoding helper method for the list_operations REST call
817
+ #
818
+ # @param request_pb [::Google::Longrunning::ListOperationsRequest]
819
+ # A request object representing the call parameters. Required.
820
+ # @return [Array(String, [String, nil], Hash{String => String})]
821
+ # Uri, Body, Query string parameters
822
+ def self.transcode_list_operations_request request_pb
823
+ transcoder = Gapic::Rest::GrpcTranscoder.new
824
+ .with_bindings(
825
+ uri_method: :get,
826
+ uri_template: "/v1beta1/{name}/operations",
827
+ matches: [
828
+ ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
829
+ ]
830
+ )
831
+ transcoder.transcode request_pb
832
+ end
833
+
834
+ ##
835
+ # @private
836
+ #
837
+ # GRPC transcoding helper method for the get_operation REST call
838
+ #
839
+ # @param request_pb [::Google::Longrunning::GetOperationRequest]
840
+ # A request object representing the call parameters. Required.
841
+ # @return [Array(String, [String, nil], Hash{String => String})]
842
+ # Uri, Body, Query string parameters
843
+ def self.transcode_get_operation_request request_pb
844
+ transcoder = Gapic::Rest::GrpcTranscoder.new
845
+ .with_bindings(
846
+ uri_method: :get,
847
+ uri_template: "/v1beta1/{name}",
848
+ matches: [
849
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
850
+ ]
851
+ )
852
+ transcoder.transcode request_pb
853
+ end
854
+
855
+ ##
856
+ # @private
857
+ #
858
+ # GRPC transcoding helper method for the delete_operation REST call
859
+ #
860
+ # @param request_pb [::Google::Longrunning::DeleteOperationRequest]
861
+ # A request object representing the call parameters. Required.
862
+ # @return [Array(String, [String, nil], Hash{String => String})]
863
+ # Uri, Body, Query string parameters
864
+ def self.transcode_delete_operation_request request_pb
865
+ transcoder = Gapic::Rest::GrpcTranscoder.new
866
+ .with_bindings(
867
+ uri_method: :delete,
868
+ uri_template: "/v1beta1/{name}",
869
+ matches: [
870
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
871
+ ]
872
+ )
873
+ transcoder.transcode request_pb
874
+ end
875
+
876
+ ##
877
+ # @private
878
+ #
879
+ # GRPC transcoding helper method for the cancel_operation REST call
880
+ #
881
+ # @param request_pb [::Google::Longrunning::CancelOperationRequest]
882
+ # A request object representing the call parameters. Required.
883
+ # @return [Array(String, [String, nil], Hash{String => String})]
884
+ # Uri, Body, Query string parameters
885
+ def self.transcode_cancel_operation_request request_pb
886
+ transcoder = Gapic::Rest::GrpcTranscoder.new
887
+ .with_bindings(
888
+ uri_method: :post,
889
+ uri_template: "/v1beta1/{name}:cancel",
890
+ matches: [
891
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
892
+ ]
893
+ )
894
+ transcoder.transcode request_pb
895
+ end
896
+ end
897
+ end
898
+ end
899
+ end
900
+ end
901
+ end
902
+ end
903
+ end