google-cloud-redis-v1 0.7.0 → 0.9.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.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/README.md +12 -7
- data/lib/google/cloud/redis/v1/cloud_redis/client.rb +36 -38
- data/lib/google/cloud/redis/v1/cloud_redis/operations.rb +15 -14
- data/lib/google/cloud/redis/v1/cloud_redis/rest/client.rb +1200 -0
- data/lib/google/cloud/redis/v1/cloud_redis/rest/operations.rb +792 -0
- data/lib/google/cloud/redis/v1/cloud_redis/rest/service_stub.rb +704 -0
- data/lib/google/cloud/redis/v1/cloud_redis/rest.rb +67 -0
- data/lib/google/cloud/redis/v1/cloud_redis.rb +7 -1
- data/lib/google/cloud/redis/v1/cloud_redis_pb.rb +2 -1
- data/lib/google/cloud/redis/v1/rest.rb +37 -0
- data/lib/google/cloud/redis/v1/version.rb +1 -1
- data/lib/google/cloud/redis/v1.rb +7 -2
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/protobuf/any.rb +3 -3
- data/proto_docs/google/protobuf/empty.rb +0 -2
- data/proto_docs/google/rpc/status.rb +4 -2
- metadata +20 -13
@@ -0,0 +1,1200 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/redis/v1/cloud_redis_pb"
|
21
|
+
require "google/cloud/redis/v1/cloud_redis/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Redis
|
26
|
+
module V1
|
27
|
+
module CloudRedis
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the CloudRedis service.
|
31
|
+
#
|
32
|
+
# Configures and manages Cloud Memorystore for Redis instances
|
33
|
+
#
|
34
|
+
# Google Cloud Memorystore for Redis v1
|
35
|
+
#
|
36
|
+
# The `redis.googleapis.com` service implements the Google Cloud Memorystore
|
37
|
+
# for Redis API and defines the following resource model for managing Redis
|
38
|
+
# instances:
|
39
|
+
# * The service works with a collection of cloud projects, named: `/projects/*`
|
40
|
+
# * Each project has a collection of available locations, named: `/locations/*`
|
41
|
+
# * Each location has a collection of Redis instances, named: `/instances/*`
|
42
|
+
# * As such, Redis instances are resources of the form:
|
43
|
+
# `/projects/{project_id}/locations/{location_id}/instances/{instance_id}`
|
44
|
+
#
|
45
|
+
# Note that location_id must be referring to a GCP `region`; for example:
|
46
|
+
# * `projects/redpepper-1290/locations/us-central1/instances/my-redis`
|
47
|
+
#
|
48
|
+
class Client
|
49
|
+
include Paths
|
50
|
+
|
51
|
+
# @private
|
52
|
+
attr_reader :cloud_redis_stub
|
53
|
+
|
54
|
+
##
|
55
|
+
# Configure the CloudRedis Client class.
|
56
|
+
#
|
57
|
+
# See {::Google::Cloud::Redis::V1::CloudRedis::Rest::Client::Configuration}
|
58
|
+
# for a description of the configuration fields.
|
59
|
+
#
|
60
|
+
# @example
|
61
|
+
#
|
62
|
+
# # Modify the configuration for all CloudRedis clients
|
63
|
+
# ::Google::Cloud::Redis::V1::CloudRedis::Rest::Client.configure do |config|
|
64
|
+
# config.timeout = 10.0
|
65
|
+
# end
|
66
|
+
#
|
67
|
+
# @yield [config] Configure the Client client.
|
68
|
+
# @yieldparam config [Client::Configuration]
|
69
|
+
#
|
70
|
+
# @return [Client::Configuration]
|
71
|
+
#
|
72
|
+
def self.configure
|
73
|
+
@configure ||= begin
|
74
|
+
namespace = ["Google", "Cloud", "Redis", "V1"]
|
75
|
+
parent_config = while namespace.any?
|
76
|
+
parent_name = namespace.join "::"
|
77
|
+
parent_const = const_get parent_name
|
78
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
79
|
+
namespace.pop
|
80
|
+
end
|
81
|
+
default_config = Client::Configuration.new parent_config
|
82
|
+
|
83
|
+
default_config.rpcs.list_instances.timeout = 600.0
|
84
|
+
|
85
|
+
default_config.rpcs.get_instance.timeout = 600.0
|
86
|
+
|
87
|
+
default_config.rpcs.get_instance_auth_string.timeout = 600.0
|
88
|
+
|
89
|
+
default_config.rpcs.create_instance.timeout = 600.0
|
90
|
+
|
91
|
+
default_config.rpcs.update_instance.timeout = 600.0
|
92
|
+
|
93
|
+
default_config.rpcs.upgrade_instance.timeout = 600.0
|
94
|
+
|
95
|
+
default_config.rpcs.import_instance.timeout = 600.0
|
96
|
+
|
97
|
+
default_config.rpcs.export_instance.timeout = 600.0
|
98
|
+
|
99
|
+
default_config.rpcs.failover_instance.timeout = 600.0
|
100
|
+
|
101
|
+
default_config.rpcs.delete_instance.timeout = 600.0
|
102
|
+
|
103
|
+
default_config.rpcs.reschedule_maintenance.timeout = 600.0
|
104
|
+
|
105
|
+
default_config
|
106
|
+
end
|
107
|
+
yield @configure if block_given?
|
108
|
+
@configure
|
109
|
+
end
|
110
|
+
|
111
|
+
##
|
112
|
+
# Configure the CloudRedis Client instance.
|
113
|
+
#
|
114
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
115
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
116
|
+
# should be made on {Client.configure}.
|
117
|
+
#
|
118
|
+
# See {::Google::Cloud::Redis::V1::CloudRedis::Rest::Client::Configuration}
|
119
|
+
# for a description of the configuration fields.
|
120
|
+
#
|
121
|
+
# @yield [config] Configure the Client client.
|
122
|
+
# @yieldparam config [Client::Configuration]
|
123
|
+
#
|
124
|
+
# @return [Client::Configuration]
|
125
|
+
#
|
126
|
+
def configure
|
127
|
+
yield @config if block_given?
|
128
|
+
@config
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# Create a new CloudRedis REST client object.
|
133
|
+
#
|
134
|
+
# @example
|
135
|
+
#
|
136
|
+
# # Create a client using the default configuration
|
137
|
+
# client = ::Google::Cloud::Redis::V1::CloudRedis::Rest::Client.new
|
138
|
+
#
|
139
|
+
# # Create a client using a custom configuration
|
140
|
+
# client = ::Google::Cloud::Redis::V1::CloudRedis::Rest::Client.new do |config|
|
141
|
+
# config.timeout = 10.0
|
142
|
+
# end
|
143
|
+
#
|
144
|
+
# @yield [config] Configure the CloudRedis client.
|
145
|
+
# @yieldparam config [Client::Configuration]
|
146
|
+
#
|
147
|
+
def initialize
|
148
|
+
# Create the configuration object
|
149
|
+
@config = Configuration.new Client.configure
|
150
|
+
|
151
|
+
# Yield the configuration if needed
|
152
|
+
yield @config if block_given?
|
153
|
+
|
154
|
+
# Create credentials
|
155
|
+
credentials = @config.credentials
|
156
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
157
|
+
# but only if the default endpoint does not have a region prefix.
|
158
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
159
|
+
!@config.endpoint.split(".").first.include?("-")
|
160
|
+
credentials ||= Credentials.default scope: @config.scope,
|
161
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
162
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
163
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
164
|
+
end
|
165
|
+
|
166
|
+
@quota_project_id = @config.quota_project
|
167
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
168
|
+
|
169
|
+
@operations_client = ::Google::Cloud::Redis::V1::CloudRedis::Rest::Operations.new do |config|
|
170
|
+
config.credentials = credentials
|
171
|
+
config.quota_project = @quota_project_id
|
172
|
+
config.endpoint = @config.endpoint
|
173
|
+
end
|
174
|
+
|
175
|
+
@cloud_redis_stub = ::Google::Cloud::Redis::V1::CloudRedis::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
176
|
+
end
|
177
|
+
|
178
|
+
##
|
179
|
+
# Get the associated client for long-running operations.
|
180
|
+
#
|
181
|
+
# @return [::Google::Cloud::Redis::V1::CloudRedis::Rest::Operations]
|
182
|
+
#
|
183
|
+
attr_reader :operations_client
|
184
|
+
|
185
|
+
# Service calls
|
186
|
+
|
187
|
+
##
|
188
|
+
# Lists all Redis instances owned by a project in either the specified
|
189
|
+
# location (region) or all locations.
|
190
|
+
#
|
191
|
+
# The location should have the following format:
|
192
|
+
#
|
193
|
+
# * `projects/{project_id}/locations/{location_id}`
|
194
|
+
#
|
195
|
+
# If `location_id` is specified as `-` (wildcard), then all regions
|
196
|
+
# available to the project are queried, and the results are aggregated.
|
197
|
+
#
|
198
|
+
# @overload list_instances(request, options = nil)
|
199
|
+
# Pass arguments to `list_instances` via a request object, either of type
|
200
|
+
# {::Google::Cloud::Redis::V1::ListInstancesRequest} or an equivalent Hash.
|
201
|
+
#
|
202
|
+
# @param request [::Google::Cloud::Redis::V1::ListInstancesRequest, ::Hash]
|
203
|
+
# A request object representing the call parameters. Required. To specify no
|
204
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
205
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
206
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
207
|
+
#
|
208
|
+
# @overload list_instances(parent: nil, page_size: nil, page_token: nil)
|
209
|
+
# Pass arguments to `list_instances` via keyword arguments. Note that at
|
210
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
211
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
212
|
+
#
|
213
|
+
# @param parent [::String]
|
214
|
+
# Required. The resource name of the instance location using the form:
|
215
|
+
# `projects/{project_id}/locations/{location_id}`
|
216
|
+
# where `location_id` refers to a GCP region.
|
217
|
+
# @param page_size [::Integer]
|
218
|
+
# The maximum number of items to return.
|
219
|
+
#
|
220
|
+
# If not specified, a default value of 1000 will be used by the service.
|
221
|
+
# Regardless of the page_size value, the response may include a partial list
|
222
|
+
# and a caller should only rely on response's
|
223
|
+
# {::Google::Cloud::Redis::V1::ListInstancesResponse#next_page_token `next_page_token`}
|
224
|
+
# to determine if there are more instances left to be queried.
|
225
|
+
# @param page_token [::String]
|
226
|
+
# The `next_page_token` value returned from a previous
|
227
|
+
# {::Google::Cloud::Redis::V1::CloudRedis::Rest::Client#list_instances ListInstances} request, if any.
|
228
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
229
|
+
# @yieldparam result [::Google::Cloud::Redis::V1::ListInstancesResponse]
|
230
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
231
|
+
#
|
232
|
+
# @return [::Google::Cloud::Redis::V1::ListInstancesResponse]
|
233
|
+
#
|
234
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
235
|
+
def list_instances request, options = nil
|
236
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
237
|
+
|
238
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::ListInstancesRequest
|
239
|
+
|
240
|
+
# Converts hash and nil to an options object
|
241
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
242
|
+
|
243
|
+
# Customize the options with defaults
|
244
|
+
call_metadata = @config.rpcs.list_instances.metadata.to_h
|
245
|
+
|
246
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
247
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
248
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
249
|
+
gapic_version: ::Google::Cloud::Redis::V1::VERSION,
|
250
|
+
transports_version_send: [:rest]
|
251
|
+
|
252
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
253
|
+
|
254
|
+
options.apply_defaults timeout: @config.rpcs.list_instances.timeout,
|
255
|
+
metadata: call_metadata,
|
256
|
+
retry_policy: @config.rpcs.list_instances.retry_policy
|
257
|
+
|
258
|
+
options.apply_defaults timeout: @config.timeout,
|
259
|
+
metadata: @config.metadata,
|
260
|
+
retry_policy: @config.retry_policy
|
261
|
+
|
262
|
+
@cloud_redis_stub.list_instances request, options do |result, operation|
|
263
|
+
yield result, operation if block_given?
|
264
|
+
return result
|
265
|
+
end
|
266
|
+
rescue ::Gapic::Rest::Error => e
|
267
|
+
raise ::Google::Cloud::Error.from_error(e)
|
268
|
+
end
|
269
|
+
|
270
|
+
##
|
271
|
+
# Gets the details of a specific Redis instance.
|
272
|
+
#
|
273
|
+
# @overload get_instance(request, options = nil)
|
274
|
+
# Pass arguments to `get_instance` via a request object, either of type
|
275
|
+
# {::Google::Cloud::Redis::V1::GetInstanceRequest} or an equivalent Hash.
|
276
|
+
#
|
277
|
+
# @param request [::Google::Cloud::Redis::V1::GetInstanceRequest, ::Hash]
|
278
|
+
# A request object representing the call parameters. Required. To specify no
|
279
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
280
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
281
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
282
|
+
#
|
283
|
+
# @overload get_instance(name: nil)
|
284
|
+
# Pass arguments to `get_instance` via keyword arguments. Note that at
|
285
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
286
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
287
|
+
#
|
288
|
+
# @param name [::String]
|
289
|
+
# Required. Redis instance resource name using the form:
|
290
|
+
# `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
|
291
|
+
# where `location_id` refers to a GCP region.
|
292
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
293
|
+
# @yieldparam result [::Google::Cloud::Redis::V1::Instance]
|
294
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
295
|
+
#
|
296
|
+
# @return [::Google::Cloud::Redis::V1::Instance]
|
297
|
+
#
|
298
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
299
|
+
def get_instance request, options = nil
|
300
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
301
|
+
|
302
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::GetInstanceRequest
|
303
|
+
|
304
|
+
# Converts hash and nil to an options object
|
305
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
306
|
+
|
307
|
+
# Customize the options with defaults
|
308
|
+
call_metadata = @config.rpcs.get_instance.metadata.to_h
|
309
|
+
|
310
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
311
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
312
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
313
|
+
gapic_version: ::Google::Cloud::Redis::V1::VERSION,
|
314
|
+
transports_version_send: [:rest]
|
315
|
+
|
316
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
317
|
+
|
318
|
+
options.apply_defaults timeout: @config.rpcs.get_instance.timeout,
|
319
|
+
metadata: call_metadata,
|
320
|
+
retry_policy: @config.rpcs.get_instance.retry_policy
|
321
|
+
|
322
|
+
options.apply_defaults timeout: @config.timeout,
|
323
|
+
metadata: @config.metadata,
|
324
|
+
retry_policy: @config.retry_policy
|
325
|
+
|
326
|
+
@cloud_redis_stub.get_instance request, options do |result, operation|
|
327
|
+
yield result, operation if block_given?
|
328
|
+
return result
|
329
|
+
end
|
330
|
+
rescue ::Gapic::Rest::Error => e
|
331
|
+
raise ::Google::Cloud::Error.from_error(e)
|
332
|
+
end
|
333
|
+
|
334
|
+
##
|
335
|
+
# Gets the AUTH string for a Redis instance. If AUTH is not enabled for the
|
336
|
+
# instance the response will be empty. This information is not included in
|
337
|
+
# the details returned to GetInstance.
|
338
|
+
#
|
339
|
+
# @overload get_instance_auth_string(request, options = nil)
|
340
|
+
# Pass arguments to `get_instance_auth_string` via a request object, either of type
|
341
|
+
# {::Google::Cloud::Redis::V1::GetInstanceAuthStringRequest} or an equivalent Hash.
|
342
|
+
#
|
343
|
+
# @param request [::Google::Cloud::Redis::V1::GetInstanceAuthStringRequest, ::Hash]
|
344
|
+
# A request object representing the call parameters. Required. To specify no
|
345
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
346
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
347
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
348
|
+
#
|
349
|
+
# @overload get_instance_auth_string(name: nil)
|
350
|
+
# Pass arguments to `get_instance_auth_string` via keyword arguments. Note that at
|
351
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
352
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
353
|
+
#
|
354
|
+
# @param name [::String]
|
355
|
+
# Required. Redis instance resource name using the form:
|
356
|
+
# `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
|
357
|
+
# where `location_id` refers to a GCP region.
|
358
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
359
|
+
# @yieldparam result [::Google::Cloud::Redis::V1::InstanceAuthString]
|
360
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
361
|
+
#
|
362
|
+
# @return [::Google::Cloud::Redis::V1::InstanceAuthString]
|
363
|
+
#
|
364
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
365
|
+
def get_instance_auth_string request, options = nil
|
366
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
367
|
+
|
368
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::GetInstanceAuthStringRequest
|
369
|
+
|
370
|
+
# Converts hash and nil to an options object
|
371
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
372
|
+
|
373
|
+
# Customize the options with defaults
|
374
|
+
call_metadata = @config.rpcs.get_instance_auth_string.metadata.to_h
|
375
|
+
|
376
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
377
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
378
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
379
|
+
gapic_version: ::Google::Cloud::Redis::V1::VERSION,
|
380
|
+
transports_version_send: [:rest]
|
381
|
+
|
382
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
383
|
+
|
384
|
+
options.apply_defaults timeout: @config.rpcs.get_instance_auth_string.timeout,
|
385
|
+
metadata: call_metadata,
|
386
|
+
retry_policy: @config.rpcs.get_instance_auth_string.retry_policy
|
387
|
+
|
388
|
+
options.apply_defaults timeout: @config.timeout,
|
389
|
+
metadata: @config.metadata,
|
390
|
+
retry_policy: @config.retry_policy
|
391
|
+
|
392
|
+
@cloud_redis_stub.get_instance_auth_string request, options do |result, operation|
|
393
|
+
yield result, operation if block_given?
|
394
|
+
return result
|
395
|
+
end
|
396
|
+
rescue ::Gapic::Rest::Error => e
|
397
|
+
raise ::Google::Cloud::Error.from_error(e)
|
398
|
+
end
|
399
|
+
|
400
|
+
##
|
401
|
+
# Creates a Redis instance based on the specified tier and memory size.
|
402
|
+
#
|
403
|
+
# By default, the instance is accessible from the project's
|
404
|
+
# [default network](https://cloud.google.com/vpc/docs/vpc).
|
405
|
+
#
|
406
|
+
# The creation is executed asynchronously and callers may check the returned
|
407
|
+
# operation to track its progress. Once the operation is completed the Redis
|
408
|
+
# instance will be fully functional. Completed longrunning.Operation will
|
409
|
+
# contain the new instance object in the response field.
|
410
|
+
#
|
411
|
+
# The returned operation is automatically deleted after a few hours, so there
|
412
|
+
# is no need to call DeleteOperation.
|
413
|
+
#
|
414
|
+
# @overload create_instance(request, options = nil)
|
415
|
+
# Pass arguments to `create_instance` via a request object, either of type
|
416
|
+
# {::Google::Cloud::Redis::V1::CreateInstanceRequest} or an equivalent Hash.
|
417
|
+
#
|
418
|
+
# @param request [::Google::Cloud::Redis::V1::CreateInstanceRequest, ::Hash]
|
419
|
+
# A request object representing the call parameters. Required. To specify no
|
420
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
421
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
422
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
423
|
+
#
|
424
|
+
# @overload create_instance(parent: nil, instance_id: nil, instance: nil)
|
425
|
+
# Pass arguments to `create_instance` via keyword arguments. Note that at
|
426
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
427
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
428
|
+
#
|
429
|
+
# @param parent [::String]
|
430
|
+
# Required. The resource name of the instance location using the form:
|
431
|
+
# `projects/{project_id}/locations/{location_id}`
|
432
|
+
# where `location_id` refers to a GCP region.
|
433
|
+
# @param instance_id [::String]
|
434
|
+
# Required. The logical name of the Redis instance in the customer project
|
435
|
+
# with the following restrictions:
|
436
|
+
#
|
437
|
+
# * Must contain only lowercase letters, numbers, and hyphens.
|
438
|
+
# * Must start with a letter.
|
439
|
+
# * Must be between 1-40 characters.
|
440
|
+
# * Must end with a number or a letter.
|
441
|
+
# * Must be unique within the customer project / location
|
442
|
+
# @param instance [::Google::Cloud::Redis::V1::Instance, ::Hash]
|
443
|
+
# Required. A Redis [Instance] resource
|
444
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
445
|
+
# @yieldparam result [::Gapic::Operation]
|
446
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
447
|
+
#
|
448
|
+
# @return [::Gapic::Operation]
|
449
|
+
#
|
450
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
451
|
+
def create_instance request, options = nil
|
452
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
453
|
+
|
454
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::CreateInstanceRequest
|
455
|
+
|
456
|
+
# Converts hash and nil to an options object
|
457
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
458
|
+
|
459
|
+
# Customize the options with defaults
|
460
|
+
call_metadata = @config.rpcs.create_instance.metadata.to_h
|
461
|
+
|
462
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
463
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
464
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
465
|
+
gapic_version: ::Google::Cloud::Redis::V1::VERSION,
|
466
|
+
transports_version_send: [:rest]
|
467
|
+
|
468
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
469
|
+
|
470
|
+
options.apply_defaults timeout: @config.rpcs.create_instance.timeout,
|
471
|
+
metadata: call_metadata,
|
472
|
+
retry_policy: @config.rpcs.create_instance.retry_policy
|
473
|
+
|
474
|
+
options.apply_defaults timeout: @config.timeout,
|
475
|
+
metadata: @config.metadata,
|
476
|
+
retry_policy: @config.retry_policy
|
477
|
+
|
478
|
+
@cloud_redis_stub.create_instance request, options do |result, operation|
|
479
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
480
|
+
yield result, operation if block_given?
|
481
|
+
return result
|
482
|
+
end
|
483
|
+
rescue ::Gapic::Rest::Error => e
|
484
|
+
raise ::Google::Cloud::Error.from_error(e)
|
485
|
+
end
|
486
|
+
|
487
|
+
##
|
488
|
+
# Updates the metadata and configuration of a specific Redis instance.
|
489
|
+
#
|
490
|
+
# Completed longrunning.Operation will contain the new instance object
|
491
|
+
# in the response field. The returned operation is automatically deleted
|
492
|
+
# after a few hours, so there is no need to call DeleteOperation.
|
493
|
+
#
|
494
|
+
# @overload update_instance(request, options = nil)
|
495
|
+
# Pass arguments to `update_instance` via a request object, either of type
|
496
|
+
# {::Google::Cloud::Redis::V1::UpdateInstanceRequest} or an equivalent Hash.
|
497
|
+
#
|
498
|
+
# @param request [::Google::Cloud::Redis::V1::UpdateInstanceRequest, ::Hash]
|
499
|
+
# A request object representing the call parameters. Required. To specify no
|
500
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
501
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
502
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
503
|
+
#
|
504
|
+
# @overload update_instance(update_mask: nil, instance: nil)
|
505
|
+
# Pass arguments to `update_instance` via keyword arguments. Note that at
|
506
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
507
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
508
|
+
#
|
509
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
510
|
+
# Required. Mask of fields to update. At least one path must be supplied in
|
511
|
+
# this field. The elements of the repeated paths field may only include these
|
512
|
+
# fields from {::Google::Cloud::Redis::V1::Instance Instance}:
|
513
|
+
#
|
514
|
+
# * `displayName`
|
515
|
+
# * `labels`
|
516
|
+
# * `memorySizeGb`
|
517
|
+
# * `redisConfig`
|
518
|
+
# * `replica_count`
|
519
|
+
# @param instance [::Google::Cloud::Redis::V1::Instance, ::Hash]
|
520
|
+
# Required. Update description.
|
521
|
+
# Only fields specified in update_mask are updated.
|
522
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
523
|
+
# @yieldparam result [::Gapic::Operation]
|
524
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
525
|
+
#
|
526
|
+
# @return [::Gapic::Operation]
|
527
|
+
#
|
528
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
529
|
+
def update_instance request, options = nil
|
530
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
531
|
+
|
532
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::UpdateInstanceRequest
|
533
|
+
|
534
|
+
# Converts hash and nil to an options object
|
535
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
536
|
+
|
537
|
+
# Customize the options with defaults
|
538
|
+
call_metadata = @config.rpcs.update_instance.metadata.to_h
|
539
|
+
|
540
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
541
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
542
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
543
|
+
gapic_version: ::Google::Cloud::Redis::V1::VERSION,
|
544
|
+
transports_version_send: [:rest]
|
545
|
+
|
546
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
547
|
+
|
548
|
+
options.apply_defaults timeout: @config.rpcs.update_instance.timeout,
|
549
|
+
metadata: call_metadata,
|
550
|
+
retry_policy: @config.rpcs.update_instance.retry_policy
|
551
|
+
|
552
|
+
options.apply_defaults timeout: @config.timeout,
|
553
|
+
metadata: @config.metadata,
|
554
|
+
retry_policy: @config.retry_policy
|
555
|
+
|
556
|
+
@cloud_redis_stub.update_instance request, options do |result, operation|
|
557
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
558
|
+
yield result, operation if block_given?
|
559
|
+
return result
|
560
|
+
end
|
561
|
+
rescue ::Gapic::Rest::Error => e
|
562
|
+
raise ::Google::Cloud::Error.from_error(e)
|
563
|
+
end
|
564
|
+
|
565
|
+
##
|
566
|
+
# Upgrades Redis instance to the newer Redis version specified in the
|
567
|
+
# request.
|
568
|
+
#
|
569
|
+
# @overload upgrade_instance(request, options = nil)
|
570
|
+
# Pass arguments to `upgrade_instance` via a request object, either of type
|
571
|
+
# {::Google::Cloud::Redis::V1::UpgradeInstanceRequest} or an equivalent Hash.
|
572
|
+
#
|
573
|
+
# @param request [::Google::Cloud::Redis::V1::UpgradeInstanceRequest, ::Hash]
|
574
|
+
# A request object representing the call parameters. Required. To specify no
|
575
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
576
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
577
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
578
|
+
#
|
579
|
+
# @overload upgrade_instance(name: nil, redis_version: nil)
|
580
|
+
# Pass arguments to `upgrade_instance` via keyword arguments. Note that at
|
581
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
582
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
583
|
+
#
|
584
|
+
# @param name [::String]
|
585
|
+
# Required. Redis instance resource name using the form:
|
586
|
+
# `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
|
587
|
+
# where `location_id` refers to a GCP region.
|
588
|
+
# @param redis_version [::String]
|
589
|
+
# Required. Specifies the target version of Redis software to upgrade to.
|
590
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
591
|
+
# @yieldparam result [::Gapic::Operation]
|
592
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
593
|
+
#
|
594
|
+
# @return [::Gapic::Operation]
|
595
|
+
#
|
596
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
597
|
+
def upgrade_instance request, options = nil
|
598
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
599
|
+
|
600
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::UpgradeInstanceRequest
|
601
|
+
|
602
|
+
# Converts hash and nil to an options object
|
603
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
604
|
+
|
605
|
+
# Customize the options with defaults
|
606
|
+
call_metadata = @config.rpcs.upgrade_instance.metadata.to_h
|
607
|
+
|
608
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
609
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
610
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
611
|
+
gapic_version: ::Google::Cloud::Redis::V1::VERSION,
|
612
|
+
transports_version_send: [:rest]
|
613
|
+
|
614
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
615
|
+
|
616
|
+
options.apply_defaults timeout: @config.rpcs.upgrade_instance.timeout,
|
617
|
+
metadata: call_metadata,
|
618
|
+
retry_policy: @config.rpcs.upgrade_instance.retry_policy
|
619
|
+
|
620
|
+
options.apply_defaults timeout: @config.timeout,
|
621
|
+
metadata: @config.metadata,
|
622
|
+
retry_policy: @config.retry_policy
|
623
|
+
|
624
|
+
@cloud_redis_stub.upgrade_instance request, options do |result, operation|
|
625
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
626
|
+
yield result, operation if block_given?
|
627
|
+
return result
|
628
|
+
end
|
629
|
+
rescue ::Gapic::Rest::Error => e
|
630
|
+
raise ::Google::Cloud::Error.from_error(e)
|
631
|
+
end
|
632
|
+
|
633
|
+
##
|
634
|
+
# Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
|
635
|
+
#
|
636
|
+
# Redis may stop serving during this operation. Instance state will be
|
637
|
+
# IMPORTING for entire operation. When complete, the instance will contain
|
638
|
+
# only data from the imported file.
|
639
|
+
#
|
640
|
+
# The returned operation is automatically deleted after a few hours, so
|
641
|
+
# there is no need to call DeleteOperation.
|
642
|
+
#
|
643
|
+
# @overload import_instance(request, options = nil)
|
644
|
+
# Pass arguments to `import_instance` via a request object, either of type
|
645
|
+
# {::Google::Cloud::Redis::V1::ImportInstanceRequest} or an equivalent Hash.
|
646
|
+
#
|
647
|
+
# @param request [::Google::Cloud::Redis::V1::ImportInstanceRequest, ::Hash]
|
648
|
+
# A request object representing the call parameters. Required. To specify no
|
649
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
650
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
651
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
652
|
+
#
|
653
|
+
# @overload import_instance(name: nil, input_config: nil)
|
654
|
+
# Pass arguments to `import_instance` via keyword arguments. Note that at
|
655
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
656
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
657
|
+
#
|
658
|
+
# @param name [::String]
|
659
|
+
# Required. Redis instance resource name using the form:
|
660
|
+
# `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
|
661
|
+
# where `location_id` refers to a GCP region.
|
662
|
+
# @param input_config [::Google::Cloud::Redis::V1::InputConfig, ::Hash]
|
663
|
+
# Required. Specify data to be imported.
|
664
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
665
|
+
# @yieldparam result [::Gapic::Operation]
|
666
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
667
|
+
#
|
668
|
+
# @return [::Gapic::Operation]
|
669
|
+
#
|
670
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
671
|
+
def import_instance request, options = nil
|
672
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
673
|
+
|
674
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::ImportInstanceRequest
|
675
|
+
|
676
|
+
# Converts hash and nil to an options object
|
677
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
678
|
+
|
679
|
+
# Customize the options with defaults
|
680
|
+
call_metadata = @config.rpcs.import_instance.metadata.to_h
|
681
|
+
|
682
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
683
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
684
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
685
|
+
gapic_version: ::Google::Cloud::Redis::V1::VERSION,
|
686
|
+
transports_version_send: [:rest]
|
687
|
+
|
688
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
689
|
+
|
690
|
+
options.apply_defaults timeout: @config.rpcs.import_instance.timeout,
|
691
|
+
metadata: call_metadata,
|
692
|
+
retry_policy: @config.rpcs.import_instance.retry_policy
|
693
|
+
|
694
|
+
options.apply_defaults timeout: @config.timeout,
|
695
|
+
metadata: @config.metadata,
|
696
|
+
retry_policy: @config.retry_policy
|
697
|
+
|
698
|
+
@cloud_redis_stub.import_instance request, options do |result, operation|
|
699
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
700
|
+
yield result, operation if block_given?
|
701
|
+
return result
|
702
|
+
end
|
703
|
+
rescue ::Gapic::Rest::Error => e
|
704
|
+
raise ::Google::Cloud::Error.from_error(e)
|
705
|
+
end
|
706
|
+
|
707
|
+
##
|
708
|
+
# Export Redis instance data into a Redis RDB format file in Cloud Storage.
|
709
|
+
#
|
710
|
+
# Redis will continue serving during this operation.
|
711
|
+
#
|
712
|
+
# The returned operation is automatically deleted after a few hours, so
|
713
|
+
# there is no need to call DeleteOperation.
|
714
|
+
#
|
715
|
+
# @overload export_instance(request, options = nil)
|
716
|
+
# Pass arguments to `export_instance` via a request object, either of type
|
717
|
+
# {::Google::Cloud::Redis::V1::ExportInstanceRequest} or an equivalent Hash.
|
718
|
+
#
|
719
|
+
# @param request [::Google::Cloud::Redis::V1::ExportInstanceRequest, ::Hash]
|
720
|
+
# A request object representing the call parameters. Required. To specify no
|
721
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
722
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
723
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
724
|
+
#
|
725
|
+
# @overload export_instance(name: nil, output_config: nil)
|
726
|
+
# Pass arguments to `export_instance` via keyword arguments. Note that at
|
727
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
728
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
729
|
+
#
|
730
|
+
# @param name [::String]
|
731
|
+
# Required. Redis instance resource name using the form:
|
732
|
+
# `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
|
733
|
+
# where `location_id` refers to a GCP region.
|
734
|
+
# @param output_config [::Google::Cloud::Redis::V1::OutputConfig, ::Hash]
|
735
|
+
# Required. Specify data to be exported.
|
736
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
737
|
+
# @yieldparam result [::Gapic::Operation]
|
738
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
739
|
+
#
|
740
|
+
# @return [::Gapic::Operation]
|
741
|
+
#
|
742
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
743
|
+
def export_instance request, options = nil
|
744
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
745
|
+
|
746
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::ExportInstanceRequest
|
747
|
+
|
748
|
+
# Converts hash and nil to an options object
|
749
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
750
|
+
|
751
|
+
# Customize the options with defaults
|
752
|
+
call_metadata = @config.rpcs.export_instance.metadata.to_h
|
753
|
+
|
754
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
755
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
756
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
757
|
+
gapic_version: ::Google::Cloud::Redis::V1::VERSION,
|
758
|
+
transports_version_send: [:rest]
|
759
|
+
|
760
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
761
|
+
|
762
|
+
options.apply_defaults timeout: @config.rpcs.export_instance.timeout,
|
763
|
+
metadata: call_metadata,
|
764
|
+
retry_policy: @config.rpcs.export_instance.retry_policy
|
765
|
+
|
766
|
+
options.apply_defaults timeout: @config.timeout,
|
767
|
+
metadata: @config.metadata,
|
768
|
+
retry_policy: @config.retry_policy
|
769
|
+
|
770
|
+
@cloud_redis_stub.export_instance request, options do |result, operation|
|
771
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
772
|
+
yield result, operation if block_given?
|
773
|
+
return result
|
774
|
+
end
|
775
|
+
rescue ::Gapic::Rest::Error => e
|
776
|
+
raise ::Google::Cloud::Error.from_error(e)
|
777
|
+
end
|
778
|
+
|
779
|
+
##
|
780
|
+
# Initiates a failover of the primary node to current replica node for a
|
781
|
+
# specific STANDARD tier Cloud Memorystore for Redis instance.
|
782
|
+
#
|
783
|
+
# @overload failover_instance(request, options = nil)
|
784
|
+
# Pass arguments to `failover_instance` via a request object, either of type
|
785
|
+
# {::Google::Cloud::Redis::V1::FailoverInstanceRequest} or an equivalent Hash.
|
786
|
+
#
|
787
|
+
# @param request [::Google::Cloud::Redis::V1::FailoverInstanceRequest, ::Hash]
|
788
|
+
# A request object representing the call parameters. Required. To specify no
|
789
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
790
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
791
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
792
|
+
#
|
793
|
+
# @overload failover_instance(name: nil, data_protection_mode: nil)
|
794
|
+
# Pass arguments to `failover_instance` via keyword arguments. Note that at
|
795
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
796
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
797
|
+
#
|
798
|
+
# @param name [::String]
|
799
|
+
# Required. Redis instance resource name using the form:
|
800
|
+
# `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
|
801
|
+
# where `location_id` refers to a GCP region.
|
802
|
+
# @param data_protection_mode [::Google::Cloud::Redis::V1::FailoverInstanceRequest::DataProtectionMode]
|
803
|
+
# Optional. Available data protection modes that the user can choose. If it's
|
804
|
+
# unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
|
805
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
806
|
+
# @yieldparam result [::Gapic::Operation]
|
807
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
808
|
+
#
|
809
|
+
# @return [::Gapic::Operation]
|
810
|
+
#
|
811
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
812
|
+
def failover_instance request, options = nil
|
813
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
814
|
+
|
815
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::FailoverInstanceRequest
|
816
|
+
|
817
|
+
# Converts hash and nil to an options object
|
818
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
819
|
+
|
820
|
+
# Customize the options with defaults
|
821
|
+
call_metadata = @config.rpcs.failover_instance.metadata.to_h
|
822
|
+
|
823
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
824
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
825
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
826
|
+
gapic_version: ::Google::Cloud::Redis::V1::VERSION,
|
827
|
+
transports_version_send: [:rest]
|
828
|
+
|
829
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
830
|
+
|
831
|
+
options.apply_defaults timeout: @config.rpcs.failover_instance.timeout,
|
832
|
+
metadata: call_metadata,
|
833
|
+
retry_policy: @config.rpcs.failover_instance.retry_policy
|
834
|
+
|
835
|
+
options.apply_defaults timeout: @config.timeout,
|
836
|
+
metadata: @config.metadata,
|
837
|
+
retry_policy: @config.retry_policy
|
838
|
+
|
839
|
+
@cloud_redis_stub.failover_instance request, options do |result, operation|
|
840
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
841
|
+
yield result, operation if block_given?
|
842
|
+
return result
|
843
|
+
end
|
844
|
+
rescue ::Gapic::Rest::Error => e
|
845
|
+
raise ::Google::Cloud::Error.from_error(e)
|
846
|
+
end
|
847
|
+
|
848
|
+
##
|
849
|
+
# Deletes a specific Redis instance. Instance stops serving and data is
|
850
|
+
# deleted.
|
851
|
+
#
|
852
|
+
# @overload delete_instance(request, options = nil)
|
853
|
+
# Pass arguments to `delete_instance` via a request object, either of type
|
854
|
+
# {::Google::Cloud::Redis::V1::DeleteInstanceRequest} or an equivalent Hash.
|
855
|
+
#
|
856
|
+
# @param request [::Google::Cloud::Redis::V1::DeleteInstanceRequest, ::Hash]
|
857
|
+
# A request object representing the call parameters. Required. To specify no
|
858
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
859
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
860
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
861
|
+
#
|
862
|
+
# @overload delete_instance(name: nil)
|
863
|
+
# Pass arguments to `delete_instance` via keyword arguments. Note that at
|
864
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
865
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
866
|
+
#
|
867
|
+
# @param name [::String]
|
868
|
+
# Required. Redis instance resource name using the form:
|
869
|
+
# `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
|
870
|
+
# where `location_id` refers to a GCP region.
|
871
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
872
|
+
# @yieldparam result [::Gapic::Operation]
|
873
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
874
|
+
#
|
875
|
+
# @return [::Gapic::Operation]
|
876
|
+
#
|
877
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
878
|
+
def delete_instance request, options = nil
|
879
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
880
|
+
|
881
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::DeleteInstanceRequest
|
882
|
+
|
883
|
+
# Converts hash and nil to an options object
|
884
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
885
|
+
|
886
|
+
# Customize the options with defaults
|
887
|
+
call_metadata = @config.rpcs.delete_instance.metadata.to_h
|
888
|
+
|
889
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
890
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
891
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
892
|
+
gapic_version: ::Google::Cloud::Redis::V1::VERSION,
|
893
|
+
transports_version_send: [:rest]
|
894
|
+
|
895
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
896
|
+
|
897
|
+
options.apply_defaults timeout: @config.rpcs.delete_instance.timeout,
|
898
|
+
metadata: call_metadata,
|
899
|
+
retry_policy: @config.rpcs.delete_instance.retry_policy
|
900
|
+
|
901
|
+
options.apply_defaults timeout: @config.timeout,
|
902
|
+
metadata: @config.metadata,
|
903
|
+
retry_policy: @config.retry_policy
|
904
|
+
|
905
|
+
@cloud_redis_stub.delete_instance request, options do |result, operation|
|
906
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
907
|
+
yield result, operation if block_given?
|
908
|
+
return result
|
909
|
+
end
|
910
|
+
rescue ::Gapic::Rest::Error => e
|
911
|
+
raise ::Google::Cloud::Error.from_error(e)
|
912
|
+
end
|
913
|
+
|
914
|
+
##
|
915
|
+
# Reschedule maintenance for a given instance in a given project and
|
916
|
+
# location.
|
917
|
+
#
|
918
|
+
# @overload reschedule_maintenance(request, options = nil)
|
919
|
+
# Pass arguments to `reschedule_maintenance` via a request object, either of type
|
920
|
+
# {::Google::Cloud::Redis::V1::RescheduleMaintenanceRequest} or an equivalent Hash.
|
921
|
+
#
|
922
|
+
# @param request [::Google::Cloud::Redis::V1::RescheduleMaintenanceRequest, ::Hash]
|
923
|
+
# A request object representing the call parameters. Required. To specify no
|
924
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
925
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
926
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
927
|
+
#
|
928
|
+
# @overload reschedule_maintenance(name: nil, reschedule_type: nil, schedule_time: nil)
|
929
|
+
# Pass arguments to `reschedule_maintenance` via keyword arguments. Note that at
|
930
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
931
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
932
|
+
#
|
933
|
+
# @param name [::String]
|
934
|
+
# Required. Redis instance resource name using the form:
|
935
|
+
# `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
|
936
|
+
# where `location_id` refers to a GCP region.
|
937
|
+
# @param reschedule_type [::Google::Cloud::Redis::V1::RescheduleMaintenanceRequest::RescheduleType]
|
938
|
+
# Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.
|
939
|
+
# @param schedule_time [::Google::Protobuf::Timestamp, ::Hash]
|
940
|
+
# Optional. Timestamp when the maintenance shall be rescheduled to if
|
941
|
+
# reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
|
942
|
+
# example `2012-11-15T16:19:00.094Z`.
|
943
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
944
|
+
# @yieldparam result [::Gapic::Operation]
|
945
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
946
|
+
#
|
947
|
+
# @return [::Gapic::Operation]
|
948
|
+
#
|
949
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
950
|
+
def reschedule_maintenance request, options = nil
|
951
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
952
|
+
|
953
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1::RescheduleMaintenanceRequest
|
954
|
+
|
955
|
+
# Converts hash and nil to an options object
|
956
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
957
|
+
|
958
|
+
# Customize the options with defaults
|
959
|
+
call_metadata = @config.rpcs.reschedule_maintenance.metadata.to_h
|
960
|
+
|
961
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
962
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
963
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
964
|
+
gapic_version: ::Google::Cloud::Redis::V1::VERSION,
|
965
|
+
transports_version_send: [:rest]
|
966
|
+
|
967
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
968
|
+
|
969
|
+
options.apply_defaults timeout: @config.rpcs.reschedule_maintenance.timeout,
|
970
|
+
metadata: call_metadata,
|
971
|
+
retry_policy: @config.rpcs.reschedule_maintenance.retry_policy
|
972
|
+
|
973
|
+
options.apply_defaults timeout: @config.timeout,
|
974
|
+
metadata: @config.metadata,
|
975
|
+
retry_policy: @config.retry_policy
|
976
|
+
|
977
|
+
@cloud_redis_stub.reschedule_maintenance request, options do |result, operation|
|
978
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
979
|
+
yield result, operation if block_given?
|
980
|
+
return result
|
981
|
+
end
|
982
|
+
rescue ::Gapic::Rest::Error => e
|
983
|
+
raise ::Google::Cloud::Error.from_error(e)
|
984
|
+
end
|
985
|
+
|
986
|
+
##
|
987
|
+
# Configuration class for the CloudRedis REST API.
|
988
|
+
#
|
989
|
+
# This class represents the configuration for CloudRedis REST,
|
990
|
+
# providing control over timeouts, retry behavior, logging, transport
|
991
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
992
|
+
# applied individually to specific RPCs. See
|
993
|
+
# {::Google::Cloud::Redis::V1::CloudRedis::Rest::Client::Configuration::Rpcs}
|
994
|
+
# for a list of RPCs that can be configured independently.
|
995
|
+
#
|
996
|
+
# Configuration can be applied globally to all clients, or to a single client
|
997
|
+
# on construction.
|
998
|
+
#
|
999
|
+
# @example
|
1000
|
+
#
|
1001
|
+
# # Modify the global config, setting the timeout for
|
1002
|
+
# # list_instances to 20 seconds,
|
1003
|
+
# # and all remaining timeouts to 10 seconds.
|
1004
|
+
# ::Google::Cloud::Redis::V1::CloudRedis::Rest::Client.configure do |config|
|
1005
|
+
# config.timeout = 10.0
|
1006
|
+
# config.rpcs.list_instances.timeout = 20.0
|
1007
|
+
# end
|
1008
|
+
#
|
1009
|
+
# # Apply the above configuration only to a new client.
|
1010
|
+
# client = ::Google::Cloud::Redis::V1::CloudRedis::Rest::Client.new do |config|
|
1011
|
+
# config.timeout = 10.0
|
1012
|
+
# config.rpcs.list_instances.timeout = 20.0
|
1013
|
+
# end
|
1014
|
+
#
|
1015
|
+
# @!attribute [rw] endpoint
|
1016
|
+
# The hostname or hostname:port of the service endpoint.
|
1017
|
+
# Defaults to `"redis.googleapis.com"`.
|
1018
|
+
# @return [::String]
|
1019
|
+
# @!attribute [rw] credentials
|
1020
|
+
# Credentials to send with calls. You may provide any of the following types:
|
1021
|
+
# * (`String`) The path to a service account key file in JSON format
|
1022
|
+
# * (`Hash`) A service account key as a Hash
|
1023
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1024
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
1025
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1026
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
1027
|
+
# * (`nil`) indicating no credentials
|
1028
|
+
# @return [::Object]
|
1029
|
+
# @!attribute [rw] scope
|
1030
|
+
# The OAuth scopes
|
1031
|
+
# @return [::Array<::String>]
|
1032
|
+
# @!attribute [rw] lib_name
|
1033
|
+
# The library name as recorded in instrumentation and logging
|
1034
|
+
# @return [::String]
|
1035
|
+
# @!attribute [rw] lib_version
|
1036
|
+
# The library version as recorded in instrumentation and logging
|
1037
|
+
# @return [::String]
|
1038
|
+
# @!attribute [rw] timeout
|
1039
|
+
# The call timeout in seconds.
|
1040
|
+
# @return [::Numeric]
|
1041
|
+
# @!attribute [rw] metadata
|
1042
|
+
# Additional headers to be sent with the call.
|
1043
|
+
# @return [::Hash{::Symbol=>::String}]
|
1044
|
+
# @!attribute [rw] retry_policy
|
1045
|
+
# The retry policy. The value is a hash with the following keys:
|
1046
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1047
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1048
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1049
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1050
|
+
# trigger a retry.
|
1051
|
+
# @return [::Hash]
|
1052
|
+
# @!attribute [rw] quota_project
|
1053
|
+
# A separate project against which to charge quota.
|
1054
|
+
# @return [::String]
|
1055
|
+
#
|
1056
|
+
class Configuration
|
1057
|
+
extend ::Gapic::Config
|
1058
|
+
|
1059
|
+
config_attr :endpoint, "redis.googleapis.com", ::String
|
1060
|
+
config_attr :credentials, nil do |value|
|
1061
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1062
|
+
allowed.any? { |klass| klass === value }
|
1063
|
+
end
|
1064
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
1065
|
+
config_attr :lib_name, nil, ::String, nil
|
1066
|
+
config_attr :lib_version, nil, ::String, nil
|
1067
|
+
config_attr :timeout, nil, ::Numeric, nil
|
1068
|
+
config_attr :metadata, nil, ::Hash, nil
|
1069
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1070
|
+
config_attr :quota_project, nil, ::String, nil
|
1071
|
+
|
1072
|
+
# @private
|
1073
|
+
def initialize parent_config = nil
|
1074
|
+
@parent_config = parent_config unless parent_config.nil?
|
1075
|
+
|
1076
|
+
yield self if block_given?
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
##
|
1080
|
+
# Configurations for individual RPCs
|
1081
|
+
# @return [Rpcs]
|
1082
|
+
#
|
1083
|
+
def rpcs
|
1084
|
+
@rpcs ||= begin
|
1085
|
+
parent_rpcs = nil
|
1086
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1087
|
+
Rpcs.new parent_rpcs
|
1088
|
+
end
|
1089
|
+
end
|
1090
|
+
|
1091
|
+
##
|
1092
|
+
# Configuration RPC class for the CloudRedis API.
|
1093
|
+
#
|
1094
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1095
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1096
|
+
# the following configuration fields:
|
1097
|
+
#
|
1098
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1099
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
1100
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1101
|
+
# include the following keys:
|
1102
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1103
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1104
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1105
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1106
|
+
# trigger a retry.
|
1107
|
+
#
|
1108
|
+
class Rpcs
|
1109
|
+
##
|
1110
|
+
# RPC-specific configuration for `list_instances`
|
1111
|
+
# @return [::Gapic::Config::Method]
|
1112
|
+
#
|
1113
|
+
attr_reader :list_instances
|
1114
|
+
##
|
1115
|
+
# RPC-specific configuration for `get_instance`
|
1116
|
+
# @return [::Gapic::Config::Method]
|
1117
|
+
#
|
1118
|
+
attr_reader :get_instance
|
1119
|
+
##
|
1120
|
+
# RPC-specific configuration for `get_instance_auth_string`
|
1121
|
+
# @return [::Gapic::Config::Method]
|
1122
|
+
#
|
1123
|
+
attr_reader :get_instance_auth_string
|
1124
|
+
##
|
1125
|
+
# RPC-specific configuration for `create_instance`
|
1126
|
+
# @return [::Gapic::Config::Method]
|
1127
|
+
#
|
1128
|
+
attr_reader :create_instance
|
1129
|
+
##
|
1130
|
+
# RPC-specific configuration for `update_instance`
|
1131
|
+
# @return [::Gapic::Config::Method]
|
1132
|
+
#
|
1133
|
+
attr_reader :update_instance
|
1134
|
+
##
|
1135
|
+
# RPC-specific configuration for `upgrade_instance`
|
1136
|
+
# @return [::Gapic::Config::Method]
|
1137
|
+
#
|
1138
|
+
attr_reader :upgrade_instance
|
1139
|
+
##
|
1140
|
+
# RPC-specific configuration for `import_instance`
|
1141
|
+
# @return [::Gapic::Config::Method]
|
1142
|
+
#
|
1143
|
+
attr_reader :import_instance
|
1144
|
+
##
|
1145
|
+
# RPC-specific configuration for `export_instance`
|
1146
|
+
# @return [::Gapic::Config::Method]
|
1147
|
+
#
|
1148
|
+
attr_reader :export_instance
|
1149
|
+
##
|
1150
|
+
# RPC-specific configuration for `failover_instance`
|
1151
|
+
# @return [::Gapic::Config::Method]
|
1152
|
+
#
|
1153
|
+
attr_reader :failover_instance
|
1154
|
+
##
|
1155
|
+
# RPC-specific configuration for `delete_instance`
|
1156
|
+
# @return [::Gapic::Config::Method]
|
1157
|
+
#
|
1158
|
+
attr_reader :delete_instance
|
1159
|
+
##
|
1160
|
+
# RPC-specific configuration for `reschedule_maintenance`
|
1161
|
+
# @return [::Gapic::Config::Method]
|
1162
|
+
#
|
1163
|
+
attr_reader :reschedule_maintenance
|
1164
|
+
|
1165
|
+
# @private
|
1166
|
+
def initialize parent_rpcs = nil
|
1167
|
+
list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
|
1168
|
+
@list_instances = ::Gapic::Config::Method.new list_instances_config
|
1169
|
+
get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
|
1170
|
+
@get_instance = ::Gapic::Config::Method.new get_instance_config
|
1171
|
+
get_instance_auth_string_config = parent_rpcs.get_instance_auth_string if parent_rpcs.respond_to? :get_instance_auth_string
|
1172
|
+
@get_instance_auth_string = ::Gapic::Config::Method.new get_instance_auth_string_config
|
1173
|
+
create_instance_config = parent_rpcs.create_instance if parent_rpcs.respond_to? :create_instance
|
1174
|
+
@create_instance = ::Gapic::Config::Method.new create_instance_config
|
1175
|
+
update_instance_config = parent_rpcs.update_instance if parent_rpcs.respond_to? :update_instance
|
1176
|
+
@update_instance = ::Gapic::Config::Method.new update_instance_config
|
1177
|
+
upgrade_instance_config = parent_rpcs.upgrade_instance if parent_rpcs.respond_to? :upgrade_instance
|
1178
|
+
@upgrade_instance = ::Gapic::Config::Method.new upgrade_instance_config
|
1179
|
+
import_instance_config = parent_rpcs.import_instance if parent_rpcs.respond_to? :import_instance
|
1180
|
+
@import_instance = ::Gapic::Config::Method.new import_instance_config
|
1181
|
+
export_instance_config = parent_rpcs.export_instance if parent_rpcs.respond_to? :export_instance
|
1182
|
+
@export_instance = ::Gapic::Config::Method.new export_instance_config
|
1183
|
+
failover_instance_config = parent_rpcs.failover_instance if parent_rpcs.respond_to? :failover_instance
|
1184
|
+
@failover_instance = ::Gapic::Config::Method.new failover_instance_config
|
1185
|
+
delete_instance_config = parent_rpcs.delete_instance if parent_rpcs.respond_to? :delete_instance
|
1186
|
+
@delete_instance = ::Gapic::Config::Method.new delete_instance_config
|
1187
|
+
reschedule_maintenance_config = parent_rpcs.reschedule_maintenance if parent_rpcs.respond_to? :reschedule_maintenance
|
1188
|
+
@reschedule_maintenance = ::Gapic::Config::Method.new reschedule_maintenance_config
|
1189
|
+
|
1190
|
+
yield self if block_given?
|
1191
|
+
end
|
1192
|
+
end
|
1193
|
+
end
|
1194
|
+
end
|
1195
|
+
end
|
1196
|
+
end
|
1197
|
+
end
|
1198
|
+
end
|
1199
|
+
end
|
1200
|
+
end
|