google-cloud-redis 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62cd1ebf589609e9a1c6ebc37384f2d106677dabef1dc050dc73076f2a3aee66
4
- data.tar.gz: d8f2575cca7b8d0838541d0065ba3d147416161ec731ce6d36ae7477a65cdd01
3
+ metadata.gz: 6a22e85ccebee8f46111a9ffd3b7d4fb4c305ab2f487c682cae37e92f7eb4325
4
+ data.tar.gz: 03ba802175968e4191300226b91f4b3203490593824a1b8a83b00002c5d0ddfd
5
5
  SHA512:
6
- metadata.gz: 194e144ae91d19bc3f11309f9a98f73913a639496c8d8b460e3d07bf390d20b4bf39ddae99d62de13fae0aea4978c03f5bd10809781850046e9ee8c2440d640e
7
- data.tar.gz: 61a2d848cde37ffc8b11594a43ab94cc477a216ed1ab1a05ae4885b8fea2e5a59650b1175b1235554e139f8ce9991488a92663cebbe61cf5aef533f83b97b87f
6
+ metadata.gz: be2182878a43ba7ebe68026fa4f93322a7c21549341e7690675e223764cf1792efda7ed74888098f02baa9dd36998f0e11e6f4b80cb525ebf43f4a37c9574e62
7
+ data.tar.gz: 4f225edbfe7dfdffa7f5625d514c6180612c9e903b7152081869c1510cb85427204face170040de2bb49524c57ff37a2fce0927dfda8cb18f31e0a3af019081f
data/.yardopts CHANGED
@@ -2,6 +2,7 @@
2
2
  --title=Google Cloud Memorystore for Redis API
3
3
  --exclude _pb\.rb$
4
4
  --markup markdown
5
+ --markup-provider redcarpet
5
6
 
6
7
  ./lib/**/*.rb
7
8
  -
data/README.md CHANGED
@@ -12,7 +12,7 @@ steps:
12
12
 
13
13
  1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
14
14
  2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
