google-cloud-pubsub 2.15.4 → 2.16.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: 917128878f11c491c30e0e8b68a56b5a6da8ce423d6da5afeed1b78adba8e175
4
- data.tar.gz: ecf1a403989e28f5984056230629d649aa2e6f9c7d37fa713f62a52a3d464064
3
+ metadata.gz: 35cc037d6f0aede3871e054b4e0b9a1e05cee0423b88bf690fc86b9fc8f1aade
4
+ data.tar.gz: 0d2f6d0b84f496f18772b7437e611d0f28c615e063ad6ef2ec7f0d0d5ddb6d13
5
5
  SHA512:
6
- metadata.gz: 3a740219b3c2267802c22b2cc8b06be110006918e4ee4c48f06aeac368fb2a86c530cbd549dafb27e722a321fb5d2c87ca8b74921ef6a89c9bf7d084518fc3ae
7
- data.tar.gz: ed5f36229f08a9395232f4770c78c3b9e5a0c6e77fdf0d324db83b636359e13b3e7eb16be71481de0feb4275f899da05c5fd78c3eb85a9d97c318c73c737affc
6
+ metadata.gz: 95e2bd59d4810cf9db705f5a3078d75950c2ceae5908a8d43613f1fc0d0dcf68beb8d13fdef39584ef00bd14b3cb1201327a87b07bbbfe9a5d684c12e6902248
7
+ data.tar.gz: c50f46c0f07df73a2e3c4490c91a35fae5380c48276bc5513860ec9401dedf7c5ed0415e9375adc7b17259f6e84c0e8f76ede1162f649a7c8cf8b2bf7aceefb3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Release History
2
2
 
