google-cloud-storage 1.46.0 → 1.48.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: 9180138623d24136aba3789a2999158c8e1936ccc483be54e96d7ad5ce0270cd
4
- data.tar.gz: db71d2a866acb5b3c63a55d26393ef4d4b05dbdbdc529f51b4e8343d0674ec3d
3
+ metadata.gz: a77b42f7925425dc6cc14c9676292017c15db9826ff30221112dfcf4eea9594b
4
+ data.tar.gz: 6f3398d6858494cf5cec59a274d9f15395d302257aba7f016d66ebc6bdb52cd9
5
5
  SHA512:
6
- metadata.gz: 33f397b67897fb16738284a45998c6df621cf7cc7a26cf57582c092ec0ff40b3fa38c2cc7a74489ff46debcad240cb82a1e4293302dd0eb6214e261aa7972e4d
7
- data.tar.gz: d52e0f8e792f8dc9359d24c58cba4c1dbc7714114078be630c40ce8d652bef3e4b336785c3b7f440b6df41f61f2699fa69d3073113e1c985a504d69a24debf2c
6
+ metadata.gz: 60877c029fd33a3a0840463d09bf6eb6fe4b8355ace365e83e720cf5cf6c07de6a32b3be6b9c74be98cdc0c3331b05d6f08b4c4b25ff0d672da89584e9f66554
7
+ data.tar.gz: e46861398365f3e4c8c6793bd013f7dbaeba7c774c11bb4a928ae6c1d14edec9ba45fe1038b382f6be7e590bd718dbfd641a04569f0d6ad701ada18a548cdc56
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Release History
2
2
 
3
+ ### 1.48.0 (2024-01-25)
4
+
5
+ #### Features
6
+
7
+ * Support for universe_domain ([#24449](https://github.com/googleapis/google-cloud-ruby/issues/24449))
8
+
9
+ ### 1.47.0 (2024-01-09)
10
+
11
+ #### Features
12
+
13
+ * support for object lock / retention ([#23732](https://github.com/googleapis/google-cloud-ruby/issues/23732))
14
+
3
15
  ### 1.46.0 (2024-01-08)
4
16
 
5
17
  #### Features
@@ -118,6 +118,15 @@ module Google
118
118
  @gapi.autoclass
119
119
  end
120
120
 
121
+ ##
122
+ # The object retention configuration of the bucket
123
+ #
124
+ # @return [Google::Apis::StorageV1::Bucket::ObjectRetention]
125
+ #
126
+ def object_retention
127
+ @gapi.object_retention
128
+ end
129
+
121
130
  ##
122
131
  # The name of the bucket.
123
132
  #
@@ -825,6 +825,9 @@ module Google
825
825
  # @param [Integer] if_metageneration_not_match Makes the operation
826
826
  # conditional on whether the file's current metageneration does not
827
827
  # match the given value.
828
+ # @param [Boolean] override_unlocked_retention
829
+ # Must be true to remove the retention configuration, reduce its unlocked
830
+ # retention period, or change its mode from unlocked to locked.
828
831
  #
829
832
  # @yield [file] a block yielding a delegate object for updating the file
830
833
  #
@@ -865,7 +868,8 @@ module Google
865
868
  if_generation_match: nil,
866
869
  if_generation_not_match: nil,
867
870
  if_metageneration_match: nil,
868
- if_metageneration_not_match: nil
871
+ if_metageneration_not_match: nil,
872
+ override_unlocked_retention: nil
869
873
  updater = Updater.new gapi
870
874
  yield updater
871
875
  updater.check_for_changed_metadata!
@@ -875,7 +879,8 @@ module Google
875
879
  if_generation_match: if_generation_match,
876
880
  if_generation_not_match: if_generation_not_match,
877
881
  if_metageneration_match: if_metageneration_match,
878
- if_metageneration_not_match: if_metageneration_not_match
882
+ if_metageneration_not_match: if_metageneration_not_match,
883
+ override_unlocked_retention: override_unlocked_retention
879
884
  end
880
885
 
881
886
  ##
@@ -1560,6 +1565,64 @@ module Google
1560
1565
  true
1561
1566
  end
1562
1567
 
1568
+ # Mode of object level retention configuration.
1569
+ # Valid values are 'Locked' or 'Unlocked'
1570
+ #
1571
+ # @return [String]
1572
+ def retention_mode
1573
+ @gapi.retention&.mode
1574
+ end
1575
+
1576
+ # The earliest time in RFC 3339 UTC "Zulu" format that the object can
1577
+ # be deleted or replaced.
1578
+ #
1579
+ # @return [DateTime]
1580
+ def retention_retain_until_time
1581
+ @gapi.retention&.retain_until_time
1582
+ end
1583
+
1584
+ # A collection of object level retention parameters.
1585
+ # The full list of available options are outlined at the [JSON API docs]
1586
+ # (https://cloud.google.com/storage/docs/json_api/v1/objects/insert#request-body).
1587
+ #
1588
+ # @return [Google::Apis::StorageV1::Object::Retention]
1589
+ def retention
1590
+ @gapi.retention
1591
+ end
1592
+
1593
+ ##
1594
+ # Update method to update retention parameter of an object / file
1595
+ # It accepts params as a Hash of attributes in the following format:
1596
+ #
1597
+ # { mode: 'Locked|Unlocked', retain_until_time: '2023-12-19T03:22:23+00:00' }
1598
+ #
1599
+ # @param [Hash(String => String)] new_retention_attributes
1600
+ #
1601
+ # @example Update retention parameters for the File / Object
1602
+ # require "google/cloud/storage"
1603
+ # storage = Google::Cloud::Storage.new
1604
+ # bucket = storage.bucket "my-bucket"
1605
+ # file = bucket.file "avatars/heidi/400x400.png"
1606
+ # retention_params = { mode: 'Unlocked', retain_until_time: '2023-12-19T03:22:23+00:00'.to_datetime }
1607
+ # file.retention = retention_params
1608
+ #
1609
+ # @example Update retention parameters for the File / Object with override enabled
1610
+ # require "google/cloud/storage"
1611
+ # storage = Google::Cloud::Storage.new
1612
+ # bucket = storage.bucket "my-bucket"
1613
+ # file = bucket.file "avatars/heidi/400x400.png"
1614
+ # retention_params = { mode: 'Unlocked',
1615
+ # retain_until_time: '2023-12-19T03:22:23+00:00'.to_datetime,
1616
+ # override_unlocked_retention: true }
1617
+ # file.retention = retention_params
1618
+ #
1619
+ def retention= new_retention_attributes
1620
+ @gapi.retention ||= Google::Apis::StorageV1::Object::Retention.new
1621
+ @gapi.retention.mode = new_retention_attributes[:mode]
1622
+ @gapi.retention.retain_until_time = new_retention_attributes[:retain_until_time]
1623
+ update_gapi! :retention, override_unlocked_retention: new_retention_attributes[:override_unlocked_retention]
1624
+ end
1625
+
1563
1626
  ##
1564
1627
  # Public URL to access the file. If the file is not public, requests to
1565
1628
  # the URL will return an error. (See {File::Acl#public!} and
@@ -2015,7 +2078,8 @@ module Google
2015
2078
  if_generation_match: nil,
2016
2079
  if_generation_not_match: nil,
2017
2080
  if_metageneration_match: nil,
2018
- if_metageneration_not_match: nil
2081
+ if_metageneration_not_match: nil,
2082
+ override_unlocked_retention: nil
2019
2083
  attributes = Array(attributes)
2020
2084
  attributes.flatten!
2021
2085
  return if attributes.empty?
@@ -2044,7 +2108,8 @@ module Google
2044
2108
  if_generation_not_match: if_generation_not_match,
2045
2109
  if_metageneration_match: if_metageneration_match,
2046
2110
  if_metageneration_not_match: if_metageneration_not_match,
2047
- user_project: user_project
2111
+ user_project: user_project,
2112
+ override_unlocked_retention: override_unlocked_retention
2048
2113
  end
2049
2114
  end
2050
2115
 
@@ -62,6 +62,15 @@ module Google
62
62
  @service = service
63
63
  end
64
64
 
65
+ ##
66
+ # The universe domain the client is connected to
67
+ #
68
+ # @return [String]
69
+ #
70
+ def universe_domain
71
+ service.universe_domain
72
+ end
73
+
65
74
  ##
66
75
  # The Storage project connected to.
67
76
  #
@@ -372,6 +381,8 @@ module Google
372
381
  # bucket instance and its files.
373
382
  #
374
383
  # See also {Bucket#requester_pays=} and {Bucket#requester_pays}.
384
+ # @param [Boolean] enable_object_retention
385
+ # When set to true, object retention is enabled for this bucket.
375
386
  #
376
387
  # @yield [bucket] a block for configuring the bucket before it is
377
388
  # created
@@ -386,6 +397,13 @@ module Google
386
397
  #
387
398
  # bucket = storage.create_bucket "my-bucket"
388
399
  #
400
+ # @example
401
+ # require "google/cloud/storage"
402
+ #
403
+ # storage = Google::Cloud::Storage.new
404
+ #
405
+ # bucket = storage.create_bucket "my-bucket", enable_object_retention: true
406
+ #
389
407
  # @example Configure the bucket in a block:
390
408
  # require "google/cloud/storage"
391
409
  #
@@ -416,7 +434,8 @@ module Google
416
434
  versioning: nil,
417
435
  requester_pays: nil,
418
436
  user_project: nil,
419
- autoclass_enabled: false
437
+ autoclass_enabled: false,
438
+ enable_object_retention: nil
420
439
  params = {
421
440
  name: bucket_name,
422
441
  location: location,
@@ -440,7 +459,8 @@ module Google
440
459
  updater.check_for_mutable_lifecycle!
441
460
  gapi = service.insert_bucket \
442
461
  new_bucket, acl: acl_rule(acl), default_acl: acl_rule(default_acl),
443
- user_project: user_project
462
+ user_project: user_project,
463
+ enable_object_retention: enable_object_retention
444
464
  Bucket.from_gapi gapi, service, user_project: user_project
445
465
  end
446
466
 
@@ -36,6 +36,11 @@ module Google
36
36
  # @private
37
37
  attr_accessor :credentials
38
38
 
39
+ # @private
40
+ def universe_domain
41
+ service.universe_domain
42
+ end
43
+
39
44
  ##
40
45
  # Creates a new Service instance.
41
46
  # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
@@ -43,7 +48,7 @@ module Google
43
48
  timeout: nil, open_timeout: nil, read_timeout: nil,
44
49
  send_timeout: nil, host: nil, quota_project: nil,
45
50
  max_elapsed_time: nil, base_interval: nil, max_interval: nil,
46
- multiplier: nil, upload_chunk_size: nil
51
+ multiplier: nil, upload_chunk_size: nil, universe_domain: nil
47
52
  @project = project
48
53
  @credentials = credentials
49
54
  @service = API::StorageService.new
@@ -68,6 +73,7 @@ module Google
68
73
  @service.request_options.upload_chunk_size = upload_chunk_size if upload_chunk_size
69
74
  @service.authorization = @credentials.client if @credentials
70
75
  @service.root_url = host if host
76
+ @service.universe_domain = universe_domain
71
77
  end
72
78
  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
73
79
 
@@ -112,14 +118,16 @@ module Google
112
118
  # Creates a new bucket.
113
119
  # Returns Google::Apis::StorageV1::Bucket.
114
120
  def insert_bucket bucket_gapi, acl: nil, default_acl: nil,
115
- user_project: nil, options: {}
121
+ user_project: nil, enable_object_retention: nil,
122
+ options: {}
116
123
  execute do
117
124
  service.insert_bucket \
118
125
  @project, bucket_gapi,
119
126
  predefined_acl: acl,
120
127
  predefined_default_object_acl: default_acl,
121
128
  user_project: user_project(user_project),
122
- options: options
129
+ options: options,
130
+ enable_object_retention: enable_object_retention
123
131
  end
124
132
  end
125
133
 
@@ -582,6 +590,7 @@ module Google
582
590
  if_metageneration_not_match: nil,
583
591
  predefined_acl: nil,
584
592
  user_project: nil,
593
+ override_unlocked_retention: nil,
585
594
  options: {}
586
595
  file_gapi ||= Google::Apis::StorageV1::Object.new
587
596
 
@@ -601,6 +610,7 @@ module Google
601
610
  if_metageneration_not_match: if_metageneration_not_match,
602
611
  predefined_acl: predefined_acl,
603
612
  user_project: user_project(user_project),
613
+ override_unlocked_retention: override_unlocked_retention,
604
614
  options: options
605
615
  end
606
616
  end
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Storage
19
- VERSION = "1.46.0".freeze
19
+ VERSION = "1.48.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -67,6 +67,8 @@ module Google
67
67
  # @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
68
68
  # @param [String] endpoint Override of the endpoint host name. Optional.
69
69
  # If the param is nil, uses the default endpoint.
70
+ # @param universe_domain [String] Override of the universe domain. Optional.
71
+ # If unset or nil, uses the default unvierse domain
70
72
  # @param [Integer] upload_chunk_size The chunk size of storage upload, in bytes.
71
73
  # The default value is 100 MB, i.e. 104_857_600 bytes. To disable chunking and upload
72
74
  # the complete file regardless of size, pass 0 as the chunk size.
@@ -92,7 +94,7 @@ module Google
92
94
  timeout: nil, open_timeout: nil, read_timeout: nil,
93
95
  send_timeout: nil, endpoint: nil, project: nil, keyfile: nil,
94
96
  max_elapsed_time: nil, base_interval: nil, max_interval: nil,
95
- multiplier: nil, upload_chunk_size: nil
97
+ multiplier: nil, upload_chunk_size: nil, universe_domain: nil
96
98
  scope ||= configure.scope
97
99
  retries ||= configure.retries
98
100
  timeout ||= configure.timeout
@@ -106,6 +108,7 @@ module Google
106
108
  max_interval ||= configure.max_interval
107
109
  multiplier ||= configure.multiplier
108
110
  upload_chunk_size ||= configure.upload_chunk_size
111
+ universe_domain ||= configure.universe_domain
109
112
 
110
113
  unless credentials.is_a? Google::Auth::Credentials
111
114
  credentials = Storage::Credentials.new credentials, scope: scope
@@ -121,7 +124,8 @@ module Google
121
124
  read_timeout: read_timeout, send_timeout: send_timeout,
122
125
  host: endpoint, quota_project: configure.quota_project,
123
126
  max_elapsed_time: max_elapsed_time, base_interval: base_interval,
124
- max_interval: max_interval, multiplier: multiplier, upload_chunk_size: upload_chunk_size
127
+ max_interval: max_interval, multiplier: multiplier, upload_chunk_size: upload_chunk_size,
128
+ universe_domain: universe_domain
125
129
  )
126
130
  )
127
131
  end
@@ -145,6 +149,8 @@ module Google
145
149
  # @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
146
150
  # @param [String] endpoint Override of the endpoint host name. Optional.
147
151
  # If the param is nil, uses the default endpoint.
152
+ # @param universe_domain [String] Override of the universe domain. Optional.
153
+ # If unset or nil, uses the default unvierse domain
148
154
  # @param [Integer] upload_chunk_size The chunk size of storage upload, in bytes.
149
155
  # The default value is 100 MB, i.e. 104_857_600 bytes. To disable chunking and upload
150
156
  # the complete file regardless of size, pass 0 as the chunk size.
@@ -166,7 +172,7 @@ module Google
166
172
  def self.anonymous retries: nil, timeout: nil, open_timeout: nil,
167
173
  read_timeout: nil, send_timeout: nil, endpoint: nil,
168
174
  max_elapsed_time: nil, base_interval: nil, max_interval: nil,
169
- multiplier: nil, upload_chunk_size: nil
175
+ multiplier: nil, upload_chunk_size: nil, universe_domain: nil
170
176
  open_timeout ||= timeout
171
177
  read_timeout ||= timeout
172
178
  send_timeout ||= timeout
@@ -175,7 +181,8 @@ module Google
175
181
  nil, nil, retries: retries, timeout: timeout, open_timeout: open_timeout,
176
182
  read_timeout: read_timeout, send_timeout: send_timeout, host: endpoint,
177
183
  max_elapsed_time: max_elapsed_time, base_interval: base_interval,
178
- max_interval: max_interval, multiplier: multiplier, upload_chunk_size: upload_chunk_size
184
+ max_interval: max_interval, multiplier: multiplier, upload_chunk_size: upload_chunk_size,
185
+ universe_domain: universe_domain
179
186
  )
180
187
  )
181
188
  end
@@ -192,7 +192,7 @@ Google::Cloud.configure.add_config! :storage do |config|
192
192
  config.add_field! :read_timeout, nil, match: Integer
193
193
  config.add_field! :send_timeout, nil, match: Integer
194
194
  config.add_field! :upload_chunk_size, nil, match: Integer
195
- # TODO: Remove once discovery document is updated.
196
- config.add_field! :endpoint, "https://storage.googleapis.com/", match: String
195
+ config.add_field! :endpoint, nil, match: String, allow_nil: true
196
+ config.add_field! :universe_domain, nil, match: String, allow_nil: true
197
197
  end
198
198
  # rubocop:enable Metrics/BlockLength
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.46.0
4
+ version: 1.48.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: 2024-01-08 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: google-cloud-core
@@ -31,48 +31,42 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0.1'
34
+ version: '0.18'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0.1'
41
+ version: '0.18'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: google-apis-storage_v1
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 0.29.0
48
+ version: '0.33'
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.29.0
55
+ version: '0.33'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: googleauth
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 0.16.2
63
- - - "<"
60
+ - - "~>"
64
61
  - !ruby/object:Gem::Version
65
- version: 2.a
62
+ version: '1.9'
66
63
  type: :runtime
67
64
  prerelease: false
68
65
  version_requirements: !ruby/object:Gem::Requirement
69
66
  requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 0.16.2
73
- - - "<"
67
+ - - "~>"
74
68
  - !ruby/object:Gem::Version
75
- version: 2.a
69
+ version: '1.9'
76
70
  - !ruby/object:Gem::Dependency
77
71
  name: digest-crc
78
72
  requirement: !ruby/object:Gem::Requirement