15
- 3. [Enable the Google Cloud Memorystore for Redis API.](https://console.cloud.google.com/apis/api/redis)
15
+ 3. [Enable the Google Cloud Memorystore for Redis API.](https://console.cloud.google.com/apis/library/redis.googleapis.com)
16
16
  4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
17
17
 
18
18
  ### Installation
@@ -29,4 +29,41 @@ $ gem install google-cloud-redis
29
29
  to see the full list of Cloud APIs that we cover.
30
30
 
31
31
  [Client Library Documentation]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-redis/latest/google/cloud/redis/v1beta1
32
- [Product Documentation]: https://cloud.google.com/redis
32
+ [Product Documentation]: https://cloud.google.com/memorystore
33
+
34
+ ## Enabling Logging
35
+
36
+ To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
37
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
38
+ or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
39
+ that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
40
+ and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
41
+
42
+ Configuring a Ruby stdlib logger:
43
+
44
+ ```ruby
45
+ require "logger"
46
+
47
+ module MyLogger
48
+ LOGGER = Logger.new $stderr, level: Logger::WARN
49
+ def logger
50
+ LOGGER
51
+ end
52
+ end
53
+
54
+ # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
55
+ module GRPC
56
+ extend MyLogger
57
+ end
58
+ ```
59
+
60
+ ## Supported Ruby Versions
61
+
62
+ This library is supported on Ruby 2.3+.
63
+
64
+ Google provides official support for Ruby versions that are actively supported
65
+ by Ruby Core—that is, Ruby versions that are either in normal maintenance or
66
+ in security maintenance, and not end of life. Currently, this means Ruby 2.3
67
+ and later. Older versions of Ruby _may_ still work, but are unsupported and not
68
+ recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
69
+ about the Ruby support schedule.
@@ -33,7 +33,7 @@ module Google
33
33
  #
34
34
  # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
35
35
  # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
36
- # 3. [Enable the Google Cloud Memorystore for Redis API.](https://console.cloud.google.com/apis/api/redis)
36
+ # 3. [Enable the Google Cloud Memorystore for Redis API.](https://console.cloud.google.com/apis/library/redis.googleapis.com)
37
37
  # 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
38
38
  #
39
39
  # ### Next Steps
@@ -42,8 +42,33 @@ module Google
42
42
  # - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
43
43
  # to see the full list of Cloud APIs that we cover.
44
44
  #
45
- # [Product Documentation]: https://cloud.google.com/redis
45
+ # [Product Documentation]: https://cloud.google.com/memorystore
46
46
  #
47
+ # ## Enabling Logging
48
+ #
49
+ # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
50
+ # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
51
+ # or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
52
+ # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
53
+ # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
54
+ #
55
+ # Configuring a Ruby stdlib logger:
56
+ #
57
+ # ```ruby
58
+ # require "logger"
59
+ #
60
+ # module MyLogger
61
+ # LOGGER = Logger.new $stderr, level: Logger::WARN
62
+ # def logger
63
+ # LOGGER
64
+ # end
65
+ # end
66
+ #
67
+ # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
68
+ # module GRPC
69
+ # extend MyLogger
70
+ # end
71
+ # ```
47
72
  #
48
73
  module Redis
49
74
  # rubocop:enable LineLength
@@ -101,6 +126,11 @@ module Google
101
126
  # or the specified config is missing data points.
102
127
  # @param timeout [Numeric]
103
128
  # The default timeout, in seconds, for calls made through this client.
129
+ # @param metadata [Hash]
130
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
131
+ # @param exception_transformer [Proc]
132
+ # An optional proc that intercepts any exceptions raised during an API call to inject
133
+ # custom error handling.
104
134
  def self.new(*args, version: :v1beta1, **kwargs)
105
135
  unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
106
136
  raise "The version: #{version} is not available. The available versions " \
@@ -17,35 +17,60 @@ require "google/cloud/redis/v1beta1/cloud_redis_pb"
17
17
 
18
18
  module Google
19
19
  module Cloud
20
- # rubocop:disable LineLength
21
-
22
- ##
23
- # # Ruby Client for Google Cloud Memorystore for Redis API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
24
- #
25
- # [Google Cloud Memorystore for Redis API][Product Documentation]:
26
- # The Google Cloud Memorystore for Redis API is used for creating and managing
27
- # Redis instances on the Google Cloud Platform.
28
- # - [Product Documentation][]
29
- #
30
- # ## Quick Start
31
- # In order to use this library, you first need to go through the following
32
- # steps:
33
- #
34
- # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
35
- # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
36
- # 3. [Enable the Google Cloud Memorystore for Redis API.](https://console.cloud.google.com/apis/api/redis)
37
- # 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
38
- #
39
- # ### Next Steps
40
- # - Read the [Google Cloud Memorystore for Redis API Product documentation][Product Documentation]
41
- # to learn more about the product and see How-to Guides.
42
- # - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
43
- # to see the full list of Cloud APIs that we cover.
44
- #
45
- # [Product Documentation]: https://cloud.google.com/redis
46
- #
47
- #
48
20
  module Redis
21
+ # rubocop:disable LineLength
22
+
23
+ ##
24
+ # # Ruby Client for Google Cloud Memorystore for Redis API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
25
+ #
26
+ # [Google Cloud Memorystore for Redis API][Product Documentation]:
27
+ # The Google Cloud Memorystore for Redis API is used for creating and managing
28
+ # Redis instances on the Google Cloud Platform.
29
+ # - [Product Documentation][]
30
+ #
31
+ # ## Quick Start
32
+ # In order to use this library, you first need to go through the following
33
+ # steps:
34
+ #
35
+ # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
36
+ # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
37
+ # 3. [Enable the Google Cloud Memorystore for Redis API.](https://console.cloud.google.com/apis/library/redis.googleapis.com)
38
+ # 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
39
+ #
40
+ # ### Next Steps
41
+ # - Read the [Google Cloud Memorystore for Redis API Product documentation][Product Documentation]
42
+ # to learn more about the product and see How-to Guides.
43
+ # - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
44
+ # to see the full list of Cloud APIs that we cover.
45
+ #
46
+ # [Product Documentation]: https://cloud.google.com/memorystore
47
+ #
48
+ # ## Enabling Logging
49
+ #
50
+ # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
51
+ # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
52
+ # or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
53
+ # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
54
+ # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
55
+ #
56
+ # Configuring a Ruby stdlib logger:
57
+ #
58
+ # ```ruby
59
+ # require "logger"
60
+ #
61
+ # module MyLogger
62
+ # LOGGER = Logger.new $stderr, level: Logger::WARN
63
+ # def logger
64
+ # LOGGER
65
+ # end
66
+ # end
67
+ #
68
+ # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
69
+ # module GRPC
70
+ # extend MyLogger
71
+ # end
72
+ # ```
73
+ #
49
74
  module V1beta1
50
75
  # rubocop:enable LineLength
51
76
 
@@ -90,11 +115,18 @@ module Google
90
115
  # or the specified config is missing data points.
91
116
  # @param timeout [Numeric]
92
117
  # The default timeout, in seconds, for calls made through this client.
118
+ # @param metadata [Hash]
119
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
120
+ # @param exception_transformer [Proc]
121
+ # An optional proc that intercepts any exceptions raised during an API call to inject
122
+ # custom error handling.
93
123
  def self.new \
94
124
  credentials: nil,
95
125
  scopes: nil,
96
126
  client_config: nil,
97
127
  timeout: nil,
128
+ metadata: nil,
129
+ exception_transformer: nil,
98
130
  lib_name: nil,
99
131
  lib_version: nil
100
132
  kwargs = {
@@ -102,6 +134,8 @@ module Google
102
134
  scopes: scopes,
103
135
  client_config: client_config,
104
136
  timeout: timeout,
137
+ metadata: metadata,
138
+ exception_transformer: exception_transformer,
105
139
  lib_name: lib_name,
106
140
  lib_version: lib_version
107
141
  }.select { |_, v| v != nil }
@@ -27,7 +27,7 @@ require "google/gax/operation"
27
27
  require "google/longrunning/operations_client"
28
28
 
29
29
  require "google/cloud/redis/v1beta1/cloud_redis_pb"
30
- require "google/cloud/redis/credentials"
30
+ require "google/cloud/redis/v1beta1/credentials"
31
31
 
32
32
  module Google
33
33
  module Cloud
@@ -60,6 +60,9 @@ module Google
60
60
  # The default port of the service.
61
61
  DEFAULT_SERVICE_PORT = 443
62
62
 
63
+ # The default set of gRPC interceptors.
64
+ GRPC_INTERCEPTORS = []
65
+
63
66
  DEFAULT_TIMEOUT = 30
64
67
 
65
68
  PAGE_DESCRIPTORS = {
@@ -77,8 +80,10 @@ module Google
77
80
  "https://www.googleapis.com/auth/cloud-platform"
78
81
  ].freeze
79
82
 
83
+ # @private
80
84
  class OperationsClient < Google::Longrunning::OperationsClient
81
85
  self::SERVICE_ADDRESS = CloudRedisClient::SERVICE_ADDRESS
86
+ self::GRPC_INTERCEPTORS = CloudRedisClient::GRPC_INTERCEPTORS
82
87
  end
83
88
 
84
89
  LOCATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
@@ -141,11 +146,18 @@ module Google
141
146
  # or the specified config is missing data points.
142
147
  # @param timeout [Numeric]
143
148
  # The default timeout, in seconds, for calls made through this client.
149
+ # @param metadata [Hash]
150
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
151
+ # @param exception_transformer [Proc]
152
+ # An optional proc that intercepts any exceptions raised during an API call to inject
153
+ # custom error handling.
144
154
  def initialize \
145
155
  credentials: nil,
146
156
  scopes: ALL_SCOPES,
147
157
  client_config: {},
148
158
  timeout: DEFAULT_TIMEOUT,
159
+ metadata: nil,
160
+ exception_transformer: nil,
149
161
  lib_name: nil,
150
162
  lib_version: ""
151
163
  # These require statements are intentionally placed here to initialize
@@ -154,7 +166,7 @@ module Google
154
166
  require "google/gax/grpc"
155
167
  require "google/cloud/redis/v1beta1/cloud_redis_services_pb"
156
168
 
157
- credentials ||= Google::Cloud::Redis::Credentials.default
169
+ credentials ||= Google::Cloud::Redis::V1beta1::Credentials.default
158
170
 
159
171
  @operations_client = OperationsClient.new(
160
172
  credentials: credentials,
@@ -166,7 +178,7 @@ module Google
166
178
  )
167
179
 
168
180
  if credentials.is_a?(String) || credentials.is_a?(Hash)
169
- updater_proc = Google::Cloud::Redis::Credentials.new(credentials).updater_proc
181
+ updater_proc = Google::Cloud::Redis::V1beta1::Credentials.new(credentials).updater_proc
170
182
  end
171
183
  if credentials.is_a?(GRPC::Core::Channel)
172
184
  channel = credentials
@@ -190,6 +202,7 @@ module Google
190
202
  google_api_client.freeze
191
203
 
192
204
  headers = { :"x-goog-api-client" => google_api_client }
205
+ headers.merge!(metadata) unless metadata.nil?
193
206
  client_config_file = Pathname.new(__dir__).join(
194
207
  "cloud_redis_client_config.json"
195
208
  )
@@ -202,13 +215,14 @@ module Google
202
215
  timeout,
203
216
  page_descriptors: PAGE_DESCRIPTORS,
204
217
  errors: Google::Gax::Grpc::API_ERRORS,
205
- kwargs: headers
218
+ metadata: headers
206
219
  )
207
220
  end
208
221
 
209
222
  # Allow overriding the service path/port in subclasses.
210
223
  service_path = self.class::SERVICE_ADDRESS
211
224
  port = self.class::DEFAULT_SERVICE_PORT
225
+ interceptors = self.class::GRPC_INTERCEPTORS
212
226
  @cloud_redis_stub = Google::Gax::Grpc.create_stub(
213
227
  service_path,
214
228
  port,
@@ -216,28 +230,34 @@ module Google
216
230
  channel: channel,
217
231
  updater_proc: updater_proc,
218
232
  scopes: scopes,
233
+ interceptors: interceptors,
219
234
  &Google::Cloud::Redis::V1beta1::CloudRedis::Stub.method(:new)
220
235
  )
221
236
 
222
237
  @list_instances = Google::Gax.create_api_call(
223
238
  @cloud_redis_stub.method(:list_instances),
224
- defaults["list_instances"]
239
+ defaults["list_instances"],
240
+ exception_transformer: exception_transformer
225
241
  )
226
242
  @get_instance = Google::Gax.create_api_call(
227
243
  @cloud_redis_stub.method(:get_instance),
228
- defaults["get_instance"]
244
+ defaults["get_instance"],
245
+ exception_transformer: exception_transformer
229
246
  )
230
247
  @create_instance = Google::Gax.create_api_call(
231
248
  @cloud_redis_stub.method(:create_instance),
232
- defaults["create_instance"]
249
+ defaults["create_instance"],
250
+ exception_transformer: exception_transformer
233
251
  )
234
252
  @update_instance = Google::Gax.create_api_call(
235
253
  @cloud_redis_stub.method(:update_instance),
236
- defaults["update_instance"]
254
+ defaults["update_instance"],
255
+ exception_transformer: exception_transformer
237
256
  )
238
257
  @delete_instance = Google::Gax.create_api_call(
239
258
  @cloud_redis_stub.method(:delete_instance),
240
- defaults["delete_instance"]
259
+ defaults["delete_instance"],
260
+ exception_transformer: exception_transformer
241
261
  )
242
262
  end
243
263
 
@@ -265,6 +285,9 @@ module Google
265
285
  # @param options [Google::Gax::CallOptions]
266
286
  # Overrides the default settings for this call, e.g, timeout,
267
287
  # retries, etc.
288
+ # @yield [result, operation] Access the result along with the RPC operation
289
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Redis::V1beta1::Instance>]
290
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
268
291
  # @return [Google::Gax::PagedEnumerable<Google::Cloud::Redis::V1beta1::Instance>]
