google-cloud-storage 1.45.0 → 1.47.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 +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/google/cloud/storage/bucket.rb +18 -3
- data/lib/google/cloud/storage/file/list.rb +7 -3
- data/lib/google/cloud/storage/file.rb +69 -4
- data/lib/google/cloud/storage/project.rb +13 -2
- data/lib/google/cloud/storage/service.rb +8 -2
- data/lib/google/cloud/storage/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb6046c8eb979e1cbd733518d8fd242e1332813d6241f85e65b07f6d7d9e631f
|
4
|
+
data.tar.gz: 1124d71be6c1954b38f3fb6c8c3814891d9dd108fc0862f2c5436db18c111782
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e8598d2cf01a52f20c7bd554b593d7049134a367f17571721e2779a0634013452ad42025c22d59f8542c030a411092c3f2f63edfe8489fee0a9dcb9ccb5c774
|
7
|
+
data.tar.gz: 4918a472cd83aab2c7d1a5ffe6be9957c0113686a00769f082522799fd9cc713c3315de8d8b2d87caa22b37d7d54c2c82702fb2b5b9e1ed30ef011319dc841cf
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.47.0 (2024-01-09)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* support for object lock / retention ([#23732](https://github.com/googleapis/google-cloud-ruby/issues/23732))
|
8
|
+
|
9
|
+
### 1.46.0 (2024-01-08)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* support match_glob for Object.list
|
14
|
+
|
3
15
|
### 1.45.0 (2023-11-06)
|
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
|
#
|
@@ -1299,6 +1308,9 @@ module Google
|
|
1299
1308
|
# `prefixes` are omitted.
|
1300
1309
|
# @param [String] token A previously-returned page token representing
|
1301
1310
|
# part of the larger set of results to view.
|
1311
|
+
# @param [String] match_glob A glob pattern used to filter results returned in items (e.g. `foo*bar`).
|
1312
|
+
# The string value must be UTF-8 encoded. See:
|
1313
|
+
# https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-object-glob
|
1302
1314
|
# @param [Integer] max Maximum number of items plus prefixes to return.
|
1303
1315
|
# As duplicate prefixes are omitted, fewer total results may be
|
1304
1316
|
# returned than requested. The default value of this parameter is
|
@@ -1334,14 +1346,17 @@ module Google
|
|
1334
1346
|
# end
|
1335
1347
|
#
|
1336
1348
|
def files prefix: nil, delimiter: nil, token: nil, max: nil,
|
1337
|
-
versions: nil
|
1349
|
+
versions: nil, match_glob: nil
|
1338
1350
|
ensure_service!
|
1339
1351
|
gapi = service.list_files name, prefix: prefix, delimiter: delimiter,
|
1340
1352
|
token: token, max: max,
|
1341
1353
|
versions: versions,
|
1342
|
-
user_project: user_project
|
1354
|
+
user_project: user_project,
|
1355
|
+
match_glob: match_glob
|
1343
1356
|
File::List.from_gapi gapi, service, name, prefix, delimiter, max,
|
1344
|
-
versions,
|
1357
|
+
versions,
|
1358
|
+
user_project: user_project,
|
1359
|
+
match_glob: match_glob
|
1345
1360
|
end
|
1346
1361
|
alias find_files files
|
1347
1362
|
|
@@ -83,10 +83,12 @@ module Google
|
|
83
83
|
token: @token,
|
84
84
|
max: @max,
|
85
85
|
versions: @versions,
|
86
|
-
user_project: @user_project
|
86
|
+
user_project: @user_project,
|
87
|
+
match_glob: @match_glob
|
87
88
|
File::List.from_gapi gapi, @service, @bucket, @prefix,
|
88
89
|
@delimiter, @max, @versions,
|
89
|
-
user_project: @user_project
|
90
|
+
user_project: @user_project,
|
91
|
+
match_glob: @match_glob
|
90
92
|
end
|
91
93
|
|
92
94
|
##
|
@@ -163,7 +165,8 @@ module Google
|
|
163
165
|
# Google::Apis::StorageV1::Objects object.
|
164
166
|
def self.from_gapi gapi_list, service, bucket = nil, prefix = nil,
|
165
167
|
delimiter = nil, max = nil, versions = nil,
|
166
|
-
user_project: nil
|
168
|
+
user_project: nil,
|
169
|
+
match_glob: nil
|
167
170
|
files = new(Array(gapi_list.items).map do |gapi_object|
|
168
171
|
File.from_gapi gapi_object, service, user_project: user_project
|
169
172
|
end)
|
@@ -176,6 +179,7 @@ module Google
|
|
176
179
|
files.instance_variable_set :@max, max
|
177
180
|
files.instance_variable_set :@versions, versions
|
178
181
|
files.instance_variable_set :@user_project, user_project
|
182
|
+
files.instance_variable_set :@match_glob, match_glob
|
179
183
|
files
|
180
184
|
end
|
181
185
|
|
@@ -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
|
|
@@ -372,6 +372,8 @@ module Google
|
|
372
372
|
# bucket instance and its files.
|
373
373
|
#
|
374
374
|
# See also {Bucket#requester_pays=} and {Bucket#requester_pays}.
|
375
|
+
# @param [Boolean] enable_object_retention
|
376
|
+
# When set to true, object retention is enabled for this bucket.
|
375
377
|
#
|
376
378
|
# @yield [bucket] a block for configuring the bucket before it is
|
377
379
|
# created
|
@@ -386,6 +388,13 @@ module Google
|
|
386
388
|
#
|
387
389
|
# bucket = storage.create_bucket "my-bucket"
|
388
390
|
#
|
391
|
+
# @example
|
392
|
+
# require "google/cloud/storage"
|
393
|
+
#
|
394
|
+
# storage = Google::Cloud::Storage.new
|
395
|
+
#
|
396
|
+
# bucket = storage.create_bucket "my-bucket", enable_object_retention: true
|
397
|
+
#
|
389
398
|
# @example Configure the bucket in a block:
|
390
399
|
# require "google/cloud/storage"
|
391
400
|
#
|
@@ -416,7 +425,8 @@ module Google
|
|
416
425
|
versioning: nil,
|
417
426
|
requester_pays: nil,
|
418
427
|
user_project: nil,
|
419
|
-
autoclass_enabled: false
|
428
|
+
autoclass_enabled: false,
|
429
|
+
enable_object_retention: nil
|
420
430
|
params = {
|
421
431
|
name: bucket_name,
|
422
432
|
location: location,
|
@@ -440,7 +450,8 @@ module Google
|
|
440
450
|
updater.check_for_mutable_lifecycle!
|
441
451
|
gapi = service.insert_bucket \
|
442
452
|
new_bucket, acl: acl_rule(acl), default_acl: acl_rule(default_acl),
|
443
|
-
user_project: user_project
|
453
|
+
user_project: user_project,
|
454
|
+
enable_object_retention: enable_object_retention
|
444
455
|
Bucket.from_gapi gapi, service, user_project: user_project
|
445
456
|
end
|
446
457
|
|
@@ -112,14 +112,16 @@ module Google
|
|
112
112
|
# Creates a new bucket.
|
113
113
|
# Returns Google::Apis::StorageV1::Bucket.
|
114
114
|
def insert_bucket bucket_gapi, acl: nil, default_acl: nil,
|
115
|
-
user_project: nil,
|
115
|
+
user_project: nil, enable_object_retention: nil,
|
116
|
+
options: {}
|
116
117
|
execute do
|
117
118
|
service.insert_bucket \
|
118
119
|
@project, bucket_gapi,
|
119
120
|
predefined_acl: acl,
|
120
121
|
predefined_default_object_acl: default_acl,
|
121
122
|
user_project: user_project(user_project),
|
122
|
-
options: options
|
123
|
+
options: options,
|
124
|
+
enable_object_retention: enable_object_retention
|
123
125
|
end
|
124
126
|
end
|
125
127
|
|
@@ -349,6 +351,7 @@ module Google
|
|
349
351
|
# Retrieves a list of files matching the criteria.
|
350
352
|
def list_files bucket_name, delimiter: nil, max: nil, token: nil,
|
351
353
|
prefix: nil, versions: nil, user_project: nil,
|
354
|
+
match_glob: nil,
|
352
355
|
options: {}
|
353
356
|
execute do
|
354
357
|
service.list_objects \
|
@@ -356,6 +359,7 @@ module Google
|
|
356
359
|
page_token: token, prefix: prefix,
|
357
360
|
versions: versions,
|
358
361
|
user_project: user_project(user_project),
|
362
|
+
match_glob: match_glob,
|
359
363
|
options: options
|
360
364
|
end
|
361
365
|
end
|
@@ -580,6 +584,7 @@ module Google
|
|
580
584
|
if_metageneration_not_match: nil,
|
581
585
|
predefined_acl: nil,
|
582
586
|
user_project: nil,
|
587
|
+
override_unlocked_retention: nil,
|
583
588
|
options: {}
|
584
589
|
file_gapi ||= Google::Apis::StorageV1::Object.new
|
585
590
|
|
@@ -599,6 +604,7 @@ module Google
|
|
599
604
|
if_metageneration_not_match: if_metageneration_not_match,
|
600
605
|
predefined_acl: predefined_acl,
|
601
606
|
user_project: user_project(user_project),
|
607
|
+
override_unlocked_retention: override_unlocked_retention,
|
602
608
|
options: options
|
603
609
|
end
|
604
610
|
end
|
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.
|
4
|
+
version: 1.47.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:
|
12
|
+
date: 2024-01-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 0.
|
48
|
+
version: 0.31.0
|
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.
|
55
|
+
version: 0.31.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: googleauth
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -325,14 +325,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
325
325
|
requirements:
|
326
326
|
- - ">="
|
327
327
|
- !ruby/object:Gem::Version
|
328
|
-
version: '2.
|
328
|
+
version: '2.7'
|
329
329
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
330
330
|
requirements:
|
331
331
|
- - ">="
|
332
332
|
- !ruby/object:Gem::Version
|
333
333
|
version: '0'
|
334
334
|
requirements: []
|
335
|
-
rubygems_version: 3.
|
335
|
+
rubygems_version: 3.5.3
|
336
336
|
signing_key:
|
337
337
|
specification_version: 4
|
338
338
|
summary: API Client library for Google Cloud Storage
|