google-cloud-pubsub 2.7.1 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55eb80f365cf82b22f7cb9383a88155e0c79e0d5c1e897f2c7ee6cb974e2989b
4
- data.tar.gz: 4417a272576757638dbe5b122e832412303f55761fb6d4d9ae24706ecdc9842f
3
+ metadata.gz: 5d702b4f68714fc0deb23b437d1df3f6a9f7d1d13c0e7b4f4fe40dcf7a48cae2
4
+ data.tar.gz: 1cd4c417d8e44532b10a69c1f6cb824b402ede9ba38731a29315c9b1a2743e16
5
5
  SHA512:
6
- metadata.gz: 8c1a8a9c9e62d737a468fbaca9c3909be1c608ec64d223f7ade2a478870c4e275cfad10e8c743dd213ce2f3d9084271f29cca6ba91205cda224177897d174016
7
- data.tar.gz: 96cd5e4e593894f6c98401c9dff2ca99d7be2acdbb37504f5f53ab72cda2c9e29bde031facd7d779947deb892454716bc151f31d67eddf58b3f8944e46e66018
6
+ metadata.gz: 6a4b139e6a3170baeb92a8aea0e93196ebc39843deede789ad33545ef149aa2c789e49d5976b98b70954073f29dbfd29079067b6924797e3228f7b5a6fdfc77f
7
+ data.tar.gz: ca7cdcf23e8121cc27a0f1876dcccc74013adeec27995a95b342b821fc94cae09586f444b7f80e69991ebb01461f4f3a43364b15e54907972f5cde09582388e8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Release History
2
2
 
3
+ ### 2.8.0 / 2021-08-30
4
+
5
+ #### Features
6
+
7
+ * Add Pub/Sub topic retention fields
8
+ * Add retention to Project#create_topic
9
+ * Add Topic#retention
10
+ * Add Topic#retention=
11
+ * Add Subscription#topic_retention
12
+
3
13
  ### 2.7.1 / 2021-07-08
4
14
 
5
15
  #### Documentation
@@ -238,6 +238,14 @@ module Google
238
238
  # * `JSON` - JSON encoding.
239
239
  # * `BINARY` - Binary encoding, as defined by the schema type. For some
240
240
  # schema types, binary encoding may not be available.
241
+ # @param [Numeric] retention Indicates the minimum number of seconds to retain a message
242
+ # after it is published to the topic. If this field is set, messages published
243
+ # to the topic within the `retention` number of seconds are always available to
244
+ # subscribers. For instance, it allows any attached subscription to [seek to a
245
+ # timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
246
+ # that is up to `retention` number of seconds in the past. If this field is
247
+ # not set, message retention is controlled by settings on individual
248
+ # subscriptions. Cannot be less than 600 (10 minutes) or more than 604,800 (7 days).
241
249
  #
242
250
  # @return [Google::Cloud::PubSub::Topic]
243
251
  #
@@ -253,14 +261,16 @@ module Google
253
261
  persistence_regions: nil,
254
262
  async: nil,
255
263
  schema_name: nil,
256
- message_encoding: nil
264
+ message_encoding: nil,
265
+ retention: nil
257
266
  ensure_service!
258
267
  grpc = service.create_topic topic_name,
259
268
  labels: labels,
260
269
  kms_key_name: kms_key,
261
270
  persistence_regions: persistence_regions,
262
271
  schema_name: schema_name,
263
- message_encoding: message_encoding
272
+ message_encoding: message_encoding,
273
+ retention: retention
264
274
  Topic.from_grpc grpc, service, async: async
265
275
  end
266
276
  alias new_topic create_topic
@@ -127,6 +127,7 @@ module Google
127
127
  persistence_regions: nil,
128
128
  schema_name: nil,
129
129
  message_encoding: nil,
130
+ retention: nil,
130
131
  options: {}
131
132
  if persistence_regions
