google-cloud-pubsub 2.15.5 → 2.16.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: e2a4108df2f16d93f03bb560375274bb816a5958c8c0ad22ca061943ef40ee24
4
- data.tar.gz: 8efa65c9aed030d0b1832aa8d0aec7ef4e9d8605a427bef6517cf77d9e363d5c
3
+ metadata.gz: 35cc037d6f0aede3871e054b4e0b9a1e05cee0423b88bf690fc86b9fc8f1aade
4
+ data.tar.gz: 0d2f6d0b84f496f18772b7437e611d0f28c615e063ad6ef2ec7f0d0d5ddb6d13
5
5
  SHA512:
6
- metadata.gz: 1599c8a8adac4fdde84b5782cfa4f4f8c236528452966496a9fce7343b05076772a6c071f99114d7bb93813d0707975e892c262a30616ed13232ce85dfe1b63d
7
- data.tar.gz: 1c661569d004bfc3abd20e60938cad744faa5b474a8df6a67f0b6c36e6c428744e76703fc25e73d20298372894880a40a963a923e21059cd9f4f5454c4b65c01
6
+ metadata.gz: 95e2bd59d4810cf9db705f5a3078d75950c2ceae5908a8d43613f1fc0d0dcf68beb8d13fdef39584ef00bd14b3cb1201327a87b07bbbfe9a5d684c12e6902248
7
+ data.tar.gz: c50f46c0f07df73a2e3c4490c91a35fae5380c48276bc5513860ec9401dedf7c5ed0415e9375adc7b17259f6e84c0e8f76ede1162f649a7c8cf8b2bf7aceefb3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ### 2.15.5 (2023-11-06)
4
10
 
5
11
  #### Bug Fixes
@@ -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}" }
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "2.15.5".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.5
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-11-06 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.19
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