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,982 @@
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 "google/cloud/errors"
20
+ require "google/cloud/memorystore/v1beta/memorystore_pb"
21
+ require "google/cloud/memorystore/v1beta/memorystore/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Memorystore
27
+ module V1beta
28
+ module Memorystore
29
+ module Rest
30
+ ##
31
+ # REST client for the Memorystore service.
32
+ #
33
+ # Service describing handlers for resources
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "memorystore.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :memorystore_stub
46
+
47
+ ##
48
+ # Configure the Memorystore Client class.
49
+ #
50
+ # See {::Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all Memorystore clients
56
+ # ::Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Cloud", "Memorystore", "V1beta"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.rpcs.list_instances.timeout = 60.0
77
+ default_config.rpcs.list_instances.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config.rpcs.get_instance.timeout = 60.0
82
+ default_config.rpcs.get_instance.retry_policy = {
83
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
84
+ }
85
+
86
+ default_config.rpcs.create_instance.timeout = 600.0
87
+
88
+ default_config.rpcs.update_instance.timeout = 600.0
89
+
90
+ default_config.rpcs.delete_instance.timeout = 600.0
91
+
92
+ default_config.rpcs.get_certificate_authority.timeout = 60.0
93
+ default_config.rpcs.get_certificate_authority.retry_policy = {
94
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
95
+ }
96
+
97
+ default_config
98
+ end
99
+ yield @configure if block_given?
100
+ @configure
101
+ end
102
+
103
+ ##
104
+ # Configure the Memorystore Client instance.
105
+ #
106
+ # The configuration is set to the derived mode, meaning that values can be changed,
107
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
108
+ # should be made on {Client.configure}.
109
+ #
110
+ # See {::Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client::Configuration}
111
+ # for a description of the configuration fields.
112
+ #
113
+ # @yield [config] Configure the Client client.
114
+ # @yieldparam config [Client::Configuration]
115
+ #
116
+ # @return [Client::Configuration]
117
+ #
118
+ def configure
119
+ yield @config if block_given?
120
+ @config
121
+ end
122
+
123
+ ##
124
+ # The effective universe domain
125
+ #
126
+ # @return [String]
127
+ #
128
+ def universe_domain
129
+ @memorystore_stub.universe_domain
130
+ end
131
+
132
+ ##
133
+ # Create a new Memorystore REST client object.
134
+ #
135
+ # @example
136
+ #
137
+ # # Create a client using the default configuration
138
+ # client = ::Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client.new
139
+ #
140
+ # # Create a client using a custom configuration
141
+ # client = ::Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client.new do |config|
142
+ # config.timeout = 10.0
143
+ # end
144
+ #
145
+ # @yield [config] Configure the Memorystore client.
146
+ # @yieldparam config [Client::Configuration]
147
+ #
148
+ def initialize
149
+ # Create the configuration object
150
+ @config = Configuration.new Client.configure
151
+
152
+ # Yield the configuration if needed
153
+ yield @config if block_given?
154
+
155
+ # Create credentials
156
+ credentials = @config.credentials
157
+ # Use self-signed JWT if the endpoint is unchanged from default,
158
+ # but only if the default endpoint does not have a region prefix.
159
+ enable_self_signed_jwt = @config.endpoint.nil? ||
160
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
161
+ !@config.endpoint.split(".").first.include?("-"))
162
+ credentials ||= Credentials.default scope: @config.scope,
163
+ enable_self_signed_jwt: enable_self_signed_jwt
164
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
165
+ credentials = Credentials.new credentials, scope: @config.scope
166
+ end
167
+
168
+ @quota_project_id = @config.quota_project
169
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
170
+
171
+ @operations_client = ::Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Operations.new do |config|
172
+ config.credentials = credentials
173
+ config.quota_project = @quota_project_id
174
+ config.endpoint = @config.endpoint
175
+ config.universe_domain = @config.universe_domain
176
+ end
177
+
178
+ @memorystore_stub = ::Google::Cloud::Memorystore::V1beta::Memorystore::Rest::ServiceStub.new(
179
+ endpoint: @config.endpoint,
180
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
181
+ universe_domain: @config.universe_domain,
182
+ credentials: credentials
183
+ )
184
+
185
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
186
+ config.credentials = credentials
187
+ config.quota_project = @quota_project_id
188
+ config.endpoint = @memorystore_stub.endpoint
189
+ config.universe_domain = @memorystore_stub.universe_domain
190
+ config.bindings_override = @config.bindings_override
191
+ end
192
+ end
193
+
194
+ ##
195
+ # Get the associated client for long-running operations.
196
+ #
197
+ # @return [::Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Operations]
198
+ #
199
+ attr_reader :operations_client
200
+
201
+ ##
202
+ # Get the associated client for mix-in of the Locations.
203
+ #
204
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
205
+ #
206
+ attr_reader :location_client
207
+
208
+ # Service calls
209
+
210
+ ##
211
+ # Lists Instances in a given project and location.
212
+ #
213
+ # @overload list_instances(request, options = nil)
214
+ # Pass arguments to `list_instances` via a request object, either of type
215
+ # {::Google::Cloud::Memorystore::V1beta::ListInstancesRequest} or an equivalent Hash.
216
+ #
217
+ # @param request [::Google::Cloud::Memorystore::V1beta::ListInstancesRequest, ::Hash]
218
+ # A request object representing the call parameters. Required. To specify no
219
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
220
+ # @param options [::Gapic::CallOptions, ::Hash]
221
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
222
+ #
223
+ # @overload list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
224
+ # Pass arguments to `list_instances` via keyword arguments. Note that at
225
+ # least one keyword argument is required. To specify no parameters, or to keep all
226
+ # the default parameter values, pass an empty Hash as a request object (see above).
227
+ #
228
+ # @param parent [::String]
229
+ # Required. The parent to list instances from.
230
+ # Format: projects/\\{project}/locations/\\{location}
231
+ # @param page_size [::Integer]
232
+ # Optional. Requested page size. Server may return fewer items than
233
+ # requested. If unspecified, server will pick an appropriate default.
234
+ # @param page_token [::String]
235
+ # Optional. A token identifying a page of results the server should return.
236
+ # @param filter [::String]
237
+ # Optional. Expression for filtering results.
238
+ # @param order_by [::String]
239
+ # Optional. Sort results by a defined order. Supported values: "name",
240
+ # "create_time".
241
+ # @yield [result, operation] Access the result along with the TransportOperation object
242
+ # @yieldparam result [::Google::Cloud::Memorystore::V1beta::ListInstancesResponse]
243
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
244
+ #
245
+ # @return [::Google::Cloud::Memorystore::V1beta::ListInstancesResponse]
246
+ #
247
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
248
+ #
249
+ # @example Basic example
250
+ # require "google/cloud/memorystore/v1beta"
251
+ #
252
+ # # Create a client object. The client can be reused for multiple calls.
253
+ # client = Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client.new
254
+ #
255
+ # # Create a request. To set request fields, pass in keyword arguments.
256
+ # request = Google::Cloud::Memorystore::V1beta::ListInstancesRequest.new
257
+ #
258
+ # # Call the list_instances method.
259
+ # result = client.list_instances request
260
+ #
261
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
262
+ # # over elements, and API calls will be issued to fetch pages as needed.
263
+ # result.each do |item|
264
+ # # Each element is of type ::Google::Cloud::Memorystore::V1beta::Instance.
265
+ # p item
266
+ # end
267
+ #
268
+ def list_instances request, options = nil
269
+ raise ::ArgumentError, "request must be provided" if request.nil?
270
+
271
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1beta::ListInstancesRequest
272
+
273
+ # Converts hash and nil to an options object
274
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
275
+
276
+ # Customize the options with defaults
277
+ call_metadata = @config.rpcs.list_instances.metadata.to_h
278
+
279
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
280
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
281
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
282
+ gapic_version: ::Google::Cloud::Memorystore::V1beta::VERSION,
283
+ transports_version_send: [:rest]
284
+
285
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
286
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
287
+
288
+ options.apply_defaults timeout: @config.rpcs.list_instances.timeout,
289
+ metadata: call_metadata,
290
+ retry_policy: @config.rpcs.list_instances.retry_policy
291
+
292
+ options.apply_defaults timeout: @config.timeout,
293
+ metadata: @config.metadata,
294
+ retry_policy: @config.retry_policy
295
+
296
+ @memorystore_stub.list_instances request, options do |result, operation|
297
+ yield result, operation if block_given?
298
+ return result
299
+ end
300
+ rescue ::Gapic::Rest::Error => e
301
+ raise ::Google::Cloud::Error.from_error(e)
302
+ end
303
+
304
+ ##
305
+ # Gets details of a single Instance.
306
+ #
307
+ # @overload get_instance(request, options = nil)
308
+ # Pass arguments to `get_instance` via a request object, either of type
309
+ # {::Google::Cloud::Memorystore::V1beta::GetInstanceRequest} or an equivalent Hash.
310
+ #
311
+ # @param request [::Google::Cloud::Memorystore::V1beta::GetInstanceRequest, ::Hash]
312
+ # A request object representing the call parameters. Required. To specify no
313
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
314
+ # @param options [::Gapic::CallOptions, ::Hash]
315
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
316
+ #
317
+ # @overload get_instance(name: nil)
318
+ # Pass arguments to `get_instance` via keyword arguments. Note that at
319
+ # least one keyword argument is required. To specify no parameters, or to keep all
320
+ # the default parameter values, pass an empty Hash as a request object (see above).
321
+ #
322
+ # @param name [::String]
323
+ # Required. The name of the instance to retrieve.
324
+ # Format: projects/\\{project}/locations/\\{location}/instances/\\{instance}
325
+ # @yield [result, operation] Access the result along with the TransportOperation object
326
+ # @yieldparam result [::Google::Cloud::Memorystore::V1beta::Instance]
327
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
328
+ #
329
+ # @return [::Google::Cloud::Memorystore::V1beta::Instance]
330
+ #
331
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
332
+ #
333
+ # @example Basic example
334
+ # require "google/cloud/memorystore/v1beta"
335
+ #
336
+ # # Create a client object. The client can be reused for multiple calls.
337
+ # client = Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client.new
338
+ #
339
+ # # Create a request. To set request fields, pass in keyword arguments.
340
+ # request = Google::Cloud::Memorystore::V1beta::GetInstanceRequest.new
341
+ #
342
+ # # Call the get_instance method.
343
+ # result = client.get_instance request
344
+ #
345
+ # # The returned object is of type Google::Cloud::Memorystore::V1beta::Instance.
346
+ # p result
347
+ #
348
+ def get_instance request, options = nil
349
+ raise ::ArgumentError, "request must be provided" if request.nil?
350
+
351
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1beta::GetInstanceRequest
352
+
353
+ # Converts hash and nil to an options object
354
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
355
+
356
+ # Customize the options with defaults
357
+ call_metadata = @config.rpcs.get_instance.metadata.to_h
358
+
359
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
360
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
361
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
362
+ gapic_version: ::Google::Cloud::Memorystore::V1beta::VERSION,
363
+ transports_version_send: [:rest]
364
+
365
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
366
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
367
+
368
+ options.apply_defaults timeout: @config.rpcs.get_instance.timeout,
369
+ metadata: call_metadata,
370
+ retry_policy: @config.rpcs.get_instance.retry_policy
371
+
372
+ options.apply_defaults timeout: @config.timeout,
373
+ metadata: @config.metadata,
374
+ retry_policy: @config.retry_policy
375
+
376
+ @memorystore_stub.get_instance request, options do |result, operation|
377
+ yield result, operation if block_given?
378
+ return result
379
+ end
380
+ rescue ::Gapic::Rest::Error => e
381
+ raise ::Google::Cloud::Error.from_error(e)
382
+ end
383
+
384
+ ##
385
+ # Creates a new Instance in a given project and location.
386
+ #
387
+ # @overload create_instance(request, options = nil)
388
+ # Pass arguments to `create_instance` via a request object, either of type
389
+ # {::Google::Cloud::Memorystore::V1beta::CreateInstanceRequest} or an equivalent Hash.
390
+ #
391
+ # @param request [::Google::Cloud::Memorystore::V1beta::CreateInstanceRequest, ::Hash]
392
+ # A request object representing the call parameters. Required. To specify no
393
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
394
+ # @param options [::Gapic::CallOptions, ::Hash]
395
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
396
+ #
397
+ # @overload create_instance(parent: nil, instance_id: nil, instance: nil, request_id: nil)
398
+ # Pass arguments to `create_instance` via keyword arguments. Note that at
399
+ # least one keyword argument is required. To specify no parameters, or to keep all
400
+ # the default parameter values, pass an empty Hash as a request object (see above).
401
+ #
402
+ # @param parent [::String]
403
+ # Required. The parent resource where this instance will be created.
404
+ # Format: projects/\\{project}/locations/\\{location}
405
+ # @param instance_id [::String]
406
+ # Required. The ID to use for the instance, which will become the final
407
+ # component of the instance's resource name.
408
+ #
409
+ # This value is subject to the following restrictions:
410
+ #
411
+ # * Must be 4-63 characters in length
412
+ # * Must begin with a letter or digit
413
+ # * Must contain only lowercase letters, digits, and hyphens
414
+ # * Must not end with a hyphen
415
+ # * Must be unique within a location
416
+ # @param instance [::Google::Cloud::Memorystore::V1beta::Instance, ::Hash]
417
+ # Required. The instance to create.
418
+ # @param request_id [::String]
419
+ # Optional. An optional request ID to identify requests. Specify a unique
420
+ # request ID so that if you must retry your request, the server will know to
421
+ # ignore the request if it has already been completed. The server will
422
+ # guarantee that for at least 60 minutes since the first request.
423
+ #
424
+ # For example, consider a situation where you make an initial request and the
425
+ # request times out. If you make the request again with the same request
426
+ # ID, the server can check if original operation with the same request ID
427
+ # was received, and if so, will ignore the second request. This prevents
428
+ # clients from accidentally creating duplicate commitments.
429
+ #
430
+ # The request ID must be a valid UUID with the exception that zero UUID is
431
+ # not supported (00000000-0000-0000-0000-000000000000).
432
+ # @yield [result, operation] Access the result along with the TransportOperation object
433
+ # @yieldparam result [::Gapic::Operation]
434
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
435
+ #
436
+ # @return [::Gapic::Operation]
437
+ #
438
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
439
+ #
440
+ # @example Basic example
441
+ # require "google/cloud/memorystore/v1beta"
442
+ #
443
+ # # Create a client object. The client can be reused for multiple calls.
444
+ # client = Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client.new
445
+ #
446
+ # # Create a request. To set request fields, pass in keyword arguments.
447
+ # request = Google::Cloud::Memorystore::V1beta::CreateInstanceRequest.new
448
+ #
449
+ # # Call the create_instance method.
450
+ # result = client.create_instance request
451
+ #
452
+ # # The returned object is of type Gapic::Operation. You can use it to
453
+ # # check the status of an operation, cancel it, or wait for results.
454
+ # # Here is how to wait for a response.
455
+ # result.wait_until_done! timeout: 60
456
+ # if result.response?
457
+ # p result.response
458
+ # else
459
+ # puts "No response received."
460
+ # end
461
+ #
462
+ def create_instance request, options = nil
463
+ raise ::ArgumentError, "request must be provided" if request.nil?
464
+
465
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1beta::CreateInstanceRequest
466
+
467
+ # Converts hash and nil to an options object
468
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
469
+
470
+ # Customize the options with defaults
471
+ call_metadata = @config.rpcs.create_instance.metadata.to_h
472
+
473
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
474
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
475
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
476
+ gapic_version: ::Google::Cloud::Memorystore::V1beta::VERSION,
477
+ transports_version_send: [:rest]
478
+
479
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
480
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
481
+
482
+ options.apply_defaults timeout: @config.rpcs.create_instance.timeout,
483
+ metadata: call_metadata,
484
+ retry_policy: @config.rpcs.create_instance.retry_policy
485
+
486
+ options.apply_defaults timeout: @config.timeout,
487
+ metadata: @config.metadata,
488
+ retry_policy: @config.retry_policy
489
+
490
+ @memorystore_stub.create_instance request, options do |result, operation|
491
+ result = ::Gapic::Operation.new result, @operations_client, options: options
492
+ yield result, operation if block_given?
493
+ return result
494
+ end
495
+ rescue ::Gapic::Rest::Error => e
496
+ raise ::Google::Cloud::Error.from_error(e)
497
+ end
498
+
499
+ ##
500
+ # Updates the parameters of a single Instance.
501
+ #
502
+ # @overload update_instance(request, options = nil)
503
+ # Pass arguments to `update_instance` via a request object, either of type
504
+ # {::Google::Cloud::Memorystore::V1beta::UpdateInstanceRequest} or an equivalent Hash.
505
+ #
506
+ # @param request [::Google::Cloud::Memorystore::V1beta::UpdateInstanceRequest, ::Hash]
507
+ # A request object representing the call parameters. Required. To specify no
508
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
509
+ # @param options [::Gapic::CallOptions, ::Hash]
510
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
511
+ #
512
+ # @overload update_instance(update_mask: nil, instance: nil, request_id: nil)
513
+ # Pass arguments to `update_instance` via keyword arguments. Note that at
514
+ # least one keyword argument is required. To specify no parameters, or to keep all
515
+ # the default parameter values, pass an empty Hash as a request object (see above).
516
+ #
517
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
518
+ # Optional. The list of fields to be updated on the instance. At least one
519
+ # field must be specified.
520
+ # @param instance [::Google::Cloud::Memorystore::V1beta::Instance, ::Hash]
521
+ # Required. The instance to update.
522
+ # @param request_id [::String]
523
+ # Optional. An optional request ID to identify requests. Specify a unique
524
+ # request ID so that if you must retry your request, the server will know to
525
+ # ignore the request if it has already been completed. The server will
526
+ # guarantee that for at least 60 minutes since the first request.
527
+ #
528
+ # For example, consider a situation where you make an initial request and the
529
+ # request times out. If you make the request again with the same request
530
+ # ID, the server can check if original operation with the same request ID
531
+ # was received, and if so, will ignore the second request. This prevents
532
+ # clients from accidentally creating duplicate commitments.
533
+ #
534
+ # The request ID must be a valid UUID with the exception that zero UUID is
535
+ # not supported (00000000-0000-0000-0000-000000000000).
536
+ # @yield [result, operation] Access the result along with the TransportOperation object
537
+ # @yieldparam result [::Gapic::Operation]
538
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
539
+ #
540
+ # @return [::Gapic::Operation]
541
+ #
542
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
543
+ #
544
+ # @example Basic example
545
+ # require "google/cloud/memorystore/v1beta"
546
+ #
547
+ # # Create a client object. The client can be reused for multiple calls.
548
+ # client = Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client.new
549
+ #
550
+ # # Create a request. To set request fields, pass in keyword arguments.
551
+ # request = Google::Cloud::Memorystore::V1beta::UpdateInstanceRequest.new
552
+ #
553
+ # # Call the update_instance method.
554
+ # result = client.update_instance request
555
+ #
556
+ # # The returned object is of type Gapic::Operation. You can use it to
557
+ # # check the status of an operation, cancel it, or wait for results.
558
+ # # Here is how to wait for a response.
559
+ # result.wait_until_done! timeout: 60
560
+ # if result.response?
561
+ # p result.response
562
+ # else
563
+ # puts "No response received."
564
+ # end
565
+ #
566
+ def update_instance request, options = nil
567
+ raise ::ArgumentError, "request must be provided" if request.nil?
568
+
569
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1beta::UpdateInstanceRequest
570
+
571
+ # Converts hash and nil to an options object
572
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
573
+
574
+ # Customize the options with defaults
575
+ call_metadata = @config.rpcs.update_instance.metadata.to_h
576
+
577
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
578
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
579
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
580
+ gapic_version: ::Google::Cloud::Memorystore::V1beta::VERSION,
581
+ transports_version_send: [:rest]
582
+
583
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
584
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
585
+
586
+ options.apply_defaults timeout: @config.rpcs.update_instance.timeout,
587
+ metadata: call_metadata,
588
+ retry_policy: @config.rpcs.update_instance.retry_policy
589
+
590
+ options.apply_defaults timeout: @config.timeout,
591
+ metadata: @config.metadata,
592
+ retry_policy: @config.retry_policy
593
+
594
+ @memorystore_stub.update_instance request, options do |result, operation|
595
+ result = ::Gapic::Operation.new result, @operations_client, options: options
596
+ yield result, operation if block_given?
597
+ return result
598
+ end
599
+ rescue ::Gapic::Rest::Error => e
600
+ raise ::Google::Cloud::Error.from_error(e)
601
+ end
602
+
603
+ ##
604
+ # Deletes a single Instance.
605
+ #
606
+ # @overload delete_instance(request, options = nil)
607
+ # Pass arguments to `delete_instance` via a request object, either of type
608
+ # {::Google::Cloud::Memorystore::V1beta::DeleteInstanceRequest} or an equivalent Hash.
609
+ #
610
+ # @param request [::Google::Cloud::Memorystore::V1beta::DeleteInstanceRequest, ::Hash]
611
+ # A request object representing the call parameters. Required. To specify no
612
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
613
+ # @param options [::Gapic::CallOptions, ::Hash]
614
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
615
+ #
616
+ # @overload delete_instance(name: nil, request_id: nil)
617
+ # Pass arguments to `delete_instance` via keyword arguments. Note that at
618
+ # least one keyword argument is required. To specify no parameters, or to keep all
619
+ # the default parameter values, pass an empty Hash as a request object (see above).
620
+ #
621
+ # @param name [::String]
622
+ # Required. The name of the instance to delete.
623
+ # Format: projects/\\{project}/locations/\\{location}/instances/\\{instance}
624
+ # @param request_id [::String]
625
+ # Optional. An optional request ID to identify requests. Specify a unique
626
+ # request ID so that if you must retry your request, the server will know to
627
+ # ignore the request if it has already been completed. The server will
628
+ # guarantee that for at least 60 minutes after the first request.
629
+ #
630
+ # For example, consider a situation where you make an initial request and the
631
+ # request times out. If you make the request again with the same request
632
+ # ID, the server can check if original operation with the same request ID
633
+ # was received, and if so, will ignore the second request. This prevents
634
+ # clients from accidentally creating duplicate commitments.
635
+ #
636
+ # The request ID must be a valid UUID with the exception that zero UUID is
637
+ # not supported (00000000-0000-0000-0000-000000000000).
638
+ # @yield [result, operation] Access the result along with the TransportOperation object
639
+ # @yieldparam result [::Gapic::Operation]
640
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
641
+ #
642
+ # @return [::Gapic::Operation]
643
+ #
644
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
645
+ #
646
+ # @example Basic example
647
+ # require "google/cloud/memorystore/v1beta"
648
+ #
649
+ # # Create a client object. The client can be reused for multiple calls.
650
+ # client = Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client.new
651
+ #
652
+ # # Create a request. To set request fields, pass in keyword arguments.
653
+ # request = Google::Cloud::Memorystore::V1beta::DeleteInstanceRequest.new
654
+ #
655
+ # # Call the delete_instance method.
656
+ # result = client.delete_instance request
657
+ #
658
+ # # The returned object is of type Gapic::Operation. You can use it to
659
+ # # check the status of an operation, cancel it, or wait for results.
660
+ # # Here is how to wait for a response.
661
+ # result.wait_until_done! timeout: 60
662
+ # if result.response?
663
+ # p result.response
664
+ # else
665
+ # puts "No response received."
666
+ # end
667
+ #
668
+ def delete_instance request, options = nil
669
+ raise ::ArgumentError, "request must be provided" if request.nil?
670
+
671
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1beta::DeleteInstanceRequest
672
+
673
+ # Converts hash and nil to an options object
674
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
675
+
676
+ # Customize the options with defaults
677
+ call_metadata = @config.rpcs.delete_instance.metadata.to_h
678
+
679
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
680
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
681
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
682
+ gapic_version: ::Google::Cloud::Memorystore::V1beta::VERSION,
683
+ transports_version_send: [:rest]
684
+
685
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
686
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
687
+
688
+ options.apply_defaults timeout: @config.rpcs.delete_instance.timeout,
689
+ metadata: call_metadata,
690
+ retry_policy: @config.rpcs.delete_instance.retry_policy
691
+
692
+ options.apply_defaults timeout: @config.timeout,
693
+ metadata: @config.metadata,
694
+ retry_policy: @config.retry_policy
695
+
696
+ @memorystore_stub.delete_instance request, options do |result, operation|
697
+ result = ::Gapic::Operation.new result, @operations_client, options: options
698
+ yield result, operation if block_given?
699
+ return result
700
+ end
701
+ rescue ::Gapic::Rest::Error => e
702
+ raise ::Google::Cloud::Error.from_error(e)
703
+ end
704
+
705
+ ##
706
+ # Gets details about the certificate authority for an Instance.
707
+ #
708
+ # @overload get_certificate_authority(request, options = nil)
709
+ # Pass arguments to `get_certificate_authority` via a request object, either of type
710
+ # {::Google::Cloud::Memorystore::V1beta::GetCertificateAuthorityRequest} or an equivalent Hash.
711
+ #
712
+ # @param request [::Google::Cloud::Memorystore::V1beta::GetCertificateAuthorityRequest, ::Hash]
713
+ # A request object representing the call parameters. Required. To specify no
714
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
715
+ # @param options [::Gapic::CallOptions, ::Hash]
716
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
717
+ #
718
+ # @overload get_certificate_authority(name: nil)
719
+ # Pass arguments to `get_certificate_authority` via keyword arguments. Note that at
720
+ # least one keyword argument is required. To specify no parameters, or to keep all
721
+ # the default parameter values, pass an empty Hash as a request object (see above).
722
+ #
723
+ # @param name [::String]
724
+ # Required. The name of the certificate authority.
725
+ # Format:
726
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}/certificateAuthority
727
+ # @yield [result, operation] Access the result along with the TransportOperation object
728
+ # @yieldparam result [::Google::Cloud::Memorystore::V1beta::CertificateAuthority]
729
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
730
+ #
731
+ # @return [::Google::Cloud::Memorystore::V1beta::CertificateAuthority]
732
+ #
733
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
734
+ #
735
+ # @example Basic example
736
+ # require "google/cloud/memorystore/v1beta"
737
+ #
738
+ # # Create a client object. The client can be reused for multiple calls.
739
+ # client = Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client.new
740
+ #
741
+ # # Create a request. To set request fields, pass in keyword arguments.
742
+ # request = Google::Cloud::Memorystore::V1beta::GetCertificateAuthorityRequest.new
743
+ #
744
+ # # Call the get_certificate_authority method.
745
+ # result = client.get_certificate_authority request
746
+ #
747
+ # # The returned object is of type Google::Cloud::Memorystore::V1beta::CertificateAuthority.
748
+ # p result
749
+ #
750
+ def get_certificate_authority request, options = nil
751
+ raise ::ArgumentError, "request must be provided" if request.nil?
752
+
753
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1beta::GetCertificateAuthorityRequest
754
+
755
+ # Converts hash and nil to an options object
756
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
757
+
758
+ # Customize the options with defaults
759
+ call_metadata = @config.rpcs.get_certificate_authority.metadata.to_h
760
+
761
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
762
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
763
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
764
+ gapic_version: ::Google::Cloud::Memorystore::V1beta::VERSION,
765
+ transports_version_send: [:rest]
766
+
767
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
768
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
769
+
770
+ options.apply_defaults timeout: @config.rpcs.get_certificate_authority.timeout,
771
+ metadata: call_metadata,
772
+ retry_policy: @config.rpcs.get_certificate_authority.retry_policy
773
+
774
+ options.apply_defaults timeout: @config.timeout,
775
+ metadata: @config.metadata,
776
+ retry_policy: @config.retry_policy
777
+
778
+ @memorystore_stub.get_certificate_authority request, options do |result, operation|
779
+ yield result, operation if block_given?
780
+ return result
781
+ end
782
+ rescue ::Gapic::Rest::Error => e
783
+ raise ::Google::Cloud::Error.from_error(e)
784
+ end
785
+
786
+ ##
787
+ # Configuration class for the Memorystore REST API.
788
+ #
789
+ # This class represents the configuration for Memorystore REST,
790
+ # providing control over timeouts, retry behavior, logging, transport
791
+ # parameters, and other low-level controls. Certain parameters can also be
792
+ # applied individually to specific RPCs. See
793
+ # {::Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client::Configuration::Rpcs}
794
+ # for a list of RPCs that can be configured independently.
795
+ #
796
+ # Configuration can be applied globally to all clients, or to a single client
797
+ # on construction.
798
+ #
799
+ # @example
800
+ #
801
+ # # Modify the global config, setting the timeout for
802
+ # # list_instances to 20 seconds,
803
+ # # and all remaining timeouts to 10 seconds.
804
+ # ::Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client.configure do |config|
805
+ # config.timeout = 10.0
806
+ # config.rpcs.list_instances.timeout = 20.0
807
+ # end
808
+ #
809
+ # # Apply the above configuration only to a new client.
810
+ # client = ::Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client.new do |config|
811
+ # config.timeout = 10.0
812
+ # config.rpcs.list_instances.timeout = 20.0
813
+ # end
814
+ #
815
+ # @!attribute [rw] endpoint
816
+ # A custom service endpoint, as a hostname or hostname:port. The default is
817
+ # nil, indicating to use the default endpoint in the current universe domain.
818
+ # @return [::String,nil]
819
+ # @!attribute [rw] credentials
820
+ # Credentials to send with calls. You may provide any of the following types:
821
+ # * (`String`) The path to a service account key file in JSON format
822
+ # * (`Hash`) A service account key as a Hash
823
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
824
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
825
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
826
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
827
+ # * (`nil`) indicating no credentials
828
+ # @return [::Object]
829
+ # @!attribute [rw] scope
830
+ # The OAuth scopes
831
+ # @return [::Array<::String>]
832
+ # @!attribute [rw] lib_name
833
+ # The library name as recorded in instrumentation and logging
834
+ # @return [::String]
835
+ # @!attribute [rw] lib_version
836
+ # The library version as recorded in instrumentation and logging
837
+ # @return [::String]
838
+ # @!attribute [rw] timeout
839
+ # The call timeout in seconds.
840
+ # @return [::Numeric]
841
+ # @!attribute [rw] metadata
842
+ # Additional headers to be sent with the call.
843
+ # @return [::Hash{::Symbol=>::String}]
844
+ # @!attribute [rw] retry_policy
845
+ # The retry policy. The value is a hash with the following keys:
846
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
847
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
848
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
849
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
850
+ # trigger a retry.
851
+ # @return [::Hash]
852
+ # @!attribute [rw] quota_project
853
+ # A separate project against which to charge quota.
854
+ # @return [::String]
855
+ # @!attribute [rw] universe_domain
856
+ # The universe domain within which to make requests. This determines the
857
+ # default endpoint URL. The default value of nil uses the environment
858
+ # universe (usually the default "googleapis.com" universe).
859
+ # @return [::String,nil]
860
+ #
861
+ class Configuration
862
+ extend ::Gapic::Config
863
+
864
+ # @private
865
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
866
+ DEFAULT_ENDPOINT = "memorystore.googleapis.com"
867
+
868
+ config_attr :endpoint, nil, ::String, nil
869
+ config_attr :credentials, nil do |value|
870
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
871
+ allowed.any? { |klass| klass === value }
872
+ end
873
+ config_attr :scope, nil, ::String, ::Array, nil
874
+ config_attr :lib_name, nil, ::String, nil
875
+ config_attr :lib_version, nil, ::String, nil
876
+ config_attr :timeout, nil, ::Numeric, nil
877
+ config_attr :metadata, nil, ::Hash, nil
878
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
879
+ config_attr :quota_project, nil, ::String, nil
880
+ config_attr :universe_domain, nil, ::String, nil
881
+
882
+ # @private
883
+ # Overrides for http bindings for the RPCs of this service
884
+ # are only used when this service is used as mixin, and only
885
+ # by the host service.
886
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
887
+ config_attr :bindings_override, {}, ::Hash, nil
888
+
889
+ # @private
890
+ def initialize parent_config = nil
891
+ @parent_config = parent_config unless parent_config.nil?
892
+
893
+ yield self if block_given?
894
+ end
895
+
896
+ ##
897
+ # Configurations for individual RPCs
898
+ # @return [Rpcs]
899
+ #
900
+ def rpcs
901
+ @rpcs ||= begin
902
+ parent_rpcs = nil
903
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
904
+ Rpcs.new parent_rpcs
905
+ end
906
+ end
907
+
908
+ ##
909
+ # Configuration RPC class for the Memorystore API.
910
+ #
911
+ # Includes fields providing the configuration for each RPC in this service.
912
+ # Each configuration object is of type `Gapic::Config::Method` and includes
913
+ # the following configuration fields:
914
+ #
915
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
916
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
917
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
918
+ # include the following keys:
919
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
920
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
921
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
922
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
923
+ # trigger a retry.
924
+ #
925
+ class Rpcs
926
+ ##
927
+ # RPC-specific configuration for `list_instances`
928
+ # @return [::Gapic::Config::Method]
929
+ #
930
+ attr_reader :list_instances
931
+ ##
932
+ # RPC-specific configuration for `get_instance`
933
+ # @return [::Gapic::Config::Method]
934
+ #
935
+ attr_reader :get_instance
936
+ ##
937
+ # RPC-specific configuration for `create_instance`
938
+ # @return [::Gapic::Config::Method]
939
+ #
940
+ attr_reader :create_instance
941
+ ##
942
+ # RPC-specific configuration for `update_instance`
943
+ # @return [::Gapic::Config::Method]
944
+ #
945
+ attr_reader :update_instance
946
+ ##
947
+ # RPC-specific configuration for `delete_instance`
948
+ # @return [::Gapic::Config::Method]
949
+ #
950
+ attr_reader :delete_instance
951
+ ##
952
+ # RPC-specific configuration for `get_certificate_authority`
953
+ # @return [::Gapic::Config::Method]
954
+ #
955
+ attr_reader :get_certificate_authority
956
+
957
+ # @private
958
+ def initialize parent_rpcs = nil
959
+ list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
960
+ @list_instances = ::Gapic::Config::Method.new list_instances_config
961
+ get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
962
+ @get_instance = ::Gapic::Config::Method.new get_instance_config
963
+ create_instance_config = parent_rpcs.create_instance if parent_rpcs.respond_to? :create_instance
964
+ @create_instance = ::Gapic::Config::Method.new create_instance_config
965
+ update_instance_config = parent_rpcs.update_instance if parent_rpcs.respond_to? :update_instance
966
+ @update_instance = ::Gapic::Config::Method.new update_instance_config
967
+ delete_instance_config = parent_rpcs.delete_instance if parent_rpcs.respond_to? :delete_instance
968
+ @delete_instance = ::Gapic::Config::Method.new delete_instance_config
969
+ get_certificate_authority_config = parent_rpcs.get_certificate_authority if parent_rpcs.respond_to? :get_certificate_authority
970
+ @get_certificate_authority = ::Gapic::Config::Method.new get_certificate_authority_config
971
+
972
+ yield self if block_given?
973
+ end
974
+ end
975
+ end
976
+ end
977
+ end
978
+ end
979
+ end
980
+ end
981
+ end
982
+ end