google-cloud-storage 1.37.0 → 1.54.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/AUTHENTICATION.md +8 -26
- data/CHANGELOG.md +116 -0
- data/OVERVIEW.md +32 -0
- data/lib/google/cloud/storage/bucket/acl.rb +28 -26
- data/lib/google/cloud/storage/bucket/cors.rb +2 -2
- data/lib/google/cloud/storage/bucket.rb +339 -10
- data/lib/google/cloud/storage/file/list.rb +10 -3
- data/lib/google/cloud/storage/file/signer_v2.rb +5 -4
- data/lib/google/cloud/storage/file/signer_v4.rb +5 -5
- data/lib/google/cloud/storage/file.rb +141 -10
- data/lib/google/cloud/storage/project.rb +75 -6
- data/lib/google/cloud/storage/service.rb +283 -227
- data/lib/google/cloud/storage/version.rb +1 -1
- data/lib/google/cloud/storage.rb +23 -8
- data/lib/google-cloud-storage.rb +24 -16
- metadata +42 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67fa1effce117003750f759eba79de92380616365652f2a19ba49b1986c75634
|
4
|
+
data.tar.gz: 9729e6dc51f15a9a5e2e0370771f980908f9d6284973503c9c4d4c1e561b8d84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec9022c921c0714ebf7f47131c745c113bb0480a34a376ca10055ccdee024821a518d1a87f742486118d7fb3e570beaeef5746f12676d5790e6ae697439dabd9
|
7
|
+
data.tar.gz: d5e57fd75d565a8328cf79ce42374883e4da7f875c7fd9571e928f9648c05578bee5743d68465819f3e5d488469d277749aecebd44810198fd1a1ca0cac6f3c3
|
data/AUTHENTICATION.md
CHANGED
@@ -112,15 +112,6 @@ those that produce
|
|
112
112
|
post objects. For these methods, authentication using a service account JSON key file
|
113
113
|
is required.
|
114
114
|
|
115
|
-
[gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
|
116
|
-
[dev-console]: https://console.cloud.google.com/project
|
117
|
-
|
118
|
-
[enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
|
119
|
-
|
120
|
-
[create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
|
121
|
-
[create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
|
122
|
-
[reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
|
123
|
-
|
124
115
|
## Creating a Service Account
|
125
116
|
|
126
117
|
Google Cloud requires a **Project ID** and **Service Account Credentials** to
|
@@ -130,31 +121,22 @@ connect to most services with google-cloud-storage.
|
|
130
121
|
If you are not running this client on Google Compute Engine, you need a Google
|
131
122
|
Developers service account.
|
132
123
|
|
133
|
-
1. Visit the [Google
|
124
|
+
1. Visit the [Google Cloud Console](https://console.cloud.google.com/project).
|
134
125
|
1. Create a new project or click on an existing project.
|
135
|
-
1. Activate the
|
126
|
+
1. Activate the menu in the upper left and select **APIs & Services**. From
|
136
127
|
here, you will enable the APIs that your application requires.
|
137
128
|
|
138
|
-
![Enable the APIs that your application requires][enable-apis]
|
139
|
-
|
140
129
|
*Note: You may need to enable billing in order to use these services.*
|
141
130
|
|
142
131
|
1. Select **Credentials** from the side navigation.
|
143
132
|
|
144
|
-
|
145
|
-
|
146
|
-
![Create a new service account][create-new-service-account]
|
147
|
-
|
148
|
-
![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
|
149
|
-
|
150
|
-
Find the "Add credentials" drop down and select "Service account" to be
|
151
|
-
guided through downloading a new JSON key file.
|
152
|
-
|
153
|
-
If you want to re-use an existing service account, you can easily generate a
|
154
|
-
new key file. Just select the account you wish to re-use, and click "Generate
|
155
|
-
new JSON key":
|
133
|
+
Find the "Create credentials" drop down near the top of the page, and select
|
134
|
+
"Service account" to be guided through downloading a new JSON key file.
|
156
135
|
|
157
|
-
|
136
|
+
If you want to re-use an existing service account, you can easily generate
|
137
|
+
a new key file. Just select the account you wish to re-use click the pencil
|
138
|
+
tool on the right side to edit the service account, select the **Keys** tab,
|
139
|
+
and then select **Add Key**.
|
158
140
|
|
159
141
|
The key file you download will be used by this library to authenticate API
|
160
142
|
requests and should be stored in a secure location.
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,121 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.54.0 (2024-12-11)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Updated required Ruby version to 3.0 or later ([#27599](https://github.com/googleapis/google-cloud-ruby/issues/27599))
|
8
|
+
|
9
|
+
### 1.53.0 (2024-12-04)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* add integration test for universe domain ([#27384](https://github.com/googleapis/google-cloud-ruby/issues/27384))
|
14
|
+
* fetch file and bucket details from url ([#27322](https://github.com/googleapis/google-cloud-ruby/issues/27322))
|
15
|
+
|
16
|
+
### 1.52.0 (2024-05-31)
|
17
|
+
|
18
|
+
#### Features
|
19
|
+
|
20
|
+
* support for hierarchical namespace (folders) ([#25967](https://github.com/googleapis/google-cloud-ruby/issues/25967))
|
21
|
+
|
22
|
+
### 1.51.0 (2024-04-25)
|
23
|
+
|
24
|
+
#### Features
|
25
|
+
|
26
|
+
* Respect custom endpoint for signed_url ([#25469](https://github.com/googleapis/google-cloud-ruby/issues/25469))
|
27
|
+
|
28
|
+
### 1.50.0 (2024-04-19)
|
29
|
+
|
30
|
+
#### Features
|
31
|
+
|
32
|
+
* Add support for soft deletion ([#25340](https://github.com/googleapis/google-cloud-ruby/issues/25340))
|
33
|
+
#### Bug Fixes
|
34
|
+
|
35
|
+
* Set configured univer_domain and endpoint when initializing through Service ([#25665](https://github.com/googleapis/google-cloud-ruby/issues/25665))
|
36
|
+
|
37
|
+
### 1.49.0 (2024-02-21)
|
38
|
+
|
39
|
+
#### Features
|
40
|
+
|
41
|
+
* Support of Managed Folders ([#24809](https://github.com/googleapis/google-cloud-ruby/issues/24809))
|
42
|
+
|
43
|
+
### 1.48.1 (2024-01-26)
|
44
|
+
|
45
|
+
#### Bug Fixes
|
46
|
+
|
47
|
+
* Raise an error on mismatching universe domain ([#24486](https://github.com/googleapis/google-cloud-ruby/issues/24486))
|
48
|
+
|
49
|
+
### 1.48.0 (2024-01-25)
|
50
|
+
|
51
|
+
#### Features
|
52
|
+
|
53
|
+
* Support for universe_domain ([#24449](https://github.com/googleapis/google-cloud-ruby/issues/24449))
|
54
|
+
|
55
|
+
### 1.47.0 (2024-01-09)
|
56
|
+
|
57
|
+
#### Features
|
58
|
+
|
59
|
+
* support for object lock / retention ([#23732](https://github.com/googleapis/google-cloud-ruby/issues/23732))
|
60
|
+
|
61
|
+
### 1.46.0 (2024-01-08)
|
62
|
+
|
63
|
+
#### Features
|
64
|
+
|
65
|
+
* support match_glob for Object.list
|
66
|
+
|
67
|
+
### 1.45.0 (2023-11-06)
|
68
|
+
|
69
|
+
#### Features
|
70
|
+
|
71
|
+
* added autoclass v2.1 features ([#23483](https://github.com/googleapis/google-cloud-ruby/issues/23483))
|
72
|
+
|
73
|
+
### 1.44.0 (2022-11-02)
|
74
|
+
|
75
|
+
#### Features
|
76
|
+
|
77
|
+
* support autoclass
|
78
|
+
|
79
|
+
### 1.43.0 (2022-09-30)
|
80
|
+
|
81
|
+
#### Features
|
82
|
+
|
83
|
+
* Add retry conformance test ([#18230](https://github.com/googleapis/google-cloud-ruby/issues/18230))
|
84
|
+
|
85
|
+
### 1.42.0 (2022-09-21)
|
86
|
+
|
87
|
+
#### Features
|
88
|
+
|
89
|
+
* send invocation_id header in all requests ([#19161](https://github.com/googleapis/google-cloud-ruby/issues/19161))
|
90
|
+
|
91
|
+
### 1.41.0 (2022-09-16)
|
92
|
+
|
93
|
+
#### Features
|
94
|
+
|
95
|
+
* add retry support for non-idempotent operations ([#19134](https://github.com/googleapis/google-cloud-ruby/issues/19134))
|
96
|
+
#### Bug Fixes
|
97
|
+
|
98
|
+
* Correct options checks in retry operations ([#19135](https://github.com/googleapis/google-cloud-ruby/issues/19135))
|
99
|
+
* Update api for bucket update ([#19110](https://github.com/googleapis/google-cloud-ruby/issues/19110))
|
100
|
+
|
101
|
+
### 1.40.0 (2022-09-13)
|
102
|
+
|
103
|
+
#### Features
|
104
|
+
|
105
|
+
* Update all patch bucket helper methods to accept preconditions ([#19117](https://github.com/googleapis/google-cloud-ruby/issues/19117))
|
106
|
+
|
107
|
+
### 1.39.0 (2022-08-24)
|
108
|
+
|
109
|
+
#### Features
|
110
|
+
|
111
|
+
* add support for conditional idempotent operations ([#18834](https://github.com/googleapis/google-cloud-ruby/issues/18834))
|
112
|
+
|
113
|
+
### 1.38.0 (2022-07-31)
|
114
|
+
|
115
|
+
#### Features
|
116
|
+
|
117
|
+
* Add support for dual region gcs buckets ([#18862](https://github.com/googleapis/google-cloud-ruby/issues/18862))
|
118
|
+
|
3
119
|
### 1.37.0 (2022-06-30)
|
4
120
|
|
5
121
|
#### Features
|
data/OVERVIEW.md
CHANGED
@@ -563,6 +563,38 @@ require "google/cloud/storage"
|
|
563
563
|
storage = Google::Cloud::Storage.new retries: 10, timeout: 120
|
564
564
|
```
|
565
565
|
|
566
|
+
The library by default retries all API requests which are always idempotent on a
|
567
|
+
"transient" error.
|
568
|
+
|
569
|
+
For API requests which are idempotent only if the some conditions are satisfied
|
570
|
+
(For ex. a file has the same "generation"), the library retries only if the
|
571
|
+
condition is specified.
|
572
|
+
|
573
|
+
Rather than using this default behaviour, you may choose to disable the retries
|
574
|
+
on your own.
|
575
|
+
|
576
|
+
You can pass `retries` as `0` to disable retries for all operations regardless
|
577
|
+
of their idempotencies.
|
578
|
+
|
579
|
+
```ruby
|
580
|
+
require "google/cloud/storage"
|
581
|
+
|
582
|
+
storage = Google::Cloud::Storage.new retries: 0
|
583
|
+
```
|
584
|
+
|
585
|
+
You can also disable retries for a particular operation by passing `retries` as
|
586
|
+
`0` in the `options` field.
|
587
|
+
|
588
|
+
```ruby
|
589
|
+
require "google/cloud/storage"
|
590
|
+
|
591
|
+
storage = Google::Cloud::Storage.new
|
592
|
+
service = storage.service
|
593
|
+
service.get_bucket bucket_name, options: {retries: 0}
|
594
|
+
```
|
595
|
+
|
596
|
+
For those API requests which are never idempotent, the library passes retries=0 by default, suppressing any retries.
|
597
|
+
|
566
598
|
See the [Storage status and error
|
567
599
|
codes](https://cloud.google.com/storage/docs/json_api/v1/status-codes)
|
568
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
|
|
@@ -182,7 +182,7 @@ module Google
|
|
182
182
|
@origin = Array(origin)
|
183
183
|
@methods = Array(methods)
|
184
184
|
@headers = Array(headers)
|
185
|
-
@max_age =
|
185
|
+
@max_age = max_age || 1800
|
186
186
|
end
|
187
187
|
|
188
188
|
# @private
|
@@ -195,7 +195,7 @@ module Google
|
|
195
195
|
|
196
196
|
# @private
|
197
197
|
def self.from_gapi gapi
|
198
|
-
new gapi.origin.dup, gapi.http_method.dup,
|
198
|
+
new gapi.origin.dup, gapi.http_method.dup,
|
199
199
|
headers: gapi.response_header.dup,
|
200
200
|
max_age: gapi.max_age_seconds
|
201
201
|
end
|