269
292
  # An enumerable of Google::Cloud::Redis::V1beta1::Instance instances.
270
293
  # See Google::Gax::PagedEnumerable documentation for other
@@ -272,9 +295,9 @@ module Google
272
295
  # object.
273
296
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
274
297
  # @example
275
- # require "google/cloud/redis/v1beta1"
298
+ # require "google/cloud/redis"
276
299
  #
277
- # cloud_redis_client = Google::Cloud::Redis::V1beta1.new
300
+ # cloud_redis_client = Google::Cloud::Redis.new(version: :v1beta1)
278
301
  # formatted_parent = Google::Cloud::Redis::V1beta1::CloudRedisClient.location_path("[PROJECT]", "[LOCATION]")
279
302
  #
280
303
  # # Iterate over all results.
@@ -293,13 +316,14 @@ module Google
293
316
  def list_instances \
294
317
  parent,
295
318
  page_size: nil,
296
- options: nil
319
+ options: nil,
320
+ &block
297
321
  req = {
298
322
  parent: parent,
299
323
  page_size: page_size
300
324
  }.delete_if { |_, v| v.nil? }
301
325
  req = Google::Gax::to_proto(req, Google::Cloud::Redis::V1beta1::ListInstancesRequest)
302
- @list_instances.call(req, options)
326
+ @list_instances.call(req, options, &block)
303
327
  end
