google-cloud-pubsub 2.7.0 → 2.9.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: f6636ac65229c0dc438c63fa9aebda474396701364bfbea7e5da460ceea50a26
4
- data.tar.gz: a0c0cafbbaf4083c1141d851dc6cecb8cb70bc01df940a139fe21d057aa2fb97
3
+ metadata.gz: e56f8ca6212ea03d9ede9593222eda8574a047d56e9c60e3149b722eb4951197
4
+ data.tar.gz: ac2802eb09654de3efb5011fd15d49f3a51a2ae0b794bee78a4b955adf5748d2
5
5
  SHA512:
6
- metadata.gz: a187e9935196b66d4be65c7cf7b34148de36197f9e2c5e9144ccc9f78652370d7a441b33e14a002133b05aa6565cc38998912277e8896d81178bf5712ce9df8c
7
- data.tar.gz: ee801f9d5959f5e2a38ccf13beaac930ca4629c81a268b627a8bacc7ad9ce430581fd690100fa5ef57b4fa5e20e3c5f40d72e905ce2535d978398f03112a48eb
6
+ metadata.gz: 3dc04aba0cecb3560aa8c667b3e9c79be288f14db5060d9624138f552bfdfe6cdfcc9a3114a977dbeb2918c94527ab166bd111711755796b40b6a672789b6a92
7
+ data.tar.gz: ae94d8fe7a07afb8a893f3b5ddc102b0b01a4b7649f84c5cda27c6e57dbe535adf8b87c6cc22f0f96af117464efa04997b4db54c6775d5f9fad43d0ea14550e1
data/AUTHENTICATION.md CHANGED
@@ -96,7 +96,8 @@ client = Google::Cloud::PubSub.new
96
96
 
97
97
  ### Configuration
98
98
 
99
- The **Project ID** and **Credentials JSON** can be configured instead of placing them in environment variables or providing them as arguments.
99
+ The **Project ID** and the path to the **Credentials JSON** file can be configured
100
+ instead of placing them in environment variables or providing them as arguments.
100
101
 
101
102
  ```ruby
102
103
  require "google/cloud/pubsub"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Release History
2
2
 
3
+ ### 2.9.0 / 2021-10-28
4
+
5
+ #### Features
6
+
7
+ * Expand timeout type from Integer to Numeric
8
+ * feat: Expand timeout type from Integer to Numeric. This is backwards-compatible.
9
+ * Change timeout from Integer to Numeric in Google::Cloud.pubsub
10
+ * Change timeout from Integer to Numeric in Google::Cloud#pubsub
11
+ * Change timeout from Integer to Numeric in Google::Cloud::PubSub.configure
12
+ * Change timeout from Integer to Numeric in Google::Cloud::PubSub.new
13
+ * fix: Propagate timeout to client RPC configs.
14
+
15
+ #### Documentation
16
+
17
+ * Add documentation for quota_project Configuration attribute
18
+ * Fix documentation for PubSub.configure
19
+ * Remove retries property that does not exist in code.
20
+
21
+ ### 2.8.1 / 2021-09-22
22
+
23
+ #### Bug Fixes
24
+
25
+ * Change IAM and Schema client metadata hash keys to symbols
26
+
27
+ #### Documentation
28
+
29
+ * Fix typo in Emulator guide links
30
+
31
+ ### 2.8.0 / 2021-08-30
32
+
33
+ #### Features
34
+
35
+ * Add Pub/Sub topic retention fields
36
+ * Add retention to Project#create_topic
37
+ * Add Topic#retention
38
+ * Add Topic#retention=
39
+ * Add Subscription#topic_retention
40
+
41
+ ### 2.7.1 / 2021-07-08
42
+
43
+ #### Documentation
44
+
45
+ * Update AUTHENTICATION.md in handwritten packages
46
+
3
47
  ### 2.7.0 / 2021-06-15
4
48
 
5
49
  #### Features
data/OVERVIEW.md CHANGED
@@ -524,5 +524,5 @@ sub.topic.name #=> "projects/other-project-id/topics/other-topic"
524
524
  ## Additional information
525
525
 
526
526
  Google Cloud Pub/Sub can be configured to use an emulator or to enable gRPC's
527
- logging. To learn more, see the {file:EMULATOR.md Emulator guide}} and
527
+ logging. To learn more, see the {file:EMULATOR.md Emulator guide} and
528
528
  {file:LOGGING.md Logging guide}.
@@ -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
@@ -51,7 +51,7 @@ module Google
51
51
  return mocked_subscriber if mocked_subscriber
52
52
  @subscriber ||= V1::Subscriber::Client.new do |config|
53
53
  config.credentials = credentials if credentials
54
- config.timeout = timeout if timeout
54
+ override_client_config_timeouts config if timeout
55
55
  config.endpoint = host if host
56
56
  config.lib_name = "gccl"
57
57
  config.lib_version = Google::Cloud::PubSub::VERSION
@@ -64,7 +64,7 @@ module Google
64
64
  return mocked_publisher if mocked_publisher
65
65
  @publisher ||= V1::Publisher::Client.new do |config|
66
66
  config.credentials = credentials if credentials
67
- config.timeout = timeout if timeout
67
+ override_client_config_timeouts config if timeout
68
68
  config.endpoint = host if host
69
69
  config.lib_name = "gccl"
70
70
  config.lib_version = Google::Cloud::PubSub::VERSION
@@ -77,11 +77,11 @@ module Google
77
77
  return mocked_iam if mocked_iam
78
78
  @iam ||= V1::IAMPolicy::Client.new do |config|
79
79
  config.credentials = credentials if credentials
80
- config.timeout = timeout if timeout
80
+ override_client_config_timeouts config if timeout
81
81
  config.endpoint = host if host
82
82
  config.lib_name = "gccl"
83
83
  config.lib_version = Google::Cloud::PubSub::VERSION
84
- config.metadata = { "google-cloud-resource-prefix" => "projects/#{@project}" }
84
+ config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}" }
85
85
  end
86
86
  end
87
87
  attr_accessor :mocked_iam
@@ -90,11 +90,11 @@ module Google
90
90
  return mocked_schemas if mocked_schemas
91
91
  @schemas ||= V1::SchemaService::Client.new do |config|
92
92
  config.credentials = credentials if credentials
93
- config.timeout = timeout if timeout
93
+ override_client_config_timeouts config if timeout
94
94
  config.endpoint = host if host
95
95
  config.lib_name = "gccl"
96
96
  config.lib_version = Google::Cloud::PubSub::VERSION
97
- config.metadata = { "google-cloud-resource-prefix" => "projects/#{@project}" }
97
+ config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}" }
98
98
  end
99
99
  end
100
100
  attr_accessor :mocked_schemas
@@ -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
@@ -459,6 +461,18 @@ module Google
459
461
 
460
462
  protected
461
463
 
464
+ # Set the timeout in the client config.
465
+ # Override the default timeout in each individual RPC config as well, since when they are non-nil, these
466
+ # defaults have precedence over the top-level config.timeout. See Gapic::CallOptions#apply_defaults.
467
+ def override_client_config_timeouts config
468
+ config.timeout = timeout
469
+ rpc_names = config.rpcs.methods - Object.methods
470
+ rpc_names.each do |rpc_name|
471
+ rpc = config.rpcs.send rpc_name
472
+ rpc.timeout = timeout if rpc.respond_to? :timeout=
473
+ end
474
+ end
475
+
462
476
  def a_time? obj
463
477
  return false unless obj.respond_to? :to_time
464
478
  # Rails' String#to_time returns nil if the string doesn't parse.
@@ -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.0".freeze
19
+ VERSION = "2.9.0".freeze
20
20
  end
21
21
 
22
22
  Pubsub = PubSub unless const_defined? :Pubsub
@@ -54,7 +54,7 @@ module Google
54
54
  # The default scope is:
55
55
  #
56
56
  # * `https://www.googleapis.com/auth/pubsub`
