google-cloud-storage 1.48.1 → 1.52.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 +27 -0
- data/lib/google/cloud/storage/bucket.rb +205 -5
- data/lib/google/cloud/storage/file/list.rb +5 -2
- data/lib/google/cloud/storage/file/signer_v2.rb +2 -1
- data/lib/google/cloud/storage/file/signer_v4.rb +1 -1
- data/lib/google/cloud/storage/file.rb +24 -0
- data/lib/google/cloud/storage/project.rb +7 -2
- data/lib/google/cloud/storage/service.rb +43 -3
- data/lib/google/cloud/storage/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94e0030c8442262a0d7670a5ccc0090efe44f6cdad9170cc7eb800a6acffad9c
|
4
|
+
data.tar.gz: 7e4360bab08faa20b814df568f73f708ec8cdd31bb5d90f5fb56292b34636ae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7180d3b2fa31de1ba73eb811439540c4d12a0cc417500566d1d7316d50c5249e66704fef719bc18417682a757a7a538722628fd4bcf3b31f43aca5d083f23e2
|
7
|
+
data.tar.gz: b2a8b010890f3cffcced823aa66806bed2e2b61f4a547848a8c520d0d6d140280522869af668518ca608fcc6a1904541fc626090b5f110bf89f5109fac8a3ba7
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,32 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.52.0 (2024-05-31)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* support for hierarchical namespace (folders) ([#25967](https://github.com/googleapis/google-cloud-ruby/issues/25967))
|
8
|
+
|
9
|
+
### 1.51.0 (2024-04-25)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* Respect custom endpoint for signed_url ([#25469](https://github.com/googleapis/google-cloud-ruby/issues/25469))
|
14
|
+
|
15
|
+
### 1.50.0 (2024-04-19)
|
16
|
+
|
17
|
+
#### Features
|
18
|
+
|
19
|
+
* Add support for soft deletion ([#25340](https://github.com/googleapis/google-cloud-ruby/issues/25340))
|
20
|
+
#### Bug Fixes
|
21
|
+
|
22
|
+
* Set configured univer_domain and endpoint when initializing through Service ([#25665](https://github.com/googleapis/google-cloud-ruby/issues/25665))
|
23
|
+
|
24
|
+
### 1.49.0 (2024-02-21)
|
25
|
+
|
26
|
+
#### Features
|
27
|
+
|
28
|
+
* Support of Managed Folders ([#24809](https://github.com/googleapis/google-cloud-ruby/issues/24809))
|
29
|
+
|
3
30
|
### 1.48.1 (2024-01-26)
|
4
31
|
|
5
32
|
#### Bug Fixes
|
@@ -1194,6 +1194,121 @@ module Google
|
|
1194
1194
|
patch_gapi! :rpo
|
1195
1195
|
end
|
1196
1196
|
|
1197
|
+
##
|
1198
|
+
# The bucket's soft delete policy. If this policy is set, any deleted
|
1199
|
+
# objects will be soft-deleted according to the time specified in the
|
1200
|
+
# policy.
|
1201
|
+
# This value can be modified by calling {#soft_delete_policy=}.
|
1202
|
+
#
|
1203
|
+
# @return [Google::Apis::StorageV1::Bucket::SoftDeletePolicy] The default retention policy is for 7
|
1204
|
+
# days.
|
1205
|
+
#
|
1206
|
+
# @example
|
1207
|
+
# require "google/cloud/storage"
|
1208
|
+
#
|
1209
|
+
# storage = Google::Cloud::Storage.new
|
1210
|
+
#
|
1211
|
+
# bucket = storage.bucket "my-bucket"
|
1212
|
+
#
|
1213
|
+
# bucket.soft_delete_policy
|
1214
|
+
#
|
1215
|
+
def soft_delete_policy
|
1216
|
+
@gapi.soft_delete_policy
|
1217
|
+
end
|
1218
|
+
|
1219
|
+
##
|
1220
|
+
# Sets the value for Soft Delete Policy in the bucket. This value can
|
1221
|
+
# be queried by calling {#soft_delete_policy}.
|
1222
|
+
#
|
1223
|
+
# @param [Google::Apis::StorageV1::Bucket::SoftDeletePolicy,
|
1224
|
+
# Hash(String => String)] new_soft_delete_policy The bucket's
|
1225
|
+
# new Soft Delete Policy.
|
1226
|
+
#
|
1227
|
+
# @example Set Soft Delete Policy to 10 days using SoftDeletePolicy class:
|
1228
|
+
# require "google/cloud/storage"
|
1229
|
+
# require "date"
|
1230
|
+
#
|
1231
|
+
# storage = Google::Cloud::Storage.new
|
1232
|
+
#
|
1233
|
+
# bucket = storage.bucket "my-bucket"
|
1234
|
+
#
|
1235
|
+
# soft_delete_policy = Google::Apis::StorageV1::Bucket::SoftDeletePolicy.new
|
1236
|
+
# soft_delete_policy.retention_duration_seconds = 10*24*60*60
|
1237
|
+
#
|
1238
|
+
# bucket.soft_delete_policy = soft_delete_policy
|
1239
|
+
#
|
1240
|
+
# @example Set Soft Delete Policy to 5 days using Hash:
|
1241
|
+
# require "google/cloud/storage"
|
1242
|
+
# require "date"
|
1243
|
+
#
|
1244
|
+
# storage = Google::Cloud::Storage.new
|
1245
|
+
#
|
1246
|
+
# bucket = storage.bucket "my-bucket"
|
1247
|
+
#
|
1248
|
+
# soft_delete_policy = { retention_duration_seconds: 432000 }
|
1249
|
+
# bucket.soft_delete_policy = soft_delete_policy
|
1250
|
+
#
|
1251
|
+
def soft_delete_policy= new_soft_delete_policy
|
1252
|
+
@gapi.soft_delete_policy = new_soft_delete_policy || {}
|
1253
|
+
patch_gapi! :soft_delete_policy
|
1254
|
+
end
|
1255
|
+
|
1256
|
+
##
|
1257
|
+
# The bucket's hierarchical namespace (Folders) configuration.
|
1258
|
+
# This value can be modified by calling {#hierarchical_namespace=}.
|
1259
|
+
#
|
1260
|
+
# @return [Google::Apis::StorageV1::Bucket::HierarchicalNamespace]
|
1261
|
+
#
|
1262
|
+
# @example
|
1263
|
+
# require "google/cloud/storage"
|
1264
|
+
#
|
1265
|
+
# storage = Google::Cloud::Storage.new
|
1266
|
+
#
|
1267
|
+
# bucket = storage.bucket "my-bucket"
|
1268
|
+
#
|
1269
|
+
# bucket.hierarchical_namespace
|
1270
|
+
#
|
1271
|
+
def hierarchical_namespace
|
1272
|
+
@gapi.hierarchical_namespace
|
1273
|
+
end
|
1274
|
+
|
1275
|
+
##
|
1276
|
+
# Sets the value of Hierarchical Namespace (Folders) for the bucket.
|
1277
|
+
# This can only be enabled at bucket create time. If this is enabled,
|
1278
|
+
# Uniform Bucket-Level Access must also be enabled.
|
1279
|
+
# This value can be queried by calling {#hierarchical_namespace}.
|
1280
|
+
#
|
1281
|
+
# @param [Google::Apis::StorageV1::Bucket::HierarchicalNamespace,
|
1282
|
+
# Hash(String => String)] new_hierarchical_namespace The
|
1283
|
+
# bucket's new Hierarchical Namespace Configuration.
|
1284
|
+
#
|
1285
|
+
# @example Enabled Hierarchical Namespace using HierarchicalNamespace class:
|
1286
|
+
# require "google/cloud/storage"
|
1287
|
+
#
|
1288
|
+
# storage = Google::Cloud::Storage.new
|
1289
|
+
#
|
1290
|
+
# bucket = storage.bucket "my-bucket"
|
1291
|
+
#
|
1292
|
+
# hierarchical_namespace = Google::Apis::StorageV1::Bucket::HierarchicalNamespace.new
|
1293
|
+
# hierarchical_namespace.enabled = true
|
1294
|
+
#
|
1295
|
+
# bucket.hierarchical_namespace = hierarchical_namespace
|
1296
|
+
#
|
1297
|
+
# @example Disable Hierarchical Namespace using Hash:
|
1298
|
+
# require "google/cloud/storage"
|
1299
|
+
#
|
1300
|
+
# storage = Google::Cloud::Storage.new
|
1301
|
+
#
|
1302
|
+
# bucket = storage.bucket "my-bucket"
|
1303
|
+
#
|
1304
|
+
# hierarchical_namespace = { enabled: false }
|
1305
|
+
# bucket.hierarchical_namespace = hierarchical_namespace
|
1306
|
+
#
|
1307
|
+
def hierarchical_namespace= new_hierarchical_namespace
|
1308
|
+
@gapi.hierarchical_namespace = new_hierarchical_namespace || {}
|
1309
|
+
patch_gapi! :hierarchical_namespace
|
1310
|
+
end
|
1311
|
+
|
1197
1312
|
##
|
1198
1313
|
# Updates the bucket with changes made in the given block in a single
|
1199
1314
|
# PATCH request. The following attributes may be set: {#cors},
|
@@ -1319,6 +1434,11 @@ module Google
|
|
1319
1434
|
# as distinct results. The default is `false`. For more information,
|
1320
1435
|
# see [Object Versioning
|
1321
1436
|
# ](https://cloud.google.com/storage/docs/object-versioning).
|
1437
|
+
# @param [Boolean] include_folders_as_prefixes If `true`, will also include
|
1438
|
+
# folders and managed folders, besides objects, in the returned prefixes.
|
1439
|
+
# Only applicable if delimiter is set to '/'.
|
1440
|
+
# @param [Boolean] soft_deleted If true, only soft-deleted object
|
1441
|
+
# versions will be listed. The default is false.
|
1322
1442
|
#
|
1323
1443
|
# @return [Array<Google::Cloud::Storage::File>] (See
|
1324
1444
|
# {Google::Cloud::Storage::File::List})
|
@@ -1346,17 +1466,22 @@ module Google
|
|
1346
1466
|
# end
|
1347
1467
|
#
|
1348
1468
|
def files prefix: nil, delimiter: nil, token: nil, max: nil,
|
1349
|
-
versions: nil, match_glob: nil
|
1469
|
+
versions: nil, match_glob: nil, include_folders_as_prefixes: nil,
|
1470
|
+
soft_deleted: nil
|
1350
1471
|
ensure_service!
|
1351
1472
|
gapi = service.list_files name, prefix: prefix, delimiter: delimiter,
|
1352
1473
|
token: token, max: max,
|
1353
1474
|
versions: versions,
|
1354
1475
|
user_project: user_project,
|
1355
|
-
match_glob: match_glob
|
1476
|
+
match_glob: match_glob,
|
1477
|
+
include_folders_as_prefixes: include_folders_as_prefixes,
|
1478
|
+
soft_deleted: soft_deleted
|
1356
1479
|
File::List.from_gapi gapi, service, name, prefix, delimiter, max,
|
1357
1480
|
versions,
|
1358
1481
|
user_project: user_project,
|
1359
|
-
match_glob: match_glob
|
1482
|
+
match_glob: match_glob,
|
1483
|
+
include_folders_as_prefixes: include_folders_as_prefixes,
|
1484
|
+
soft_deleted: soft_deleted
|
1360
1485
|
end
|
1361
1486
|
alias find_files files
|
1362
1487
|
|
@@ -1392,6 +1517,8 @@ module Google
|
|
1392
1517
|
# @param [String] encryption_key Optional. The customer-supplied,
|
1393
1518
|
# AES-256 encryption key used to encrypt the file, if one was provided
|
1394
1519
|
# to {#create_file}. (Not used if `skip_lookup` is also set.)
|
1520
|
+
# @param [Boolean] soft_deleted Optional. If true, only soft-deleted
|
1521
|
+
# object versions will be listed. The default is false.
|
1395
1522
|
#
|
1396
1523
|
# @return [Google::Cloud::Storage::File, nil] Returns nil if file does
|
1397
1524
|
# not exist
|
@@ -1413,7 +1540,8 @@ module Google
|
|
1413
1540
|
if_metageneration_match: nil,
|
1414
1541
|
if_metageneration_not_match: nil,
|
1415
1542
|
skip_lookup: nil,
|
1416
|
-
encryption_key: nil
|
1543
|
+
encryption_key: nil,
|
1544
|
+
soft_deleted: nil
|
1417
1545
|
ensure_service!
|
1418
1546
|
if skip_lookup
|
1419
1547
|
return File.new_lazy name, path, service,
|
@@ -1426,7 +1554,8 @@ module Google
|
|
1426
1554
|
if_metageneration_match: if_metageneration_match,
|
1427
1555
|
if_metageneration_not_match: if_metageneration_not_match,
|
1428
1556
|
key: encryption_key,
|
1429
|
-
user_project: user_project
|
1557
|
+
user_project: user_project,
|
1558
|
+
soft_deleted: soft_deleted
|
1430
1559
|
File.from_gapi gapi, service, user_project: user_project
|
1431
1560
|
rescue Google::Cloud::NotFoundError
|
1432
1561
|
nil
|
@@ -1707,6 +1836,77 @@ module Google
|
|
1707
1836
|
alias upload_file create_file
|
1708
1837
|
alias new_file create_file
|
1709
1838
|
|
1839
|
+
##
|
1840
|
+
# Restores a soft-deleted object.
|
1841
|
+
#
|
1842
|
+
# @param [String] file_path
|
1843
|
+
# Name of the file.
|
1844
|
+
# @param [Fixnum] generation
|
1845
|
+
# Selects a specific revision of this object.
|
1846
|
+
# @param [Boolean] copy_source_acl
|
1847
|
+
# If true, copies the source file's ACL; otherwise, uses the
|
1848
|
+
# bucket's default file ACL. The default is false.
|
1849
|
+
# @param [Fixnum] if_generation_match
|
1850
|
+
# Makes the operation conditional on whether the file's one live
|
1851
|
+
# generation matches the given value. Setting to 0 makes the
|
1852
|
+
# operation succeed only if there are no live versions of the file.
|
1853
|
+
# @param [Fixnum] if_generation_not_match
|
1854
|
+
# Makes the operation conditional on whether none of the file's live
|
1855
|
+
# generations match the given value. If no live file exists, the
|
1856
|
+
# precondition fails. Setting to 0 makes the operation succeed only
|
1857
|
+
# if there is a live version of the file.
|
1858
|
+
# @param [Fixnum] if_metageneration_match
|
1859
|
+
# Makes the operation conditional on whether the file's one live
|
1860
|
+
# metageneration matches the given value.
|
1861
|
+
# @param [Fixnum] if_metageneration_not_match
|
1862
|
+
# Makes the operation conditional on whether none of the object's
|
1863
|
+
# live metagenerations match the given value.
|
1864
|
+
# @param [String] projection
|
1865
|
+
# Set of properties to return. Defaults to full.
|
1866
|
+
# @param [String] user_project
|
1867
|
+
# The project to be billed for this request. Required for Requester
|
1868
|
+
# Pays buckets.
|
1869
|
+
# @param [String] fields
|
1870
|
+
# Selector specifying which fields to include in a partial response.
|
1871
|
+
#
|
1872
|
+
# @return [Google::Cloud::Storage::File]
|
1873
|
+
#
|
1874
|
+
# @example
|
1875
|
+
# require "google/cloud/storage"
|
1876
|
+
#
|
1877
|
+
# storage = Google::Cloud::Storage.new
|
1878
|
+
#
|
1879
|
+
# bucket = storage.bucket "my-bucket"
|
1880
|
+
#
|
1881
|
+
# bucket.restore_file "path/of/file", <generation-of-the-file>
|
1882
|
+
#
|
1883
|
+
def restore_file file_path,
|
1884
|
+
generation,
|
1885
|
+
copy_source_acl: nil,
|
1886
|
+
if_generation_match: nil,
|
1887
|
+
if_generation_not_match: nil,
|
1888
|
+
if_metageneration_match: nil,
|
1889
|
+
if_metageneration_not_match: nil,
|
1890
|
+
projection: nil,
|
1891
|
+
user_project: nil,
|
1892
|
+
fields: nil,
|
1893
|
+
options: {}
|
1894
|
+
ensure_service!
|
1895
|
+
gapi = service.restore_file name,
|
1896
|
+
file_path,
|
1897
|
+
generation,
|
1898
|
+
copy_source_acl: File::Acl.predefined_rule_for(copy_source_acl),
|
1899
|
+
if_generation_match: if_generation_match,
|
1900
|
+
if_generation_not_match: if_generation_not_match,
|
1901
|
+
if_metageneration_match: if_metageneration_match,
|
1902
|
+
if_metageneration_not_match: if_metageneration_not_match,
|
1903
|
+
projection: projection,
|
1904
|
+
user_project: user_project,
|
1905
|
+
fields: fields,
|
1906
|
+
options: options
|
1907
|
+
File.from_gapi gapi, service, user_project: user_project
|
1908
|
+
end
|
1909
|
+
|
1710
1910
|
##
|
1711
1911
|
# Concatenates a list of existing files in the bucket into a new file in
|
1712
1912
|
# the bucket. There is a limit (currently 32) to the number of files
|
@@ -165,8 +165,9 @@ module Google
|
|
165
165
|
# Google::Apis::StorageV1::Objects object.
|
166
166
|
def self.from_gapi gapi_list, service, bucket = nil, prefix = nil,
|
167
167
|
delimiter = nil, max = nil, versions = nil,
|
168
|
-
user_project: nil,
|
169
|
-
|
168
|
+
user_project: nil, match_glob: nil,
|
169
|
+
include_folders_as_prefixes: nil,
|
170
|
+
soft_deleted: nil
|
170
171
|
files = new(Array(gapi_list.items).map do |gapi_object|
|
171
172
|
File.from_gapi gapi_object, service, user_project: user_project
|
172
173
|
end)
|
@@ -180,6 +181,8 @@ module Google
|
|
180
181
|
files.instance_variable_set :@versions, versions
|
181
182
|
files.instance_variable_set :@user_project, user_project
|
182
183
|
files.instance_variable_set :@match_glob, match_glob
|
184
|
+
files.instance_variable_set :@include_folders_as_prefixes, include_folders_as_prefixes
|
185
|
+
files.instance_variable_set :@soft_deleted, soft_deleted
|
183
186
|
files
|
184
187
|
end
|
185
188
|
|
@@ -301,7 +301,7 @@ module Google
|
|
301
301
|
##
|
302
302
|
# The external url to the file.
|
303
303
|
def ext_url scheme, virtual_hosted_style, bucket_bound_hostname
|
304
|
-
url =
|
304
|
+
url = @service.service.root_url.chomp "/"
|
305
305
|
if virtual_hosted_style
|
306
306
|
parts = url.split "//"
|
307
307
|
parts[1] = "#{@bucket_name}.#{parts[1]}"
|
@@ -763,6 +763,30 @@ module Google
|
|
763
763
|
@gapi.retention_expiration_time
|
764
764
|
end
|
765
765
|
|
766
|
+
##
|
767
|
+
# This soft delete time is the time when the object became
|
768
|
+
# soft-deleted.
|
769
|
+
#
|
770
|
+
# @return [DateTime, nil] A DateTime representing the time at
|
771
|
+
# which the object became soft-deleted, or `nil` if the file was
|
772
|
+
# not deleted.
|
773
|
+
#
|
774
|
+
def soft_delete_time
|
775
|
+
@gapi.soft_delete_time
|
776
|
+
end
|
777
|
+
|
778
|
+
##
|
779
|
+
# This hard delete time is The time when the file will be permanently
|
780
|
+
# deleted.
|
781
|
+
#
|
782
|
+
# @return [DateTime, nil] A DateTime representing the time at
|
783
|
+
# which the file will be permanently deleted, or `nil` if the file is
|
784
|
+
# not soft deleted.
|
785
|
+
#
|
786
|
+
def hard_delete_time
|
787
|
+
@gapi.hard_delete_time
|
788
|
+
end
|
789
|
+
|
766
790
|
##
|
767
791
|
# Retrieves a list of versioned files for the current object.
|
768
792
|
#
|
@@ -421,6 +421,7 @@ module Google
|
|
421
421
|
# b.lifecycle.add_set_storage_class_rule "COLDLINE", age: 10
|
422
422
|
# end
|
423
423
|
#
|
424
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
424
425
|
def create_bucket bucket_name,
|
425
426
|
acl: nil,
|
426
427
|
default_acl: nil,
|
@@ -435,11 +436,13 @@ module Google
|
|
435
436
|
requester_pays: nil,
|
436
437
|
user_project: nil,
|
437
438
|
autoclass_enabled: false,
|
438
|
-
enable_object_retention: nil
|
439
|
+
enable_object_retention: nil,
|
440
|
+
hierarchical_namespace: nil
|
439
441
|
params = {
|
440
442
|
name: bucket_name,
|
441
443
|
location: location,
|
442
|
-
custom_placement_config: custom_placement_config
|
444
|
+
custom_placement_config: custom_placement_config,
|
445
|
+
hierarchical_namespace: hierarchical_namespace
|
443
446
|
}.delete_if { |_, v| v.nil? }
|
444
447
|
new_bucket = Google::Apis::StorageV1::Bucket.new(**params)
|
445
448
|
storage_class = storage_class_for storage_class
|
@@ -452,6 +455,7 @@ module Google
|
|
452
455
|
b.website_404 = website_404 unless website_404.nil?
|
453
456
|
b.versioning = versioning unless versioning.nil?
|
454
457
|
b.requester_pays = requester_pays unless requester_pays.nil?
|
458
|
+
b.hierarchical_namespace = hierarchical_namespace unless hierarchical_namespace.nil?
|
455
459
|
end
|
456
460
|
yield updater if block_given?
|
457
461
|
updater.check_for_changed_labels!
|
@@ -463,6 +467,7 @@ module Google
|
|
463
467
|
enable_object_retention: enable_object_retention
|
464
468
|
Bucket.from_gapi gapi, service, user_project: user_project
|
465
469
|
end
|
470
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
466
471
|
|
467
472
|
##
|
468
473
|
# Creates a new HMAC key.
|
@@ -15,6 +15,7 @@
|
|
15
15
|
|
16
16
|
require "google/cloud/storage/version"
|
17
17
|
require "google/apis/storage_v1"
|
18
|
+
require "google/cloud/config"
|
18
19
|
require "digest"
|
19
20
|
require "mini_mime"
|
20
21
|
require "pathname"
|
@@ -49,6 +50,7 @@ module Google
|
|
49
50
|
send_timeout: nil, host: nil, quota_project: nil,
|
50
51
|
max_elapsed_time: nil, base_interval: nil, max_interval: nil,
|
51
52
|
multiplier: nil, upload_chunk_size: nil, universe_domain: nil
|
53
|
+
host ||= Google::Cloud::Storage.configure.endpoint
|
52
54
|
@project = project
|
53
55
|
@credentials = credentials
|
54
56
|
@service = API::StorageService.new
|
@@ -73,7 +75,7 @@ module Google
|
|
73
75
|
@service.request_options.upload_chunk_size = upload_chunk_size if upload_chunk_size
|
74
76
|
@service.authorization = @credentials.client if @credentials
|
75
77
|
@service.root_url = host if host
|
76
|
-
@service.universe_domain = universe_domain
|
78
|
+
@service.universe_domain = universe_domain || Google::Cloud::Storage.configure.universe_domain
|
77
79
|
begin
|
78
80
|
@service.verify_universe_domain!
|
79
81
|
rescue Google::Apis::UniverseDomainError => e
|
@@ -363,8 +365,8 @@ module Google
|
|
363
365
|
# Retrieves a list of files matching the criteria.
|
364
366
|
def list_files bucket_name, delimiter: nil, max: nil, token: nil,
|
365
367
|
prefix: nil, versions: nil, user_project: nil,
|
366
|
-
match_glob: nil,
|
367
|
-
options: {}
|
368
|
+
match_glob: nil, include_folders_as_prefixes: nil,
|
369
|
+
soft_deleted: nil, options: {}
|
368
370
|
execute do
|
369
371
|
service.list_objects \
|
370
372
|
bucket_name, delimiter: delimiter, max_results: max,
|
@@ -372,6 +374,8 @@ module Google
|
|
372
374
|
versions: versions,
|
373
375
|
user_project: user_project(user_project),
|
374
376
|
match_glob: match_glob,
|
377
|
+
include_folders_as_prefixes: include_folders_as_prefixes,
|
378
|
+
soft_deleted: soft_deleted,
|
375
379
|
options: options
|
376
380
|
end
|
377
381
|
end
|
@@ -455,6 +459,7 @@ module Google
|
|
455
459
|
if_metageneration_not_match: nil,
|
456
460
|
key: nil,
|
457
461
|
user_project: nil,
|
462
|
+
soft_deleted: nil,
|
458
463
|
options: {}
|
459
464
|
execute do
|
460
465
|
service.get_object \
|
@@ -465,6 +470,7 @@ module Google
|
|
465
470
|
if_metageneration_match: if_metageneration_match,
|
466
471
|
if_metageneration_not_match: if_metageneration_not_match,
|
467
472
|
user_project: user_project(user_project),
|
473
|
+
soft_deleted: soft_deleted,
|
468
474
|
options: key_options(key).merge(options)
|
469
475
|
end
|
470
476
|
end
|
@@ -650,6 +656,40 @@ module Google
|
|
650
656
|
end
|
651
657
|
end
|
652
658
|
|
659
|
+
##
|
660
|
+
# Restores a soft-deleted object.
|
661
|
+
def restore_file bucket_name,
|
662
|
+
file_path,
|
663
|
+
generation,
|
664
|
+
copy_source_acl: nil,
|
665
|
+
if_generation_match: nil,
|
666
|
+
if_generation_not_match: nil,
|
667
|
+
if_metageneration_match: nil,
|
668
|
+
if_metageneration_not_match: nil,
|
669
|
+
projection: nil,
|
670
|
+
user_project: nil,
|
671
|
+
fields: nil,
|
672
|
+
options: {}
|
673
|
+
|
674
|
+
if options[:retries].nil?
|
675
|
+
is_idempotent = retry? generation: generation, if_generation_match: if_generation_match
|
676
|
+
options = is_idempotent ? {} : { retries: 0 }
|
677
|
+
end
|
678
|
+
|
679
|
+
execute do
|
680
|
+
service.restore_object bucket_name, file_path, generation,
|
681
|
+
copy_source_acl: copy_source_acl,
|
682
|
+
if_generation_match: if_generation_match,
|
683
|
+
if_generation_not_match: if_generation_not_match,
|
684
|
+
if_metageneration_match: if_metageneration_match,
|
685
|
+
if_metageneration_not_match: if_metageneration_not_match,
|
686
|
+
projection: projection,
|
687
|
+
user_project: user_project(user_project),
|
688
|
+
fields: fields,
|
689
|
+
options: options
|
690
|
+
end
|
691
|
+
end
|
692
|
+
|
653
693
|
##
|
654
694
|
# Retrieves a list of ACLs for the given file.
|
655
695
|
def list_file_acls bucket_name, file_name, user_project: nil, options: {}
|
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.52.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-
|
12
|
+
date: 2024-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -59,14 +59,14 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0.
|
62
|
+
version: '0.38'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0.
|
69
|
+
version: '0.38'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: googleauth
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -340,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
340
340
|
- !ruby/object:Gem::Version
|
341
341
|
version: '0'
|
342
342
|
requirements: []
|
343
|
-
rubygems_version: 3.5.
|
343
|
+
rubygems_version: 3.5.6
|
344
344
|
signing_key:
|
345
345
|
specification_version: 4
|
346
346
|
summary: API Client library for Google Cloud Storage
|