304
328
 
305
329
  # Gets the details of a specific Redis instance.
@@ -311,23 +335,27 @@ module Google
311
335
  # @param options [Google::Gax::CallOptions]
312
336
  # Overrides the default settings for this call, e.g, timeout,
313
337
  # retries, etc.
338
+ # @yield [result, operation] Access the result along with the RPC operation
339
+ # @yieldparam result [Google::Cloud::Redis::V1beta1::Instance]
340
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
314
341
  # @return [Google::Cloud::Redis::V1beta1::Instance]
315
342
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
316
343
  # @example
317
- # require "google/cloud/redis/v1beta1"
344
+ # require "google/cloud/redis"
318
345
  #
319
- # cloud_redis_client = Google::Cloud::Redis::V1beta1.new
346
+ # cloud_redis_client = Google::Cloud::Redis.new(version: :v1beta1)
320
347
  # formatted_name = Google::Cloud::Redis::V1beta1::CloudRedisClient.instance_path("[PROJECT]", "[LOCATION]", "[INSTANCE]")
321
348
  # response = cloud_redis_client.get_instance(formatted_name)
322
349
 
323
350
  def get_instance \
324
351
  name,
325
- options: nil
352
+ options: nil,
353
+ &block
326
354
  req = {
327
355
  name: name
328
356
  }.delete_if { |_, v| v.nil? }