57
- # @param [Integer] timeout Default timeout to use in requests. Optional.
57
+ # @param [Numeric] timeout Default timeout to use in requests. Optional.
58
58
  # @param [String] endpoint Override of the endpoint host name. Optional.
59
59
  # If the param is nil, uses the default endpoint.
60
60
  # @param [String] emulator_host Pub/Sub emulator host. Optional.
@@ -121,9 +121,9 @@ module Google
121
121
  # parameter `keyfile` is considered deprecated, but may also be used.)
122
122
  # * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
123
123
  # the set of resources and operations that the connection can access.
124
- # * `retries` - (Integer) Number of times to retry requests on server
125
- # error.
126
- # * `timeout` - (Integer) Default timeout to use in requests.
124
+ # * `quota_project` - (String) The project ID for a project that can be
125
+ # used by client libraries for quota and billing purposes.
126
+ # * `timeout` - (Numeric) Default timeout to use in requests.
127
127
  # * `endpoint` - (String) Override of the endpoint host name, or `nil`
128
128
  # to use the default endpoint.
129
129
  # * `emulator_host` - (String) Host name of the emulator. Defaults to
@@ -41,7 +41,7 @@ module Google
41
41
  # The default scope is:
42
42
  #
43
43
  # * `https://www.googleapis.com/auth/pubsub`
44
- # @param [Integer] timeout Default timeout to use in requests. Optional.
44
+ # @param [Numeric] timeout Default timeout to use in requests. Optional.
45
45
  #
46
46
  # @return [Google::Cloud::PubSub::Project]
47
47
  #
@@ -87,7 +87,7 @@ module Google
87
87
  # The default scope is:
88
88
  #
89
89
  # * `https://www.googleapis.com/auth/pubsub`
90
- # @param [Integer] timeout Default timeout to use in requests. Optional.
90
+ # @param [Numeric] timeout Default timeout to use in requests. Optional.
91
91
  #
92
92
  # @return [Google::Cloud::PubSub::Project]
93
93
  #
@@ -133,7 +133,7 @@ Google::Cloud.configure.add_config! :pubsub do |config|
133
133
  config.add_alias! :keyfile, :credentials
134
134
  config.add_field! :scope, default_scopes, match: [String, Array]
135
135
  config.add_field! :quota_project, nil, match: String
136
- config.add_field! :timeout, nil, match: Integer
136
+ config.add_field! :timeout, nil, match: Numeric
137
137
  config.add_field! :emulator_host, default_emulator, match: String, allow_nil: true
138
138
  config.add_field! :on_error, nil, match: Proc
139
139
  config.add_field! :endpoint, "pubsub.googleapis.com", match: String
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.0
4
+ version: 2.9.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-06-15 00:00:00.000000000 Z
12
+ date: 2021-10-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby