google-cloud-memorystore-v1beta 0.a → 0.2.0

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