329
357
  req = Google::Gax::to_proto(req, Google::Cloud::Redis::V1beta1::GetInstanceRequest)
330
- @get_instance.call(req, options)
358
+ @get_instance.call(req, options, &block)
331
359
  end
332
360
 
333
361
  # Creates a Redis instance based on the specified tier and memory size.
@@ -366,9 +394,9 @@ module Google
366
394
  # @return [Google::Gax::Operation]
367
395
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
368
396
  # @example
369
- # require "google/cloud/redis/v1beta1"
397
+ # require "google/cloud/redis"
370
398
  #
371
- # cloud_redis_client = Google::Cloud::Redis::V1beta1.new
399
+ # cloud_redis_client = Google::Cloud::Redis.new(version: :v1beta1)
372
400
  # formatted_parent = Google::Cloud::Redis::V1beta1::CloudRedisClient.location_path("[PROJECT]", "[LOCATION]")
373
401
  # instance_id = "test_instance"
374
402
  # tier = :BASIC
@@ -451,9 +479,9 @@ module Google
451
479
  # @return [Google::Gax::Operation]
452
480
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
453
481
  # @example
454
- # require "google/cloud/redis/v1beta1"
482
+ # require "google/cloud/redis"
455
483
  #
456
- # cloud_redis_client = Google::Cloud::Redis::V1beta1.new
484
+ # cloud_redis_client = Google::Cloud::Redis.new(version: :v1beta1)
457
485
  # paths_element = "display_name"