3
+ ### 2.16.0 (2024-01-25)
4
+
5
+ #### Features
6
+
7
+ * Support for universe_domain ([#24437](https://github.com/googleapis/google-cloud-ruby/issues/24437))
8
+
9
+ ### 2.15.5 (2023-11-06)
10
+
11
+ #### Bug Fixes
12
+
13
+ * set x-goog-request-params for streaming pull request ([#23508](https://github.com/googleapis/google-cloud-ruby/issues/23508))
14
+
15
+ ### 2.15.4 (2023-05-19)
16
+
17
+ #### Documentation
18
+
19
+ * Fixed broken links in authentication documentation ([#21619](https://github.com/googleapis/google-cloud-ruby/issues/21619))
20
+
3
21
  ### 2.15.4 (2023-05-18)
4
22
 
5
23
  #### Documentation
@@ -76,6 +76,15 @@ module Google
76
76
  end
77
77
  alias project project_id
78
78
 
79
+ ##
80
+ # The universe domain the client is connected to
81
+ #
82
+ # @return [String]
83
+ #
84
+ def universe_domain
85
+ service.universe_domain
86
+ end
87
+
79
88
  ##
80
89
  # Retrieves topic by name.
81
90
  #
@@ -37,14 +37,17 @@ module Google
37
37
  # value to be replaced for unit testing.
38
38
  attr_accessor :client_id
39
39
 
40
+ attr_reader :universe_domain
41
+
40
42
  ##
41
43
  # Creates a new Service instance.
42
- def initialize project, credentials, host: nil, timeout: nil
44
+ def initialize project, credentials, host: nil, timeout: nil, universe_domain: nil
43
45
  @project = project
44
46
  @credentials = credentials
45
47
  @host = host
46
48
  @timeout = timeout
47
49
  @client_id = SecureRandom.uuid.freeze
50
+ @universe_domain = universe_domain || ENV["GOOGLE_CLOUD_UNIVERSE_DOMAIN"] || "googleapis.com"
48
51
  end
49
52
 
50
53
  def subscriber
@@ -53,6 +56,7 @@ module Google
53
56
  config.credentials = credentials if credentials
54
57
  override_client_config_timeouts config if timeout
55
58
  config.endpoint = host if host
59
+ config.universe_domain = universe_domain
56
60
  config.lib_name = "gccl"
57
61
  config.lib_version = Google::Cloud::PubSub::VERSION
58
62
  config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}" }
@@ -66,6 +70,7 @@ module Google
66
70
  config.credentials = credentials if credentials
67
71
  override_client_config_timeouts config if timeout
68
72
  config.endpoint = host if host
73
+ config.universe_domain = universe_domain
69
74
  config.lib_name = "gccl"
70
75
  config.lib_version = Google::Cloud::PubSub::VERSION
71
76
  config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}" }
@@ -75,13 +80,15 @@ module Google
75
80
 
76
81
  def iam
77
82
  return mocked_iam if mocked_iam
78
- @iam ||= V1::IAMPolicy::Client.new do |config|
79
- config.credentials = credentials if credentials
80
- override_client_config_timeouts config if timeout
81
- config.endpoint = host if host
82
- config.lib_name = "gccl"
83
- config.lib_version = Google::Cloud::PubSub::VERSION
84
- config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}" }
83
+ @iam ||= begin
84
+ iam = (@publisher || @subscriber || @schemas || subscriber).iam_policy_client
85
+ iam.configure do |config|
86
+ override_client_config_timeouts config if timeout
87
+ config.lib_name = "gccl"
88
+ config.lib_version = Google::Cloud::PubSub::VERSION
89
+ config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}" }
90
+ end
91
+ iam
85
92
  end
86
93
  end
87
94
  attr_accessor :mocked_iam
@@ -92,6 +99,7 @@ module Google
92
99
  config.credentials = credentials if credentials
93
100
  override_client_config_timeouts config if timeout
94
101
  config.endpoint = host if host
102
+ config.universe_domain = universe_domain
95
103
  config.lib_name = "gccl"
96
104
  config.lib_version = Google::Cloud::PubSub::VERSION
97
105
  config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}" }
@@ -240,8 +248,8 @@ module Google
240
248
  return_immediately: return_immediately
241
249
  end
242
250
 
243
- def streaming_pull request_enum
244
- subscriber.streaming_pull request_enum
251
+ def streaming_pull request_enum, options = {}
252
+ subscriber.streaming_pull request_enum, options
245
253
  end
246
254
 
247
255
  ##
@@ -231,7 +231,8 @@ module Google
231
231
  end
232
232
 
233
233
  # Call the StreamingPull API to get the response enumerator
234
- enum = @subscriber.service.streaming_pull @request_queue.each
234
+ options = { :"metadata" => { :"x-goog-request-params" => @subscriber.subscription_name } }
235
+ enum = @subscriber.service.streaming_pull @request_queue.each, options
235
236
 
236
237
  loop do
237
238
  synchronize do
@@ -253,7 +254,7 @@ module Google
253
254
  # Use synchronize so changes happen atomically
254
255
  synchronize do
255
256
  update_min_duration_per_lease_extension new_exactly_once_delivery_enabled
256
- @exactly_once_delivery_enabled = new_exactly_once_delivery_enabled unless new_exactly_once_delivery_enabled.nil?
257
+ @exactly_once_delivery_enabled = new_exactly_once_delivery_enabled unless new_exactly_once_delivery_enabled.nil?
257
258
  @subscriber.exactly_once_delivery_enabled = @exactly_once_delivery_enabled
258
259
 
259
260
  # Create receipt of received messages reception
@@ -271,7 +272,7 @@ module Google
271
272
  # No need to synchronize the callback future
272
273
  register_callback rec_msg
273
274
  end if !@exactly_once_delivery_enabled # Exactly once delivery scenario is handled by callback
274
-
275
+
275
276
  synchronize { pause_streaming! }
276
277
  rescue StopIteration
277
278
  break
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "2.15.4".freeze
19
+ VERSION = "2.16.0".freeze
20
20
  end
21
21
 
22
22
  Pubsub = PubSub unless const_defined? :Pubsub
@@ -62,6 +62,7 @@ module Google
62
62
  # @param [String] project Alias for the `project_id` argument. Deprecated.
63
63
  # @param [String] keyfile Alias for the `credentials` argument.
64
64
  # Deprecated.
65
+ # @param universe_domain [String] A custom universe domain. Optional.
65
66
  #
66
67
  # @return [Google::Cloud::PubSub::Project]
67
68
  #
@@ -77,34 +78,36 @@ module Google
77
78
  credentials: nil,
78
79
  scope: nil,
79
80
  timeout: nil,
81
+ universe_domain: nil,
80
82
  endpoint: nil,
81
83
  emulator_host: nil,
82
84
  project: nil,
83
85
  keyfile: nil
84
- project_id ||= (project || default_project_id)
85
- scope ||= configure.scope
86
- timeout ||= configure.timeout
87
- endpoint ||= configure.endpoint
86
+ project_id ||= (project || default_project_id)
87
+ scope ||= configure.scope
88
+ timeout ||= configure.timeout
89
+ endpoint ||= configure.endpoint
90
+ universe_domain ||= configure.universe_domain
88
91
  emulator_host ||= configure.emulator_host
89
92
 
90
93
  if emulator_host
91
- project_id = project_id.to_s # Always cast to a string
92
- raise ArgumentError, "project_id is missing" if project_id.empty?
93
-
94
- service = PubSub::Service.new project_id, :this_channel_is_insecure, host: emulator_host, timeout: timeout
95
- return PubSub::Project.new service
96
- end
97
-
98
- credentials ||= (keyfile || default_credentials(scope: scope))
99
- unless credentials.is_a? Google::Auth::Credentials
100
- credentials = PubSub::Credentials.new credentials, scope: scope
94
+ credentials = :this_channel_is_insecure
95
+ endpoint = emulator_host
96
+ else
97
+ credentials ||= (keyfile || default_credentials(scope: scope))
98
+ unless credentials.is_a? Google::Auth::Credentials
99
+ credentials = PubSub::Credentials.new credentials, scope: scope
100
+ end
101
101
  end
102
102
 
103
103
  project_id ||= credentials.project_id if credentials.respond_to? :project_id
104
104
  project_id = project_id.to_s # Always cast to a string
105
105
  raise ArgumentError, "project_id is missing" if project_id.empty?
106
106
 
107
- service = PubSub::Service.new project_id, credentials, host: endpoint, timeout: timeout
107
+ service = PubSub::Service.new project_id, credentials,
108
+ host: endpoint,
109
+ timeout: timeout,
110
+ universe_domain: universe_domain
108
111
  PubSub::Project.new service
109
112
  end
110
113
 
@@ -110,7 +110,7 @@ module Google
110
110
  end
111
111
 
112
112
  # Set the default pubsub configuration
113
- Google::Cloud.configure.add_config! :pubsub do |config|
113
+ Google::Cloud.configure.add_config! :pubsub do |config| # rubocop:disable Metrics/BlockLength
114
114
  default_project = Google::Cloud::Config.deferred do
115
115
  ENV["PUBSUB_PROJECT"]
116
116
  end
@@ -136,5 +136,6 @@ Google::Cloud.configure.add_config! :pubsub do |config|
136
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
- config.add_field! :endpoint, "pubsub.googleapis.com", match: String
139
+ config.add_field! :endpoint, nil, match: String
140
+ config.add_field! :universe_domain, nil, match: String
140
141
  end
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.15.4
4
+ version: 2.16.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: 2023-05-19 00:00:00.000000000 Z
12
+ date: 2024-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '0.8'
48
+ version: '0.20'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '0.8'
55
+ version: '0.20'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: retriable
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
291
  - !ruby/object:Gem::Version
292
292
  version: '0'
293
293
  requirements: []
294
- rubygems_version: 3.4.2
294
+ rubygems_version: 3.5.3
295
295
  signing_key:
296
296
  specification_version: 4
297
297
  summary: API Client library for Google Cloud Pub/Sub