google-cloud-storage 1.39.0 → 1.41.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/OVERVIEW.md +2 -0
- data/lib/google/cloud/storage/bucket/acl.rb +28 -26
- data/lib/google/cloud/storage/bucket.rb +23 -3
- data/lib/google/cloud/storage/service.rb +64 -6
- data/lib/google/cloud/storage/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76faccf343a999af8ed510541b67d64e5702bc6bbf963f75897a8fa7790a3e33
|
4
|
+
data.tar.gz: 628678d5a6cfa02d876f9c2074bd10946f4b26321b3662f3ec4adc867ea2a01f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3b97cdc696e3a31de191ef1dc9d787d38213828fee6bb4453bf8b8a66177439fdc82146decdea261c83d6271aabfda9f69e9535a2e875a26fd6cbe62f31d6b2
|
7
|
+
data.tar.gz: 6fb8915241720f4ac9a163028ab1db195309591cab27b1e12cb6020bd5fc9c85bebadebc9301f2c68a04c32ea32d24408c20357bd637c91968dc209a96535bde
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.41.0 (2022-09-16)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* add retry support for non-idempotent operations ([#19134](https://github.com/googleapis/google-cloud-ruby/issues/19134))
|
8
|
+
#### Bug Fixes
|
9
|
+
|
10
|
+
* Correct options checks in retry operations ([#19135](https://github.com/googleapis/google-cloud-ruby/issues/19135))
|
11
|
+
* Update api for bucket update ([#19110](https://github.com/googleapis/google-cloud-ruby/issues/19110))
|
12
|
+
|
13
|
+
### 1.40.0 (2022-09-13)
|
14
|
+
|
15
|
+
#### Features
|
16
|
+
|
17
|
+
* Update all patch bucket helper methods to accept preconditions ([#19117](https://github.com/googleapis/google-cloud-ruby/issues/19117))
|
18
|
+
|
3
19
|
### 1.39.0 (2022-08-24)
|
4
20
|
|
5
21
|
#### Features
|
data/OVERVIEW.md
CHANGED
@@ -593,6 +593,8 @@ service = storage.service
|
|
593
593
|
service.get_bucket bucket_name, options: {retries: 0}
|
594
594
|
```
|
595
595
|
|
596
|
+
For those API requests which are never idempotent, the library passes retries=0 by default, suppressing any retries.
|
597
|
+
|
596
598
|
See the [Storage status and error
|
597
599
|
codes](https://cloud.google.com/storage/docs/json_api/v1/status-codes)
|
598
600
|
for a list of error conditions.
|
@@ -349,8 +349,8 @@ module Google
|
|
349
349
|
#
|
350
350
|
# bucket.acl.auth!
|
351
351
|
#
|
352
|
-
def auth!
|
353
|
-
update_predefined_acl! "authenticatedRead"
|
352
|
+
def auth! if_metageneration_match: nil
|
353
|
+
update_predefined_acl! "authenticatedRead", if_metageneration_match: if_metageneration_match
|
354
354
|
end
|
355
355
|
alias authenticatedRead! auth!
|
356
356
|
alias auth_read! auth!
|
@@ -370,8 +370,8 @@ module Google
|
|
370
370
|
#
|
371
371
|
# bucket.acl.private!
|
372
372
|
#
|
373
|
-
def private!
|
374
|
-
update_predefined_acl! "private"
|
373
|
+
def private! if_metageneration_match: nil
|
374
|
+
update_predefined_acl! "private", if_metageneration_match: if_metageneration_match
|
375
375
|
end
|
376
376
|
|
377
377
|
##
|
@@ -387,8 +387,8 @@ module Google
|
|
387
387
|
#
|
388
388
|
# bucket.acl.project_private!
|
389
389
|
#
|
390
|
-
def project_private!
|
391
|
-
update_predefined_acl! "projectPrivate"
|
390
|
+
def project_private! if_metageneration_match: nil
|
391
|
+
update_predefined_acl! "projectPrivate", if_metageneration_match: if_metageneration_match
|
392
392
|
end
|
393
393
|
alias projectPrivate! project_private!
|
394
394
|
|
@@ -405,8 +405,8 @@ module Google
|
|
405
405
|
#
|
406
406
|
# bucket.acl.public!
|
407
407
|
#
|
408
|
-
def public!
|
409
|
-
update_predefined_acl! "publicRead"
|
408
|
+
def public! if_metageneration_match: nil
|
409
|
+
update_predefined_acl! "publicRead", if_metageneration_match: if_metageneration_match
|
410
410
|
end
|
411
411
|
alias publicRead! public!
|
412
412
|
alias public_read! public!
|
@@ -423,8 +423,8 @@ module Google
|
|
423
423
|
#
|
424
424
|
# bucket.acl.public_write!
|
425
425
|
#
|
426
|
-
def public_write!
|
427
|
-
update_predefined_acl! "publicReadWrite"
|
426
|
+
def public_write! if_metageneration_match: nil
|
427
|
+
update_predefined_acl! "publicReadWrite", if_metageneration_match: if_metageneration_match
|
428
428
|
end
|
429
429
|
alias publicReadWrite! public_write!
|
430
430
|
|
@@ -437,9 +437,10 @@ module Google
|
|
437
437
|
self
|
438
438
|
end
|
439
439
|
|
440
|
-
def update_predefined_acl! acl_role
|
440
|
+
def update_predefined_acl! acl_role, if_metageneration_match: nil
|
441
441
|
@service.patch_bucket @bucket, predefined_acl: acl_role,
|
442
|
-
user_project: user_project
|
442
|
+
user_project: user_project,
|
443
|
+
if_metageneration_match: if_metageneration_match
|
443
444
|
clear!
|
444
445
|
end
|
445
446
|
|
@@ -714,8 +715,8 @@ module Google
|
|
714
715
|
#
|
715
716
|
# bucket.default_acl.auth!
|
716
717
|
#
|
717
|
-
def auth!
|
718
|
-
update_predefined_default_acl! "authenticatedRead"
|
718
|
+
def auth! if_metageneration_match: nil
|
719
|
+
update_predefined_default_acl! "authenticatedRead", if_metageneration_match: if_metageneration_match
|
719
720
|
end
|
720
721
|
alias authenticatedRead! auth!
|
721
722
|
alias auth_read! auth!
|
@@ -735,8 +736,8 @@ module Google
|
|
735
736
|
#
|
736
737
|
# bucket.default_acl.owner_full!
|
737
738
|
#
|
738
|
-
def owner_full!
|
739
|
-
update_predefined_default_acl! "bucketOwnerFullControl"
|
739
|
+
def owner_full! if_metageneration_match: nil
|
740
|
+
update_predefined_default_acl! "bucketOwnerFullControl", if_metageneration_match: if_metageneration_match
|
740
741
|
end
|
741
742
|
alias bucketOwnerFullControl! owner_full!
|
742
743
|
|
@@ -753,8 +754,8 @@ module Google
|
|
753
754
|
#
|
754
755
|
# bucket.default_acl.owner_read!
|
755
756
|
#
|
756
|
-
def owner_read!
|
757
|
-
update_predefined_default_acl! "bucketOwnerRead"
|
757
|
+
def owner_read! if_metageneration_match: nil
|
758
|
+
update_predefined_default_acl! "bucketOwnerRead", if_metageneration_match: if_metageneration_match
|
758
759
|
end
|
759
760
|
alias bucketOwnerRead! owner_read!
|
760
761
|
|
@@ -771,8 +772,8 @@ module Google
|
|
771
772
|
#
|
772
773
|
# bucket.default_acl.private!
|
773
774
|
#
|
774
|
-
def private!
|
775
|
-
update_predefined_default_acl! "private"
|
775
|
+
def private! if_metageneration_match: nil
|
776
|
+
update_predefined_default_acl! "private", if_metageneration_match: if_metageneration_match
|
776
777
|
end
|
777
778
|
|
778
779
|
##
|
@@ -788,8 +789,8 @@ module Google
|
|
788
789
|
#
|
789
790
|
# bucket.default_acl.project_private!
|
790
791
|
#
|
791
|
-
def project_private!
|
792
|
-
update_predefined_default_acl! "projectPrivate"
|
792
|
+
def project_private! if_metageneration_match: nil
|
793
|
+
update_predefined_default_acl! "projectPrivate", if_metageneration_match: if_metageneration_match
|
793
794
|
end
|
794
795
|
alias projectPrivate! project_private!
|
795
796
|
|
@@ -806,8 +807,8 @@ module Google
|
|
806
807
|
#
|
807
808
|
# bucket.default_acl.public!
|
808
809
|
#
|
809
|
-
def public!
|
810
|
-
update_predefined_default_acl! "publicRead"
|
810
|
+
def public! if_metageneration_match: nil
|
811
|
+
update_predefined_default_acl! "publicRead", if_metageneration_match: if_metageneration_match
|
811
812
|
end
|
812
813
|
alias publicRead! public!
|
813
814
|
alias public_read! public!
|
@@ -820,9 +821,10 @@ module Google
|
|
820
821
|
self
|
821
822
|
end
|
822
823
|
|
823
|
-
def update_predefined_default_acl! acl_role
|
824
|
+
def update_predefined_default_acl! acl_role, if_metageneration_match: nil
|
824
825
|
@service.patch_bucket @bucket, predefined_default_acl: acl_role,
|
825
|
-
user_project: user_project
|
826
|
+
user_project: user_project,
|
827
|
+
if_metageneration_match: if_metageneration_match
|
826
828
|
clear!
|
827
829
|
end
|
828
830
|
|
@@ -1170,9 +1170,9 @@ module Google
|
|
1170
1170
|
updater.check_for_mutable_cors!
|
1171
1171
|
updater.check_for_mutable_lifecycle!
|
1172
1172
|
return if updater.updates.empty?
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1173
|
+
update_gapi! updater.updates,
|
1174
|
+
if_metageneration_match: if_metageneration_match,
|
1175
|
+
if_metageneration_not_match: if_metageneration_not_match
|
1176
1176
|
end
|
1177
1177
|
|
1178
1178
|
##
|
@@ -2905,6 +2905,26 @@ module Google
|
|
2905
2905
|
self
|
2906
2906
|
end
|
2907
2907
|
|
2908
|
+
def update_gapi! attributes,
|
2909
|
+
if_metageneration_match: nil,
|
2910
|
+
if_metageneration_not_match: nil
|
2911
|
+
attributes = Array(attributes)
|
2912
|
+
attributes.flatten!
|
2913
|
+
return if attributes.empty?
|
2914
|
+
ensure_service!
|
2915
|
+
update_args = Hash[attributes.map do |attr|
|
2916
|
+
[attr, @gapi.send(attr)]
|
2917
|
+
end]
|
2918
|
+
update_gapi = API::Bucket.new(**update_args)
|
2919
|
+
@gapi = service.update_bucket name,
|
2920
|
+
update_gapi,
|
2921
|
+
if_metageneration_match: if_metageneration_match,
|
2922
|
+
if_metageneration_not_match: if_metageneration_not_match,
|
2923
|
+
user_project: user_project
|
2924
|
+
@lazy = nil
|
2925
|
+
self
|
2926
|
+
end
|
2927
|
+
|
2908
2928
|
##
|
2909
2929
|
# Raise an error if the file is not found.
|
2910
2930
|
def ensure_io_or_file_exists! file
|
@@ -135,7 +135,7 @@ module Google
|
|
135
135
|
bucket_gapi.acl = [] if predefined_acl
|
136
136
|
bucket_gapi.default_object_acl = [] if predefined_default_acl
|
137
137
|
|
138
|
-
if options[:
|
138
|
+
if options[:retries].nil?
|
139
139
|
is_idempotent = retry? if_metageneration_match: if_metageneration_match
|
140
140
|
options = is_idempotent ? {} : { retries: 0 }
|
141
141
|
end
|
@@ -196,6 +196,9 @@ module Google
|
|
196
196
|
def insert_bucket_acl bucket_name, entity, role, user_project: nil, options: {}
|
197
197
|
params = { entity: entity, role: role }.delete_if { |_k, v| v.nil? }
|
198
198
|
new_acl = Google::Apis::StorageV1::BucketAccessControl.new(**params)
|
199
|
+
if options[:retries].nil?
|
200
|
+
options = options.merge({ retries: 0 })
|
201
|
+
end
|
199
202
|
execute do
|
200
203
|
service.insert_bucket_access_control \
|
201
204
|
bucket_name, new_acl, user_project: user_project(user_project),
|
@@ -206,6 +209,9 @@ module Google
|
|
206
209
|
##
|
207
210
|
# Permanently deletes a bucket ACL.
|
208
211
|
def delete_bucket_acl bucket_name, entity, user_project: nil, options: {}
|
212
|
+
if options[:retries].nil?
|
213
|
+
options = options.merge({ retries: 0 })
|
214
|
+
end
|
209
215
|
execute do
|
210
216
|
service.delete_bucket_access_control \
|
211
217
|
bucket_name, entity, user_project: user_project(user_project),
|
@@ -226,6 +232,9 @@ module Google
|
|
226
232
|
##
|
227
233
|
# Creates a new default ACL.
|
228
234
|
def insert_default_acl bucket_name, entity, role, user_project: nil, options: {}
|
235
|
+
if options[:retries].nil?
|
236
|
+
options = options.merge({ retries: 0 })
|
237
|
+
end
|
229
238
|
param = { entity: entity, role: role }.delete_if { |_k, v| v.nil? }
|
230
239
|
new_acl = Google::Apis::StorageV1::ObjectAccessControl.new(**param)
|
231
240
|
execute do
|
@@ -238,6 +247,9 @@ module Google
|
|
238
247
|
##
|
239
248
|
# Permanently deletes a default ACL.
|
240
249
|
def delete_default_acl bucket_name, entity, user_project: nil, options: {}
|
250
|
+
if options[:retries].nil?
|
251
|
+
options = options.merge({ retries: 0 })
|
252
|
+
end
|
241
253
|
execute do
|
242
254
|
service.delete_default_object_access_control \
|
243
255
|
bucket_name, entity, user_project: user_project(user_project),
|
@@ -299,6 +311,10 @@ module Google
|
|
299
311
|
topic: topic_path(topic_name) }.delete_if { |_k, v| v.nil? }
|
300
312
|
new_notification = Google::Apis::StorageV1::Notification.new(**params)
|
301
313
|
|
314
|
+
if options[:retries].nil?
|
315
|
+
options = options.merge({ retries: 0 })
|
316
|
+
end
|
317
|
+
|
302
318
|
execute do
|
303
319
|
service.insert_notification \
|
304
320
|
bucket_name, new_notification,
|
@@ -385,7 +401,7 @@ module Google
|
|
385
401
|
file_obj = Google::Apis::StorageV1::Object.new(**params)
|
386
402
|
content_type ||= mime_type_for(path || Pathname(source).to_path)
|
387
403
|
|
388
|
-
if options[:
|
404
|
+
if options[:retries].nil?
|
389
405
|
is_idempotent = retry? if_generation_match: if_generation_match
|
390
406
|
options = is_idempotent ? key_options(key) : key_options(key).merge(retries: 0)
|
391
407
|
else
|
@@ -460,7 +476,7 @@ module Google
|
|
460
476
|
options: {}
|
461
477
|
key_options = rewrite_key_options source_key, destination_key
|
462
478
|
|
463
|
-
if options[:
|
479
|
+
if options[:retries].nil?
|
464
480
|
is_idempotent = retry? if_generation_match: if_generation_match
|
465
481
|
options = is_idempotent ? key_options : key_options.merge(retries: 0)
|
466
482
|
else
|
@@ -508,7 +524,7 @@ module Google
|
|
508
524
|
compose_req = Google::Apis::StorageV1::ComposeRequest.new source_objects: source_objects,
|
509
525
|
destination: destination_gapi
|
510
526
|
|
511
|
-
if options[:
|
527
|
+
if options[:retries].nil?
|
512
528
|
is_idempotent = retry? if_generation_match: if_generation_match
|
513
529
|
options = is_idempotent ? key_options(key) : key_options(key).merge(retries: 0)
|
514
530
|
else
|
@@ -565,7 +581,7 @@ module Google
|
|
565
581
|
options: {}
|
566
582
|
file_gapi ||= Google::Apis::StorageV1::Object.new
|
567
583
|
|
568
|
-
if options[:
|
584
|
+
if options[:retries].nil?
|
569
585
|
is_idempotent = retry? if_metageneration_match: if_metageneration_match
|
570
586
|
options = is_idempotent ? {} : { retries: 0 }
|
571
587
|
end
|
@@ -597,7 +613,7 @@ module Google
|
|
597
613
|
user_project: nil,
|
598
614
|
options: {}
|
599
615
|
|
600
|
-
if options[:
|
616
|
+
if options[:retries].nil?
|
601
617
|
is_idempotent = retry? generation: generation, if_generation_match: if_generation_match
|
602
618
|
options = is_idempotent ? {} : { retries: 0 }
|
603
619
|
end
|
@@ -629,6 +645,9 @@ module Google
|
|
629
645
|
def insert_file_acl bucket_name, file_name, entity, role,
|
630
646
|
generation: nil, user_project: nil,
|
631
647
|
options: {}
|
648
|
+
if options[:retries].nil?
|
649
|
+
options = options.merge({ retries: 0 })
|
650
|
+
end
|
632
651
|
params = { entity: entity, role: role }.delete_if { |_k, v| v.nil? }
|
633
652
|
new_acl = Google::Apis::StorageV1::ObjectAccessControl.new(**params)
|
634
653
|
execute do
|
@@ -643,6 +662,9 @@ module Google
|
|
643
662
|
# Permanently deletes a file ACL.
|
644
663
|
def delete_file_acl bucket_name, file_name, entity, generation: nil,
|
645
664
|
user_project: nil, options: {}
|
665
|
+
if options[:retries].nil?
|
666
|
+
options = options.merge({ retries: 0 })
|
667
|
+
end
|
646
668
|
execute do
|
647
669
|
service.delete_object_access_control \
|
648
670
|
bucket_name, file_name, entity,
|
@@ -656,6 +678,11 @@ module Google
|
|
656
678
|
# Returns Google::Apis::StorageV1::HmacKey.
|
657
679
|
def create_hmac_key service_account_email, project_id: nil,
|
658
680
|
user_project: nil, options: {}
|
681
|
+
|
682
|
+
if options[:retries].nil?
|
683
|
+
options = options.merge({ retries: 0 })
|
684
|
+
end
|
685
|
+
|
659
686
|
execute do
|
660
687
|
service.create_project_hmac_key \
|
661
688
|
(project_id || @project), service_account_email,
|
@@ -721,6 +748,37 @@ module Google
|
|
721
748
|
end
|
722
749
|
end
|
723
750
|
|
751
|
+
##
|
752
|
+
# Updates a bucket, including its ACL metadata.
|
753
|
+
def update_bucket bucket_name,
|
754
|
+
bucket_gapi = nil,
|
755
|
+
predefined_acl: nil,
|
756
|
+
predefined_default_acl: nil,
|
757
|
+
if_metageneration_match: nil,
|
758
|
+
if_metageneration_not_match: nil,
|
759
|
+
user_project: nil,
|
760
|
+
options: {}
|
761
|
+
bucket_gapi ||= Google::Apis::StorageV1::Bucket.new
|
762
|
+
bucket_gapi.acl = [] if predefined_acl
|
763
|
+
bucket_gapi.default_object_acl = [] if predefined_default_acl
|
764
|
+
|
765
|
+
if options[:retries].nil?
|
766
|
+
is_idempotent = retry? if_metageneration_match: if_metageneration_match
|
767
|
+
options = is_idempotent ? {} : { retries: 0 }
|
768
|
+
end
|
769
|
+
|
770
|
+
execute do
|
771
|
+
service.update_bucket bucket_name,
|
772
|
+
bucket_gapi,
|
773
|
+
predefined_acl: predefined_acl,
|
774
|
+
predefined_default_object_acl: predefined_default_acl,
|
775
|
+
if_metageneration_match: if_metageneration_match,
|
776
|
+
if_metageneration_not_match: if_metageneration_not_match,
|
777
|
+
user_project: user_project(user_project),
|
778
|
+
options: options
|
779
|
+
end
|
780
|
+
end
|
781
|
+
|
724
782
|
##
|
725
783
|
# Retrieves the mime-type for a file path.
|
726
784
|
# An empty string is returned if no mime-type can be found.
|
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.41.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: 2022-
|
12
|
+
date: 2022-09-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|