458
486
  # paths_element_2 = "memory_size_gb"
459
487
  # paths = [paths_element, paths_element_2]
@@ -522,9 +550,9 @@ module Google
522
550
  # @return [Google::Gax::Operation]
523
551
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
524
552
  # @example
525
- # require "google/cloud/redis/v1beta1"
553
+ # require "google/cloud/redis"
526
554
  #
527
- # cloud_redis_client = Google::Cloud::Redis::V1beta1.new
555
+ # cloud_redis_client = Google::Cloud::Redis.new(version: :v1beta1)
528
556
  # formatted_name = Google::Cloud::Redis::V1beta1::CloudRedisClient.instance_path("[PROJECT]", "[LOCATION]", "[INSTANCE]")
529
557
  #
530
558
  # # Register a callback during the method call.
@@ -0,0 +1,40 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "googleauth"
16
+
17
+ module Google
18
+ module Cloud
19
+ module Redis
20
+ module V1beta1
21
+ class Credentials < Google::Auth::Credentials
22
+ SCOPE = [
23
+ "https://www.googleapis.com/auth/cloud-platform"
24
+ ].freeze
25
+ PATH_ENV_VARS = %w(REDIS_CREDENTIALS
26
+ REDIS_KEYFILE
27
+ GOOGLE_CLOUD_CREDENTIALS
28
+ GOOGLE_CLOUD_KEYFILE
29
+ GCLOUD_KEYFILE)
30
+ JSON_ENV_VARS = %w(REDIS_CREDENTIALS_JSON
31
+ REDIS_KEYFILE_JSON
32
+ GOOGLE_CLOUD_CREDENTIALS_JSON
33
+ GOOGLE_CLOUD_KEYFILE_JSON
34
+ GCLOUD_KEYFILE_JSON)
35
+ DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -15,17 +15,6 @@
15
15
  module Google
16
16
  module Cloud
17
17
  module Redis
18
- ##
19
- # # Google Cloud Memorystore for Redis API Contents
20
- #
21
- # | Class | Description |
22
- # | ----- | ----------- |
23
- # | [CloudRedisClient][] | Configures and manages Cloud Memorystore for Redis instances |
24
- # | [Data Types][] | Data types for Google::Cloud::Redis::V1beta1 |
25
- #
26
- # [CloudRedisClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-redis/latest/google/cloud/redis/v1beta1/cloudredisclient
27
- # [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-redis/latest/google/cloud/redis/v1beta1/datatypes
28
- #
29
18
  module V1beta1
30
19
  # A Google Cloud Redis instance.
31
20
  # @!attribute [rw] name
