google-apis-core 0.12.0 → 0.13.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: e2348f0ac304503e08c287b735907645b6a10f684b7b5a11f1a95109afbf2e5f
4
- data.tar.gz: b14ea78945be659f3486b257c22aa9b9ea1e34637bd2ae11fc190e29a6cf790e
3
+ metadata.gz: 5592cfdc5672ba93edd2d35fdd156fe494910815832851915aa10671280f3819
4
+ data.tar.gz: 31ff2f0ba25e5aef16a8a328fae87c79f7e3beabf68254b44b5d0ca5c0af48ef
5
5
  SHA512:
6
- metadata.gz: b6f7769444411932dcdf043dec431114421a8e7d22275a0dd8d4de2e908b4b81757f8974a96431b1f3e9fcbf07869f84d3b0a7f74a6afa485b7c117df0aeb744
7
- data.tar.gz: 7b3cfe83244a183a39f706d7ff4f4f033346a95d42ceb7847c732940aa37e6f59bc3ab1545343eedc817c4f5db7a6e2215ad3e50c31af5d771ff3303bf2aff4d
6
+ metadata.gz: 54c2299ce2530e251f931ac1e5aac2ac4f26a06e24272d4a85dab7f650748ba645149d133c199300bcd4c9931925286f3f5867cb6bf354ff1fc749e84a100a62
7
+ data.tar.gz: 0def58085570f51b1ea1695d8826a81142e78b03b2cd9508268c2a23d7651d86452390198d853757335b2025c17d8db08fbbbec0d46c969412c20a600b9cf129
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 0.13.0 (2024-01-26)
4
+
5
+ #### Features
6
+
7
+ * Verify credential universe domain against configured universe domain ([#17569](https://github.com/googleapis/google-api-ruby-client/issues/17569))
8
+
3
9
  ### 0.12.0 (2024-01-22)
4
10
 
5
11
  #### Features
@@ -336,6 +336,20 @@ module Google
336
336
  return PagedResults.new(self, max: max, items: items, cache: cache, response_page_token: response_page_token, &block)
337
337
  end
338
338
 
339
+ # Verify that the universe domain setting matches the universe domain
340
+ # in the credentials, if present.
341
+ #
342
+ # @raise [Google::Apis::UniverseDomainError] if there is a mismatch
343
+ def verify_universe_domain!
344
+ auth = authorization
345
+ auth_universe_domain = auth.universe_domain if auth.respond_to? :universe_domain
346
+ if auth_universe_domain && auth_universe_domain != universe_domain
347
+ raise UniverseDomainError,
348
+ "Universe domain is #{universe_domain} but credentials are in #{auth_universe_domain}"
349
+ end
350
+ true
351
+ end
352
+
339
353
  protected
340
354
 
341
355
  # Create a new upload command.
@@ -348,6 +362,7 @@ module Google
348
362
  # Request-specific options
349
363
  # @return [Google::Apis::Core::UploadCommand]
350
364
  def make_upload_command(method, path, options)
365
+ verify_universe_domain!
351
366
  template = Addressable::Template.new(root_url + upload_path + path)
352
367
  if batch?
353
368
  command = MultipartUploadCommand.new(method, template, client_version: client_version)
@@ -372,6 +387,7 @@ module Google
372
387
  # Request-specific options
373
388
  # @return [Google::Apis::Core::StorageUploadCommand]
374
389
  def make_storage_upload_command(method, path, options)
390
+ verify_universe_domain!
375
391
  template = Addressable::Template.new(root_url + upload_path + path)
376
392
  command = StorageUploadCommand.new(method, template, client_version: client_version)
377
393
  command.options = request_options.merge(options)
@@ -389,6 +405,7 @@ module Google
389
405
  # Request-specific options
390
406
  # @return [Google::Apis::Core::DownloadCommand]
391
407
  def make_download_command(method, path, options)
408
+ verify_universe_domain!
392
409
  template = Addressable::Template.new(root_url + base_path + path)
393
410
  command = DownloadCommand.new(method, template, client_version: client_version)
394
411
  command.options = request_options.merge(options)
@@ -408,6 +425,7 @@ module Google
408
425
  # Request-specific options
409
426
  # @return [Google::Apis::Core::StorageDownloadCommand]
410
427
  def make_storage_download_command(method, path, options)
428
+ verify_universe_domain!
411
429
  template = Addressable::Template.new(root_url + base_path + path)
412
430
  command = StorageDownloadCommand.new(method, template, client_version: client_version)
413
431
  command.options = request_options.merge(options)
@@ -426,6 +444,7 @@ module Google
426
444
  # Request-specific options
427
445
  # @return [Google::Apis::Core::DownloadCommand]
428
446
  def make_simple_command(method, path, options)
447
+ verify_universe_domain!
429
448
  full_path =
430
449
  if path.start_with? "/"
431
450
  path[1..-1]
@@ -16,7 +16,7 @@ module Google
16
16
  module Apis
17
17
  module Core
18
18
  # Core version
19
- VERSION = "0.12.0".freeze
19
+ VERSION = "0.13.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -89,5 +89,9 @@ module Google
89
89
  # Error class for problems in batch requests.
90
90
  class BatchError < Error
91
91
  end
92
+
93
+ # Error class for universe domain issues
94
+ class UniverseDomainError < Error
95
+ end
92
96
  end
93
97
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-apis-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.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: 2024-01-22 00:00:00.000000000 Z
11
+ date: 2024-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: representable
@@ -166,7 +166,7 @@ licenses:
166
166
  metadata:
167
167
  bug_tracker_uri: https://github.com/googleapis/google-api-ruby-client/issues
168
168
  changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/main/google-apis-core/CHANGELOG.md
169
- documentation_uri: https://googleapis.dev/ruby/google-apis-core/v0.12.0
169
+ documentation_uri: https://googleapis.dev/ruby/google-apis-core/v0.13.0
170
170
  source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/main/google-apis-core
171
171
  post_install_message:
172
172
  rdoc_options: []