google-cloud-memorystore-v1beta 0.a → 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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +118 -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 +982 -0
  9. data/lib/google/cloud/memorystore/v1beta/memorystore/rest/operations.rb +894 -0
  10. data/lib/google/cloud/memorystore/v1beta/memorystore/rest/service_stub.rb +425 -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,894 @@
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
+ return 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
+ return 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
+ return result
371
+ end
372
+ rescue ::Gapic::Rest::Error => e
373
+ raise ::Google::Cloud::Error.from_error(e)
374
+ end
375
+
376
+ ##
377
+ # Starts asynchronous cancellation on a long-running operation. The server
378
+ # makes a best effort to cancel the operation, but success is not
379
+ # guaranteed. If the server doesn't support this method, it returns
380
+ # `google.rpc.Code.UNIMPLEMENTED`. Clients can use
381
+ # Operations.GetOperation or
382
+ # other methods to check whether the cancellation succeeded or whether the
383
+ # operation completed despite cancellation. On successful cancellation,
384
+ # the operation is not deleted; instead, it becomes an operation with
385
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
386
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
387
+ # `Code.CANCELLED`.
388
+ #
389
+ # @overload cancel_operation(request, options = nil)
390
+ # Pass arguments to `cancel_operation` via a request object, either of type
391
+ # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
392
+ #
393
+ # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
394
+ # A request object representing the call parameters. Required. To specify no
395
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
396
+ # @param options [::Gapic::CallOptions, ::Hash]
397
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
398
+ #
399
+ # @overload cancel_operation(name: nil)
400
+ # Pass arguments to `cancel_operation` via keyword arguments. Note that at
401
+ # least one keyword argument is required. To specify no parameters, or to keep all
402
+ # the default parameter values, pass an empty Hash as a request object (see above).
403
+ #
404
+ # @param name [::String]
405
+ # The name of the operation resource to be cancelled.
406
+ # @yield [result, operation] Access the result along with the TransportOperation object
407
+ # @yieldparam result [::Google::Protobuf::Empty]
408
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
409
+ #
410
+ # @return [::Google::Protobuf::Empty]
411
+ #
412
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
413
+ #
414
+ # @example Basic example
415
+ # require "google/longrunning"
416
+ #
417
+ # # Create a client object. The client can be reused for multiple calls.
418
+ # client = Google::Longrunning::Operations::Rest::Client.new
419
+ #
420
+ # # Create a request. To set request fields, pass in keyword arguments.
421
+ # request = Google::Longrunning::CancelOperationRequest.new
422
+ #
423
+ # # Call the cancel_operation method.
424
+ # result = client.cancel_operation request
425
+ #
426
+ # # The returned object is of type Google::Protobuf::Empty.
427
+ # p result
428
+ #
429
+ def cancel_operation request, options = nil
430
+ raise ::ArgumentError, "request must be provided" if request.nil?
431
+
432
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
433
+
434
+ # Converts hash and nil to an options object
435
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
436
+
437
+ # Customize the options with defaults
438
+ call_metadata = @config.rpcs.cancel_operation.metadata.to_h
439
+
440
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
441
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
442
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
443
+ gapic_version: ::Google::Cloud::Memorystore::V1beta::VERSION,
444
+ transports_version_send: [:rest]
445
+
446
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
447
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
448
+
449
+ options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
450
+ metadata: call_metadata,
451
+ retry_policy: @config.rpcs.cancel_operation.retry_policy
452
+
453
+ options.apply_defaults timeout: @config.timeout,
454
+ metadata: @config.metadata,
455
+ retry_policy: @config.retry_policy
456
+
457
+ @operations_stub.cancel_operation request, options do |result, operation|
458
+ yield result, operation if block_given?
459
+ return result
460
+ end
461
+ rescue ::Gapic::Rest::Error => e
462
+ raise ::Google::Cloud::Error.from_error(e)
463
+ end
464
+
465
+ ##
466
+ # Configuration class for the Operations REST API.
467
+ #
468
+ # This class represents the configuration for Operations REST,
469
+ # providing control over timeouts, retry behavior, logging, transport
470
+ # parameters, and other low-level controls. Certain parameters can also be
471
+ # applied individually to specific RPCs. See
472
+ # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs}
473
+ # for a list of RPCs that can be configured independently.
474
+ #
475
+ # Configuration can be applied globally to all clients, or to a single client
476
+ # on construction.
477
+ #
478
+ # @example
479
+ #
480
+ # # Modify the global config, setting the timeout for
481
+ # # list_operations to 20 seconds,
482
+ # # and all remaining timeouts to 10 seconds.
483
+ # ::Google::Longrunning::Operations::Rest::Client.configure do |config|
484
+ # config.timeout = 10.0
485
+ # config.rpcs.list_operations.timeout = 20.0
486
+ # end
487
+ #
488
+ # # Apply the above configuration only to a new client.
489
+ # client = ::Google::Longrunning::Operations::Rest::Client.new do |config|
490
+ # config.timeout = 10.0
491
+ # config.rpcs.list_operations.timeout = 20.0
492
+ # end
493
+ #
494
+ # @!attribute [rw] endpoint
495
+ # A custom service endpoint, as a hostname or hostname:port. The default is
496
+ # nil, indicating to use the default endpoint in the current universe domain.
497
+ # @return [::String,nil]
498
+ # @!attribute [rw] credentials
499
+ # Credentials to send with calls. You may provide any of the following types:
500
+ # * (`String`) The path to a service account key file in JSON format
501
+ # * (`Hash`) A service account key as a Hash
502
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
503
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
504
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
505
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
506
+ # * (`nil`) indicating no credentials
507
+ # @return [::Object]
508
+ # @!attribute [rw] scope
509
+ # The OAuth scopes
510
+ # @return [::Array<::String>]
511
+ # @!attribute [rw] lib_name
512
+ # The library name as recorded in instrumentation and logging
513
+ # @return [::String]
514
+ # @!attribute [rw] lib_version
515
+ # The library version as recorded in instrumentation and logging
516
+ # @return [::String]
517
+ # @!attribute [rw] timeout
518
+ # The call timeout in seconds.
519
+ # @return [::Numeric]
520
+ # @!attribute [rw] metadata
521
+ # Additional headers to be sent with the call.
522
+ # @return [::Hash{::Symbol=>::String}]
523
+ # @!attribute [rw] retry_policy
524
+ # The retry policy. The value is a hash with the following keys:
525
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
526
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
527
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
528
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
529
+ # trigger a retry.
530
+ # @return [::Hash]
531
+ # @!attribute [rw] quota_project
532
+ # A separate project against which to charge quota.
533
+ # @return [::String]
534
+ # @!attribute [rw] universe_domain
535
+ # The universe domain within which to make requests. This determines the
536
+ # default endpoint URL. The default value of nil uses the environment
537
+ # universe (usually the default "googleapis.com" universe).
538
+ # @return [::String,nil]
539
+ #
540
+ class Configuration
541
+ extend ::Gapic::Config
542
+
543
+ # @private
544
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
545
+ DEFAULT_ENDPOINT = "memorystore.googleapis.com"
546
+
547
+ config_attr :endpoint, nil, ::String, nil
548
+ config_attr :credentials, nil do |value|
549
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
550
+ allowed.any? { |klass| klass === value }
551
+ end
552
+ config_attr :scope, nil, ::String, ::Array, nil
553
+ config_attr :lib_name, nil, ::String, nil
554
+ config_attr :lib_version, nil, ::String, nil
555
+ config_attr :timeout, nil, ::Numeric, nil
556
+ config_attr :metadata, nil, ::Hash, nil
557
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
558
+ config_attr :quota_project, nil, ::String, nil
559
+ config_attr :universe_domain, nil, ::String, nil
560
+
561
+ # @private
562
+ def initialize parent_config = nil
563
+ @parent_config = parent_config unless parent_config.nil?
564
+
565
+ yield self if block_given?
566
+ end
567
+
568
+ ##
569
+ # Configurations for individual RPCs
570
+ # @return [Rpcs]
571
+ #
572
+ def rpcs
573
+ @rpcs ||= begin
574
+ parent_rpcs = nil
575
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
576
+ Rpcs.new parent_rpcs
577
+ end
578
+ end
579
+
580
+ ##
581
+ # Configuration RPC class for the Operations API.
582
+ #
583
+ # Includes fields providing the configuration for each RPC in this service.
584
+ # Each configuration object is of type `Gapic::Config::Method` and includes
585
+ # the following configuration fields:
586
+ #
587
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
588
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
589
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
590
+ # include the following keys:
591
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
592
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
593
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
594
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
595
+ # trigger a retry.
596
+ #
597
+ class Rpcs
598
+ ##
599
+ # RPC-specific configuration for `list_operations`
600
+ # @return [::Gapic::Config::Method]
601
+ #
602
+ attr_reader :list_operations
603
+ ##
604
+ # RPC-specific configuration for `get_operation`
605
+ # @return [::Gapic::Config::Method]
606
+ #
607
+ attr_reader :get_operation
608
+ ##
609
+ # RPC-specific configuration for `delete_operation`
610
+ # @return [::Gapic::Config::Method]
611
+ #
612
+ attr_reader :delete_operation
613
+ ##
614
+ # RPC-specific configuration for `cancel_operation`
615
+ # @return [::Gapic::Config::Method]
616
+ #
617
+ attr_reader :cancel_operation
618
+
619
+ # @private
620
+ def initialize parent_rpcs = nil
621
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
622
+ @list_operations = ::Gapic::Config::Method.new list_operations_config
623
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
624
+ @get_operation = ::Gapic::Config::Method.new get_operation_config
625
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
626
+ @delete_operation = ::Gapic::Config::Method.new delete_operation_config
627
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
628
+ @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
629
+
630
+ yield self if block_given?
631
+ end
632
+ end
633
+ end
634
+ end
635
+
636
+ ##
637
+ # @private
638
+ # REST service stub for the Longrunning Operations API.
639
+ # Service stub contains baseline method implementations
640
+ # including transcoding, making the REST call, and deserialing the response.
641
+ class OperationsServiceStub
642
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
643
+ # These require statements are intentionally placed here to initialize
644
+ # the REST modules only when it's required.
645
+ require "gapic/rest"
646
+
647
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
648
+ endpoint_template: endpoint_template,
649
+ universe_domain: universe_domain,
650
+ credentials: credentials
651
+ end
652
+
653
+ ##
654
+ # Baseline implementation for the list_operations REST call
655
+ #
656
+ # @param request_pb [::Google::Longrunning::ListOperationsRequest]
657
+ # A request object representing the call parameters. Required.
658
+ # @param options [::Gapic::CallOptions]
659
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
660
+ #
661
+ # @yield [result, operation] Access the result along with the TransportOperation object
662
+ # @yieldparam result [::Google::Longrunning::ListOperationsResponse]
663
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
664
+ #
665
+ # @return [::Google::Longrunning::ListOperationsResponse]
666
+ # A result object deserialized from the server's reply
667
+ def list_operations request_pb, options = nil
668
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
669
+
670
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb
671
+ query_string_params = if query_string_params.any?
672
+ query_string_params.to_h { |p| p.split "=", 2 }
673
+ else
674
+ {}
675
+ end
676
+
677
+ response = @client_stub.make_http_request(
678
+ verb,
679
+ uri: uri,
680
+ body: body || "",
681
+ params: query_string_params,
682
+ options: options
683
+ )
684
+ operation = ::Gapic::Rest::TransportOperation.new response
685
+ result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
686
+
687
+ yield result, operation if block_given?
688
+ result
689
+ end
690
+
691
+ ##
692
+ # Baseline implementation for the get_operation REST call
693
+ #
694
+ # @param request_pb [::Google::Longrunning::GetOperationRequest]
695
+ # A request object representing the call parameters. Required.
696
+ # @param options [::Gapic::CallOptions]
697
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
698
+ #
699
+ # @yield [result, operation] Access the result along with the TransportOperation object
700
+ # @yieldparam result [::Google::Longrunning::Operation]
701
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
702
+ #
703
+ # @return [::Google::Longrunning::Operation]
704
+ # A result object deserialized from the server's reply
705
+ def get_operation request_pb, options = nil
706
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
707
+
708
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb
709
+ query_string_params = if query_string_params.any?
710
+ query_string_params.to_h { |p| p.split "=", 2 }
711
+ else
712
+ {}
713
+ end
714
+
715
+ response = @client_stub.make_http_request(
716
+ verb,
717
+ uri: uri,
718
+ body: body || "",
719
+ params: query_string_params,
720
+ options: options
721
+ )
722
+ operation = ::Gapic::Rest::TransportOperation.new response
723
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
724
+
725
+ yield result, operation if block_given?
726
+ result
727
+ end
728
+
729
+ ##
730
+ # Baseline implementation for the delete_operation REST call
731
+ #
732
+ # @param request_pb [::Google::Longrunning::DeleteOperationRequest]
733
+ # A request object representing the call parameters. Required.
734
+ # @param options [::Gapic::CallOptions]
735
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
736
+ #
737
+ # @yield [result, operation] Access the result along with the TransportOperation object
738
+ # @yieldparam result [::Google::Protobuf::Empty]
739
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
740
+ #
741
+ # @return [::Google::Protobuf::Empty]
742
+ # A result object deserialized from the server's reply
743
+ def delete_operation request_pb, options = nil
744
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
745
+
746
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb
747
+ query_string_params = if query_string_params.any?
748
+ query_string_params.to_h { |p| p.split "=", 2 }
749
+ else
750
+ {}
751
+ end
752
+
753
+ response = @client_stub.make_http_request(
754
+ verb,
755
+ uri: uri,
756
+ body: body || "",
757
+ params: query_string_params,
758
+ options: options
759
+ )
760
+ operation = ::Gapic::Rest::TransportOperation.new response
761
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
762
+
763
+ yield result, operation if block_given?
764
+ result
765
+ end
766
+
767
+ ##
768
+ # Baseline implementation for the cancel_operation REST call
769
+ #
770
+ # @param request_pb [::Google::Longrunning::CancelOperationRequest]
771
+ # A request object representing the call parameters. Required.
772
+ # @param options [::Gapic::CallOptions]
773
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
774
+ #
775
+ # @yield [result, operation] Access the result along with the TransportOperation object
776
+ # @yieldparam result [::Google::Protobuf::Empty]
777
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
778
+ #
779
+ # @return [::Google::Protobuf::Empty]
780
+ # A result object deserialized from the server's reply
781
+ def cancel_operation request_pb, options = nil
782
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
783
+
784
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb
785
+ query_string_params = if query_string_params.any?
786
+ query_string_params.to_h { |p| p.split "=", 2 }
787
+ else
788
+ {}
789
+ end
790
+
791
+ response = @client_stub.make_http_request(
792
+ verb,
793
+ uri: uri,
794
+ body: body || "",
795
+ params: query_string_params,
796
+ options: options
797
+ )
798
+ operation = ::Gapic::Rest::TransportOperation.new response
799
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
800
+
801
+ yield result, operation if block_given?
802
+ result
803
+ end
804
+
805
+ ##
806
+ # @private
807
+ #
808
+ # GRPC transcoding helper method for the list_operations REST call
809
+ #
810
+ # @param request_pb [::Google::Longrunning::ListOperationsRequest]
811
+ # A request object representing the call parameters. Required.
812
+ # @return [Array(String, [String, nil], Hash{String => String})]
813
+ # Uri, Body, Query string parameters
814
+ def self.transcode_list_operations_request request_pb
815
+ transcoder = Gapic::Rest::GrpcTranscoder.new
816
+ .with_bindings(
817
+ uri_method: :get,
818
+ uri_template: "/v1beta/{name}/operations",
819
+ matches: [
820
+ ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
821
+ ]
822
+ )
823
+ transcoder.transcode request_pb
824
+ end
825
+
826
+ ##
827
+ # @private
828
+ #
829
+ # GRPC transcoding helper method for the get_operation REST call
830
+ #
831
+ # @param request_pb [::Google::Longrunning::GetOperationRequest]
832
+ # A request object representing the call parameters. Required.
833
+ # @return [Array(String, [String, nil], Hash{String => String})]
834
+ # Uri, Body, Query string parameters
835
+ def self.transcode_get_operation_request request_pb
836
+ transcoder = Gapic::Rest::GrpcTranscoder.new
837
+ .with_bindings(
838
+ uri_method: :get,
839
+ uri_template: "/v1beta/{name}",
840
+ matches: [
841
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
842
+ ]
843
+ )
844
+ transcoder.transcode request_pb
845
+ end
846
+
847
+ ##
848
+ # @private
849
+ #
850
+ # GRPC transcoding helper method for the delete_operation REST call
851
+ #
852
+ # @param request_pb [::Google::Longrunning::DeleteOperationRequest]
853
+ # A request object representing the call parameters. Required.
854
+ # @return [Array(String, [String, nil], Hash{String => String})]
855
+ # Uri, Body, Query string parameters
856
+ def self.transcode_delete_operation_request request_pb
857
+ transcoder = Gapic::Rest::GrpcTranscoder.new
858
+ .with_bindings(
859
+ uri_method: :delete,
860
+ uri_template: "/v1beta/{name}",
861
+ matches: [
862
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
863
+ ]
864
+ )
865
+ transcoder.transcode request_pb
866
+ end
867
+
868
+ ##
869
+ # @private
870
+ #
871
+ # GRPC transcoding helper method for the cancel_operation REST call
872
+ #
873
+ # @param request_pb [::Google::Longrunning::CancelOperationRequest]
874
+ # A request object representing the call parameters. Required.
875
+ # @return [Array(String, [String, nil], Hash{String => String})]
876
+ # Uri, Body, Query string parameters
877
+ def self.transcode_cancel_operation_request request_pb
878
+ transcoder = Gapic::Rest::GrpcTranscoder.new
879
+ .with_bindings(
880
+ uri_method: :post,
881
+ uri_template: "/v1beta/{name}:cancel",
882
+ matches: [
883
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
884
+ ]
885
+ )
886
+ transcoder.transcode request_pb
887
+ end
888
+ end
889
+ end
890
+ end
891
+ end
892
+ end
893
+ end
894
+ end