google-cloud-storage 1.40.0 → 1.41.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 +10 -0
- data/OVERVIEW.md +2 -0
- 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,15 @@
|
|
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
|
+
|
3
13
|
### 1.40.0 (2022-09-13)
|
4
14
|
|
5
15
|
#### 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.
|
@@ -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-09-
|
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
|