@@ -0,0 +1,92 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Longrunning
17
+ # This resource represents a long-running operation that is the result of a
18
+ # network API call.
19
+ # @!attribute [rw] name
20
+ # @return [String]
21
+ # The server-assigned name, which is only unique within the same service that
22
+ # originally returns it. If you use the default HTTP mapping, the
23
+ # +name+ should have the format of +operations/some/unique/name+.
24
+ # @!attribute [rw] metadata
25
+ # @return [Google::Protobuf::Any]
26
+ # Service-specific metadata associated with the operation. It typically
27
+ # contains progress information and common metadata such as create time.
28
+ # Some services might not provide such metadata. Any method that returns a
29
+ # long-running operation should document the metadata type, if any.
30
+ # @!attribute [rw] done
31
+ # @return [true, false]
32
+ # If the value is +false+, it means the operation is still in progress.
33
+ # If true, the operation is completed, and either +error+ or +response+ is
34
+ # available.
35
+ # @!attribute [rw] error
36
+ # @return [Google::Rpc::Status]
37
+ # The error result of the operation in case of failure or cancellation.
38
+ # @!attribute [rw] response
39
+ # @return [Google::Protobuf::Any]
40
+ # The normal response of the operation in case of success. If the original
41
+ # method returns no data on success, such as +Delete+, the response is
42
+ # +google.protobuf.Empty+. If the original method is standard
43
+ # +Get+/+Create+/+Update+, the response should be the resource. For other
44
+ # methods, the response should have the type +XxxResponse+, where +Xxx+
45
+ # is the original method name. For example, if the original method name
46
+ # is +TakeSnapshot()+, the inferred response type is
47
+ # +TakeSnapshotResponse+.
48
+ class Operation; end
49
+
50
+ # The request message for {Google::Longrunning::Operations::GetOperation Operations::GetOperation}.
51
+ # @!attribute [rw] name
52
+ # @return [String]
53
+ # The name of the operation resource.
54
+ class GetOperationRequest; end
55
+
56
+ # The request message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
57
+ # @!attribute [rw] name
58
+ # @return [String]
59
+ # The name of the operation collection.
60
+ # @!attribute [rw] filter
61
+ # @return [String]
62
+ # The standard list filter.
63
+ # @!attribute [rw] page_size
64
+ # @return [Integer]
65
+ # The standard list page size.
66
+ # @!attribute [rw] page_token
67
+ # @return [String]
68
+ # The standard list page token.
69
+ class ListOperationsRequest; end
70
+
71
+ # The response message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
72
+ # @!attribute [rw] operations
73
+ # @return [Array<Google::Longrunning::Operation>]
74
+ # A list of operations that matches the specified filter in the request.
75
+ # @!attribute [rw] next_page_token
76
+ # @return [String]
77
+ # The standard List next-page token.
78
+ class ListOperationsResponse; end
79
+
80
+ # The request message for {Google::Longrunning::Operations::CancelOperation Operations::CancelOperation}.
81
+ # @!attribute [rw] name
82
+ # @return [String]
83
+ # The name of the operation resource to be cancelled.
84
+ class CancelOperationRequest; end
85
+
86
+ # The request message for {Google::Longrunning::Operations::DeleteOperation Operations::DeleteOperation}.
87
+ # @!attribute [rw] name
88
+ # @return [String]
89
+ # The name of the operation resource to be deleted.
90
+ class DeleteOperationRequest; end
91
+ end
92
+ end
@@ -30,7 +30,7 @@ module Google
30
30
  #
31
31
  # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
32
32
  # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
33
- # 3. [Enable the Google Cloud Memorystore for Redis API.](https://console.cloud.google.com/apis/api/redis)
33
+ # 3. [Enable the Google Cloud Memorystore for Redis API.](https://console.cloud.google.com/apis/library/redis.googleapis.com)
34
34
  # 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
35
35
  #
36
36
  # ### Installation
@@ -44,8 +44,33 @@ module Google
44
44
  # - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
45
45
  # to see the full list of Cloud APIs that we cover.
46
46
  #
47
- # [Product Documentation]: https://cloud.google.com/redis
47
+ # [Product Documentation]: https://cloud.google.com/memorystore
48
48
  #