132
133
  message_storage_policy = Google::Cloud::PubSub::V1::MessageStoragePolicy.new(
@@ -145,11 +146,12 @@ module Google
145
146
  end
146
147
 
147
148
  publisher.create_topic \
148
- name: topic_path(topic_name, options),
149
- labels: labels,
150
- kms_key_name: kms_key_name,
151
- message_storage_policy: message_storage_policy,
152
- schema_settings: schema_settings
149
+ name: topic_path(topic_name, options),
150
+ labels: labels,
151
+ kms_key_name: kms_key_name,
152
+ message_storage_policy: message_storage_policy,
153
+ schema_settings: schema_settings,
154
+ message_retention_duration: Convert.number_to_duration(retention)
153
155
  end
154
156
 
155
157
  def update_topic topic_obj, *fields
@@ -168,9 +168,8 @@ module Google
168
168
  # backlog, from the moment a message is published. If
169
169
  # {#retain_acked} is `true`, then this also configures the retention of
170
170
  # acknowledged messages, and thus configures how far back in time a
171
- # {#seek} can be done. Cannot be more than 604,800 seconds (7 days) or
172
- # less than 600 seconds (10 minutes). Default is 604,800 seconds (7
173
- # days).
171
+ # {#seek} can be done. Cannot be less than 600 (10 minutes) or more
172
+ # than 604,800 (7 days). Default is 604,800 seconds (7 days).
174
173
  #
175
174
  # Makes an API call to retrieve the retention value when called on a
176
175
  # reference object. See {#reference?}.
@@ -195,6 +194,24 @@ module Google
195
194
  @resource_name = nil
196
195
  end
197
196
 
197
+ ##
198
+ # Indicates the minimum duration for which a message is retained after
199
+ # it is published to the subscription's topic. If this field is set,
200
+ # messages published to the subscription's topic in the last
201
+ # `topic_message_retention_duration` are always available to subscribers.
202
+ # Output only. See {Topic#retention}.
203
+ #
204
+ # Makes an API call to retrieve the retention value when called on a
205
+ # reference object. See {#reference?}.
206
+ #
207
+ # @return [Numeric, nil] The topic message retention duration in seconds,
208
+ # or `nil` if not set.
209
+ #
210
+ def topic_retention
211
+ ensure_grpc!
212
+ Convert.duration_to_number @grpc.topic_message_retention_duration
213
+ end
214
+
198
215
  ##
199
216
  # Returns the URL locating the endpoint to which messages should be
200
217
  # pushed. For example, a Webhook endpoint might use
@@ -305,6 +305,43 @@ module Google
305
305
  message_encoding.to_s.upcase == "JSON"
306
306
  end
307
307
 
308
+ ##
309
+ # Indicates the minimum number of seconds to retain a message after it is
310
+ # published to the topic. If this field is set, messages published to the topic
311
+ # within the `retention` number of seconds are always available to subscribers.
312
+ # For instance, it allows any attached subscription to [seek to a
313
+ # timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
314
+ # that is up to `retention` number of seconds in the past. If this field is
315
+ # not set, message retention is controlled by settings on individual
316
+ # subscriptions. Cannot be less than 600 (10 minutes) or more than 604,800 (7 days).
317
+ # See {#retention=}.
318
+ #
319
+ # Makes an API call to retrieve the retention value when called on a
320
+ # reference object. See {#reference?}.
321
+ #
322
+ # @return [Numeric, nil] The message retention duration in seconds, or `nil` if not set.
323
+ #
324
+ def retention
325
+ ensure_grpc!
326
+ Convert.duration_to_number @grpc.message_retention_duration
327
+ end
328
+
329
+ ##
330
+ # Sets the message retention duration in seconds. If set to a positive duration
331
+ # between 600 (10 minutes) and 604,800 (7 days), inclusive, the message retention
332
+ # duration is changed. If set to `nil`, this clears message retention duration
333
+ # from the topic. See {#retention}.
334
+ #
335
+ # @param [Numeric, nil] new_retention The new message retention duration value.
336
+ #
337
+ def retention= new_retention
338
+ new_retention_duration = Convert.number_to_duration new_retention
339
+ update_grpc = Google::Cloud::PubSub::V1::Topic.new name: name,
340
+ message_retention_duration: new_retention_duration
341
+ @grpc = service.update_topic update_grpc, :message_retention_duration
342
+ @resource_name = nil
343
+ end
344
+
308
345
  ##
309
346
  # Permanently deletes the topic.
310
347
  #
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "2.7.1".freeze
19
+ VERSION = "2.8.0".freeze
20
20
  end
21
21
 
22
22
  Pubsub = PubSub unless const_defined? :Pubsub
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-07-08 00:00:00.000000000 Z
12
+ date: 2021-08-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby