google-cloud-storage 1.39.0 → 1.42.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 +22 -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 +65 -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: 24a6e0506ffc44db974accb0e91b5d9efd1f9898a07b15bb286d8d9428c83ec1
|
4
|
+
data.tar.gz: f51a2efcd382bb9bc5b2c04503456eca85cdf400897995a32a3612e56839e6e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ccaa608e3aa4e9ffc214885ce11a798d622d216a18a686f80972e6f6b469b6763535871228b6eb75af7c1e1a0b918c2343f15c114f9422925da8c7ae13b5c5e
|
7
|
+
data.tar.gz: 2c7b4e5b998be2a49f10077024590d6898384da1dcc44a4e5995cf0a55419be421671fe6e78c669844c79ea1193566dbe303a34f208dd3d29ee0fba900f8b036
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.42.0 (2022-09-21)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* send invocation_id header in all requests ([#19161](https://github.com/googleapis/google-cloud-ruby/issues/19161))
|
8
|
+
|
9
|
+
### 1.41.0 (2022-09-16)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* add retry support for non-idempotent operations ([#19134](https://github.com/googleapis/google-cloud-ruby/issues/19134))
|
14
|
+
#### Bug Fixes
|
15
|
+
|
16
|
+
* Correct options checks in retry operations ([#19135](https://github.com/googleapis/google-cloud-ruby/issues/19135))
|
17
|
+
* Update api for bucket update ([#19110](https://github.com/googleapis/google-cloud-ruby/issues/19110))
|
18
|
+
|
19
|
+
### 1.40.0 (2022-09-13)
|
20
|
+
|
21
|
+
#### Features
|
22
|
+
|
23
|
+
* Update all patch bucket helper methods to accept preconditions ([#19117](https://github.com/googleapis/google-cloud-ruby/issues/19117))
|
24
|
+
|
3
25
|
### 1.39.0 (2022-08-24)
|
4
26
|
|
5
27
|
#### 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
|
@@ -64,6 +64,7 @@ module Google
|
|
64
64
|
@service.request_options.base_interval = base_interval if base_interval
|
65
65
|
@service.request_options.max_interval = max_interval if max_interval
|
66
66
|
@service.request_options.multiplier = multiplier if multiplier
|
67
|
+
@service.request_options.add_invocation_id_header = true
|
67
68
|
@service.authorization = @credentials.client if @credentials
|
68
69
|
@service.root_url = host if host
|
69
70
|
end
|
@@ -135,7 +136,7 @@ module Google
|
|
135
136
|
bucket_gapi.acl = [] if predefined_acl
|
136
137
|
bucket_gapi.default_object_acl = [] if predefined_default_acl
|
137
138
|
|
138
|
-
if options[:
|
139
|
+
if options[:retries].nil?
|
139
140
|
is_idempotent = retry? if_metageneration_match: if_metageneration_match
|
140
141
|
options = is_idempotent ? {} : { retries: 0 }
|
141
142
|
end
|
@@ -196,6 +197,9 @@ module Google
|
|
196
197
|
def insert_bucket_acl bucket_name, entity, role, user_project: nil, options: {}
|
197
198
|
params = { entity: entity, role: role }.delete_if { |_k, v| v.nil? }
|
198
199
|
new_acl = Google::Apis::StorageV1::BucketAccessControl.new(**params)
|
200
|
+
if options[:retries].nil?
|
201
|
+
options = options.merge({ retries: 0 })
|
202
|
+
end
|
199
203
|
execute do
|
200
204
|
service.insert_bucket_access_control \
|
201
205
|
bucket_name, new_acl, user_project: user_project(user_project),
|
@@ -206,6 +210,9 @@ module Google
|
|
206
210
|
##
|
207
211
|
# Permanently deletes a bucket ACL.
|
208
212
|
def delete_bucket_acl bucket_name, entity, user_project: nil, options: {}
|
213
|
+
if options[:retries].nil?
|
214
|
+
options = options.merge({ retries: 0 })
|
215
|
+
end
|
209
216
|
execute do
|
210
217
|
service.delete_bucket_access_control \
|
211
218
|
bucket_name, entity, user_project: user_project(user_project),
|
@@ -226,6 +233,9 @@ module Google
|
|
226
233
|
##
|
227
234
|
# Creates a new default ACL.
|
228
235
|
def insert_default_acl bucket_name, entity, role, user_project: nil, options: {}
|
236
|
+
if options[:retries].nil?
|
237
|
+
options = options.merge({ retries: 0 })
|
238
|
+
end
|
229
239
|
param = { entity: entity, role: role }.delete_if { |_k, v| v.nil? }
|
230
240
|
new_acl = Google::Apis::StorageV1::ObjectAccessControl.new(**param)
|
231
241
|
execute do
|
@@ -238,6 +248,9 @@ module Google
|
|
238
248
|
##
|
239
249
|
# Permanently deletes a default ACL.
|
240
250
|
def delete_default_acl bucket_name, entity, user_project: nil, options: {}
|
251
|
+
if options[:retries].nil?
|
252
|
+
options = options.merge({ retries: 0 })
|
253
|
+
end
|
241
254
|
execute do
|
242
255
|
service.delete_default_object_access_control \
|
243
256
|
bucket_name, entity, user_project: user_project(user_project),
|
@@ -299,6 +312,10 @@ module Google
|
|
299
312
|
topic: topic_path(topic_name) }.delete_if { |_k, v| v.nil? }
|
300
313
|
new_notification = Google::Apis::StorageV1::Notification.new(**params)
|
301
314
|
|
315
|
+
if options[:retries].nil?
|
316
|
+
options = options.merge({ retries: 0 })
|
317
|
+
end
|
318
|
+
|
302
319
|
execute do
|
303
320
|
service.insert_notification \
|
304
321
|
bucket_name, new_notification,
|
@@ -385,7 +402,7 @@ module Google
|
|
385
402
|
file_obj = Google::Apis::StorageV1::Object.new(**params)
|
386
403
|
content_type ||= mime_type_for(path || Pathname(source).to_path)
|
387
404
|
|
388
|
-
if options[:
|
405
|
+
if options[:retries].nil?
|
389
406
|
is_idempotent = retry? if_generation_match: if_generation_match
|
390
407
|
options = is_idempotent ? key_options(key) : key_options(key).merge(retries: 0)
|
391
408
|
else
|
@@ -460,7 +477,7 @@ module Google
|
|
460
477
|
options: {}
|
461
478
|
key_options = rewrite_key_options source_key, destination_key
|
462
479
|
|
463
|
-
if options[:
|
480
|
+
if options[:retries].nil?
|
464
481
|
is_idempotent = retry? if_generation_match: if_generation_match
|
465
482
|
options = is_idempotent ? key_options : key_options.merge(retries: 0)
|
466
483
|
else
|
@@ -508,7 +525,7 @@ module Google
|
|
508
525
|
compose_req = Google::Apis::StorageV1::ComposeRequest.new source_objects: source_objects,
|
509
526
|
destination: destination_gapi
|
510
527
|
|
511
|
-
if options[:
|
528
|
+
if options[:retries].nil?
|
512
529
|
is_idempotent = retry? if_generation_match: if_generation_match
|
513
530
|
options = is_idempotent ? key_options(key) : key_options(key).merge(retries: 0)
|
514
531
|
else
|
@@ -565,7 +582,7 @@ module Google
|
|
565
582
|
options: {}
|
566
583
|
file_gapi ||= Google::Apis::StorageV1::Object.new
|
567
584
|
|
568
|
-
if options[:
|
585
|
+
if options[:retries].nil?
|
569
586
|
is_idempotent = retry? if_metageneration_match: if_metageneration_match
|
570
587
|
options = is_idempotent ? {} : { retries: 0 }
|
571
588
|
end
|
@@ -597,7 +614,7 @@ module Google
|
|
597
614
|
user_project: nil,
|
598
615
|
options: {}
|
599
616
|
|
600
|
-
if options[:
|
617
|
+
if options[:retries].nil?
|
601
618
|
is_idempotent = retry? generation: generation, if_generation_match: if_generation_match
|
602
619
|
options = is_idempotent ? {} : { retries: 0 }
|
603
620
|
end
|
@@ -629,6 +646,9 @@ module Google
|
|
629
646
|
def insert_file_acl bucket_name, file_name, entity, role,
|
630
647
|
generation: nil, user_project: nil,
|
631
648
|
options: {}
|
649
|
+
if options[:retries].nil?
|
650
|
+
options = options.merge({ retries: 0 })
|
651
|
+
end
|
632
652
|
params = { entity: entity, role: role }.delete_if { |_k, v| v.nil? }
|
633
653
|
new_acl = Google::Apis::StorageV1::ObjectAccessControl.new(**params)
|
634
654
|
execute do
|
@@ -643,6 +663,9 @@ module Google
|
|
643
663
|
# Permanently deletes a file ACL.
|
644
664
|
def delete_file_acl bucket_name, file_name, entity, generation: nil,
|
645
665
|
user_project: nil, options: {}
|
666
|
+
if options[:retries].nil?
|
667
|
+
options = options.merge({ retries: 0 })
|
668
|
+
end
|
646
669
|
execute do
|
647
670
|
service.delete_object_access_control \
|
648
671
|
bucket_name, file_name, entity,
|
@@ -656,6 +679,11 @@ module Google
|
|
656
679
|
# Returns Google::Apis::StorageV1::HmacKey.
|
657
680
|
def create_hmac_key service_account_email, project_id: nil,
|
658
681
|
user_project: nil, options: {}
|
682
|
+
|
683
|
+
if options[:retries].nil?
|
684
|
+
options = options.merge({ retries: 0 })
|
685
|
+
end
|
686
|
+
|
659
687
|
execute do
|
660
688
|
service.create_project_hmac_key \
|
661
689
|
(project_id || @project), service_account_email,
|
@@ -721,6 +749,37 @@ module Google
|
|
721
749
|
end
|
722
750
|
end
|
723
751
|
|
752
|
+
##
|
753
|
+
# Updates a bucket, including its ACL metadata.
|
754
|
+
def update_bucket bucket_name,
|
755
|
+
bucket_gapi = nil,
|
756
|
+
predefined_acl: nil,
|
757
|
+
predefined_default_acl: nil,
|
758
|
+
if_metageneration_match: nil,
|
759
|
+
if_metageneration_not_match: nil,
|
760
|
+
user_project: nil,
|
761
|
+
options: {}
|
762
|
+
bucket_gapi ||= Google::Apis::StorageV1::Bucket.new
|
763
|
+
bucket_gapi.acl = [] if predefined_acl
|
764
|
+
bucket_gapi.default_object_acl = [] if predefined_default_acl
|
765
|
+
|
766
|
+
if options[:retries].nil?
|
767
|
+
is_idempotent = retry? if_metageneration_match: if_metageneration_match
|
768
|
+
options = is_idempotent ? {} : { retries: 0 }
|
769
|
+
end
|
770
|
+
|
771
|
+
execute do
|
772
|
+
service.update_bucket bucket_name,
|
773
|
+
bucket_gapi,
|
774
|
+
predefined_acl: predefined_acl,
|
775
|
+
predefined_default_object_acl: predefined_default_acl,
|
776
|
+
if_metageneration_match: if_metageneration_match,
|
777
|
+
if_metageneration_not_match: if_metageneration_not_match,
|
778
|
+
user_project: user_project(user_project),
|
779
|
+
options: options
|
780
|
+
end
|
781
|
+
end
|
782
|
+
|
724
783
|
##
|
725
784
|
# Retrieves the mime-type for a file path.
|
726
785
|
# 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.42.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-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|