49
+ # ## Enabling Logging
50
+ #
51
+ # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
52
+ # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
53
+ # or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
54
+ # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
55
+ # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
56
+ #
57
+ # Configuring a Ruby stdlib logger:
58
+ #
59
+ # ```ruby
60
+ # require "logger"
61
+ #
62
+ # module MyLogger
63
+ # LOGGER = Logger.new $stderr, level: Logger::WARN
64
+ # def logger
65
+ # LOGGER
66
+ # end
67
+ # end
68
+ #
69
+ # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
70
+ # module GRPC
71
+ # extend MyLogger
72
+ # end
73
+ # ```
49
74
  #
50
75
  module Redis
51
76
  module V1beta1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-09 00:00:00.000000000 Z
11
+ date: 2018-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-gax
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: redcarpet
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rubocop
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,20 @@ dependencies:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0.9'
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.9'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.9'
69
97
  description: google-cloud-redis is the official library for Google Cloud Memorystore
70
98
  for Redis API.
71
99
  email: googleapis-packages@google.com
@@ -77,19 +105,20 @@ files:
77
105
  - LICENSE
78
106
  - README.md
79
107
  - lib/google/cloud/redis.rb
80
- - lib/google/cloud/redis/credentials.rb
81
108
  - lib/google/cloud/redis/v1beta1.rb
82
109
  - lib/google/cloud/redis/v1beta1/cloud_redis_client.rb
83
110
  - lib/google/cloud/redis/v1beta1/cloud_redis_client_config.json
84
111
  - lib/google/cloud/redis/v1beta1/cloud_redis_pb.rb
85
112
  - lib/google/cloud/redis/v1beta1/cloud_redis_services_pb.rb
113
+ - lib/google/cloud/redis/v1beta1/credentials.rb
86
114
  - lib/google/cloud/redis/v1beta1/doc/google/cloud/redis/v1beta1/cloud_redis.rb
115
+ - lib/google/cloud/redis/v1beta1/doc/google/longrunning/operations.rb
87
116
  - lib/google/cloud/redis/v1beta1/doc/google/protobuf/any.rb
88
117
  - lib/google/cloud/redis/v1beta1/doc/google/protobuf/field_mask.rb
89
118
  - lib/google/cloud/redis/v1beta1/doc/google/protobuf/timestamp.rb
90
119
  - lib/google/cloud/redis/v1beta1/doc/google/rpc/status.rb
91
120
  - lib/google/cloud/redis/v1beta1/doc/overview.rb
92
- homepage: https://github.com/googleapis/googleapis
121
+ homepage: https://github.com/GoogleCloudPlatform/google-cloud-ruby/tree/master/google-cloud-redis
93
122
  licenses:
94
123
  - Apache-2.0
95
124
  metadata: {}
@@ -109,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
138
  version: '0'
110
139
  requirements: []
111
140
  rubyforge_project:
112
- rubygems_version: 2.7.6
141
+ rubygems_version: 2.7.7
113
142
  signing_key:
114
143
  specification_version: 4
115
144
  summary: API Client library for Google Cloud Memorystore for Redis API
@@ -1,30 +0,0 @@
1
- # Copyright 2018 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require "googleauth"
16
-
17
- module Google
18
- module Cloud
19
- module Redis
20
- class Credentials < Google::Auth::Credentials
21
- SCOPE = [
22
- "https://www.googleapis.com/auth/cloud-platform"
23
- ].freeze
24
- PATH_ENV_VARS = %w(REDIS_KEYFILE GOOGLE_CLOUD_KEYFILE GCLOUD_KEYFILE)
25
- JSON_ENV_VARS = %w(REDIS_KEYFILE_JSON GOOGLE_CLOUD_KEYFILE_JSON GCLOUD_KEYFILE_JSON)
26
- DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
27
- end
28
- end
29
- end
30
- end