google-cloud-storage 1.30.0 → 1.39.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +2 -1
- data/CHANGELOG.md +106 -0
- data/CONTRIBUTING.md +3 -4
- data/OVERVIEW.md +30 -0
- data/lib/google/cloud/storage/bucket/acl.rb +12 -14
- data/lib/google/cloud/storage/bucket/cors.rb +4 -1
- data/lib/google/cloud/storage/bucket/lifecycle.rb +99 -21
- data/lib/google/cloud/storage/bucket/list.rb +3 -3
- data/lib/google/cloud/storage/bucket.rb +421 -62
- data/lib/google/cloud/storage/credentials.rb +16 -14
- data/lib/google/cloud/storage/file/acl.rb +181 -20
- data/lib/google/cloud/storage/file/list.rb +3 -3
- data/lib/google/cloud/storage/file/signer_v2.rb +3 -5
- data/lib/google/cloud/storage/file/signer_v4.rb +12 -10
- data/lib/google/cloud/storage/file/verifier.rb +2 -2
- data/lib/google/cloud/storage/file.rb +223 -32
- data/lib/google/cloud/storage/hmac_key/list.rb +3 -3
- data/lib/google/cloud/storage/policy/binding.rb +5 -3
- data/lib/google/cloud/storage/policy/bindings.rb +2 -2
- data/lib/google/cloud/storage/policy/condition.rb +4 -2
- data/lib/google/cloud/storage/policy.rb +2 -2
- data/lib/google/cloud/storage/post_object.rb +2 -1
- data/lib/google/cloud/storage/project.rb +38 -18
- data/lib/google/cloud/storage/service.rb +352 -284
- data/lib/google/cloud/storage/version.rb +1 -1
- data/lib/google/cloud/storage.rb +66 -13
- data/lib/google-cloud-storage.rb +51 -7
- metadata +24 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a376f2dab9dec5118be28f8fa76c2684e0606aee749fa8387eb6672ba5fb8023
|
4
|
+
data.tar.gz: 1dc9bcc3f0c2cee2ee822211ea8a67f740fdd30f827715da6a8e50b98a64b21b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26b8b0c1544f7e0b1d20b82e539ddaf9431caeb359b177f637f3642eccb58b089b4a9e6202b3c9f051d6c75b01b31cba4b53870b9bf3e190934c0b2d3767e302
|
7
|
+
data.tar.gz: 7d1b0bcfc59f1ad50831489bf2c6f1740ddae969869e221eb809be0b9107f66170f14cb9ed16d50b6d73d76621e59c6b2f5bbb8018725b2d50643fa665645177
|
data/AUTHENTICATION.md
CHANGED
@@ -77,7 +77,8 @@ storage = Google::Cloud::Storage.new
|
|
77
77
|
|
78
78
|
### Configuration
|
79
79
|
|
80
|
-
The **Project ID** and **Credentials JSON** can be configured
|
80
|
+
The **Project ID** and the path to the **Credentials JSON** file can be configured
|
81
|
+
instead of placing them in environment variables or providing them as arguments.
|
81
82
|
|
82
83
|
```ruby
|
83
84
|
require "google/cloud/storage"
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,111 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.39.0 (2022-08-24)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* add support for conditional idempotent operations ([#18834](https://github.com/googleapis/google-cloud-ruby/issues/18834))
|
8
|
+
|
9
|
+
### 1.38.0 (2022-07-31)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* Add support for dual region gcs buckets ([#18862](https://github.com/googleapis/google-cloud-ruby/issues/18862))
|
14
|
+
|
15
|
+
### 1.37.0 (2022-06-30)
|
16
|
+
|
17
|
+
#### Features
|
18
|
+
|
19
|
+
* support OLM Prefix/Suffix ([#18190](https://github.com/googleapis/google-cloud-ruby/issues/18190))
|
20
|
+
* allow retry options to be configurable on client initialization ([#18332](https://github.com/googleapis/google-cloud-ruby/issues/18332))
|
21
|
+
#### Bug Fixes
|
22
|
+
|
23
|
+
* update object path parsing to handle hashes in them
|
24
|
+
|
25
|
+
### 1.36.2 (2022-04-20)
|
26
|
+
|
27
|
+
#### Documentation
|
28
|
+
|
29
|
+
* Document support for dual region buckets
|
30
|
+
|
31
|
+
### 1.36.1 / 2022-02-08
|
32
|
+
|
33
|
+
#### Documentation
|
34
|
+
|
35
|
+
* Update the RPO sample output. ([#17277](https://www.github.com/googleapis/google-cloud-ruby/issues/17277))
|
36
|
+
|
37
|
+
### 1.36.0 / 2022-01-12
|
38
|
+
|
39
|
+
#### Features
|
40
|
+
|
41
|
+
* add support for RPO (turbo replication). ([#14407](https://www.github.com/googleapis/google-cloud-ruby/issues/14407))
|
42
|
+
|
43
|
+
### 1.35.0 / 2021-12-08
|
44
|
+
|
45
|
+
#### Features
|
46
|
+
|
47
|
+
* changed PAP unspecified to inherited
|
48
|
+
* support for more client timeout options
|
49
|
+
|
50
|
+
#### Bug Fixes
|
51
|
+
|
52
|
+
* Update dependency on the addressable gem to 2.8 to remediate a vulnerability
|
53
|
+
|
54
|
+
### 1.34.1 / 2021-07-08
|
55
|
+
|
56
|
+
#### Documentation
|
57
|
+
|
58
|
+
* Update AUTHENTICATION.md in handwritten packages
|
59
|
+
|
60
|
+
### 1.34.0 / 2021-06-30
|
61
|
+
|
62
|
+
#### Features
|
63
|
+
|
64
|
+
* Add support for automatic crc32c and md5 upload verification
|
65
|
+
* Add checksum to Bucket#create_file
|
66
|
+
|
67
|
+
### 1.33.0 / 2021-06-29
|
68
|
+
|
69
|
+
#### Features
|
70
|
+
|
71
|
+
* Add support for PublicAccessPrevention
|
72
|
+
* Add Bucket#public_access_prevention
|
73
|
+
* Add Bucket#public_access_prevention=
|
74
|
+
* Add Bucket#public_access_prevention_enforced?
|
75
|
+
* Add Bucket#public_access_prevention_unspecified?
|
76
|
+
* Add samples for PublicAccessPrevention
|
77
|
+
|
78
|
+
### 1.32.0 / 2021-06-22
|
79
|
+
|
80
|
+
#### Features
|
81
|
+
|
82
|
+
* Add sources_if_generation_match to Bucket#compose
|
83
|
+
* Add support for (meta)generation preconditions to File operations
|
84
|
+
* Add if_(meta)generation_match options to Bucket#compose
|
85
|
+
* Add if_(meta)generation_(not_)match options to Bucket#create_file
|
86
|
+
* Add if_(meta)generation_(not_)match options to Bucket#file
|
87
|
+
* Add if_(meta)generation_(not_)match options to File#delete.
|
88
|
+
* Add if_(meta)generation_(not_)match options to File#rewrite
|
89
|
+
* Add generation and if_(meta)generation_(not_)match options to File#update
|
90
|
+
* Add generation and if_(meta)generation_(not_)match options to File::Acl predefined_acl methods
|
91
|
+
|
92
|
+
#### Bug Fixes
|
93
|
+
|
94
|
+
* Expand googleauth dependency to support future 1.x versions
|
95
|
+
* Update File::Verifier to test for File#to_path
|
96
|
+
|
97
|
+
### 1.31.1 / 2021-05-19
|
98
|
+
|
99
|
+
#### Documentation
|
100
|
+
|
101
|
+
* Update IAMCredentialsService#sign_service_account_blob examples
|
102
|
+
|
103
|
+
### 1.31.0 / 2021-03-10
|
104
|
+
|
105
|
+
#### Features
|
106
|
+
|
107
|
+
* Drop support for Ruby 2.4 and add support for Ruby 3.0
|
108
|
+
|
3
109
|
### 1.30.0 / 2021-01-13
|
4
110
|
|
5
111
|
#### Features
|
data/CONTRIBUTING.md
CHANGED
@@ -24,7 +24,7 @@ be able to accept your pull requests.
|
|
24
24
|
In order to use the google-cloud-storage console and run the project's tests,
|
25
25
|
there is a small amount of setup:
|
26
26
|
|
27
|
-
1. Install Ruby. google-cloud-storage requires Ruby 2.
|
27
|
+
1. Install Ruby. google-cloud-storage requires Ruby 2.5+. You may choose to
|
28
28
|
manage your Ruby and gem installations with [RVM](https://rvm.io/),
|
29
29
|
[rbenv](https://github.com/rbenv/rbenv), or
|
30
30
|
[chruby](https://github.com/postmodern/chruby).
|
@@ -119,15 +119,14 @@ If you alter an example's title, you may encounter breaking tests.
|
|
119
119
|
### Storage Acceptance Tests
|
120
120
|
|
121
121
|
The Storage acceptance tests interact with the live service API. Follow the
|
122
|
-
instructions in the {file:AUTHENTICATION.md Authentication
|
122
|
+
instructions in the {file:AUTHENTICATION.md Authentication Guide} for enabling
|
123
123
|
the Storage API. Occasionally, some API features may not yet be generally
|
124
124
|
available, making it difficult for some contributors to successfully run the
|
125
125
|
entire acceptance test suite. However, please ensure that you do successfully
|
126
126
|
run acceptance tests for any code areas covered by your pull request.
|
127
127
|
|
128
128
|
To run the acceptance tests, first create and configure a project in the Google
|
129
|
-
Developers Console, as described in the {file:AUTHENTICATION.md Authentication
|
130
|
-
guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
|
129
|
+
Developers Console, as described in the {file:AUTHENTICATION.md Authentication Guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
|
131
130
|
the KEYFILE location on your system.
|
132
131
|
|
133
132
|
Before you can run the Storage acceptance tests, you must first create indexes
|
data/OVERVIEW.md
CHANGED
@@ -563,6 +563,36 @@ 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
|
+
|
566
596
|
See the [Storage status and error
|
567
597
|
codes](https://cloud.google.com/storage/docs/json_api/v1/status-codes)
|
568
598
|
for a list of error conditions.
|
@@ -198,7 +198,7 @@ module Google
|
|
198
198
|
gapi = @service.insert_bucket_acl @bucket, entity, "OWNER",
|
199
199
|
user_project: user_project
|
200
200
|
entity = gapi.entity
|
201
|
-
@owners
|
201
|
+
@owners&.push entity
|
202
202
|
entity
|
203
203
|
end
|
204
204
|
|
@@ -243,7 +243,7 @@ module Google
|
|
243
243
|
gapi = @service.insert_bucket_acl @bucket, entity, "WRITER",
|
244
244
|
user_project: user_project
|
245
245
|
entity = gapi.entity
|
246
|
-
@writers
|
246
|
+
@writers&.push entity
|
247
247
|
entity
|
248
248
|
end
|
249
249
|
|
@@ -288,7 +288,7 @@ module Google
|
|
288
288
|
gapi = @service.insert_bucket_acl @bucket, entity, "READER",
|
289
289
|
user_project: user_project
|
290
290
|
entity = gapi.entity
|
291
|
-
@readers
|
291
|
+
@readers&.push entity
|
292
292
|
entity
|
293
293
|
end
|
294
294
|
|
@@ -323,9 +323,9 @@ module Google
|
|
323
323
|
def delete entity
|
324
324
|
@service.delete_bucket_acl @bucket, entity,
|
325
325
|
user_project: user_project
|
326
|
-
@owners
|
327
|
-
@writers
|
328
|
-
@readers
|
326
|
+
@owners&.delete entity
|
327
|
+
@writers&.delete entity
|
328
|
+
@readers&.delete entity
|
329
329
|
true
|
330
330
|
end
|
331
331
|
|
@@ -445,8 +445,7 @@ module Google
|
|
445
445
|
|
446
446
|
def entities_from_acls acls, role
|
447
447
|
selected = acls.select { |acl| acl.role == role }
|
448
|
-
|
449
|
-
entities
|
448
|
+
selected.map(&:entity)
|
450
449
|
end
|
451
450
|
end
|
452
451
|
|
@@ -614,7 +613,7 @@ module Google
|
|
614
613
|
gapi = @service.insert_default_acl @bucket, entity, "OWNER",
|
615
614
|
user_project: user_project
|
616
615
|
entity = gapi.entity
|
617
|
-
@owners
|
616
|
+
@owners&.push entity
|
618
617
|
entity
|
619
618
|
end
|
620
619
|
|
@@ -657,7 +656,7 @@ module Google
|
|
657
656
|
gapi = @service.insert_default_acl @bucket, entity, "READER",
|
658
657
|
user_project: user_project
|
659
658
|
entity = gapi.entity
|
660
|
-
@readers
|
659
|
+
@readers&.push entity
|
661
660
|
entity
|
662
661
|
end
|
663
662
|
|
@@ -690,8 +689,8 @@ module Google
|
|
690
689
|
def delete entity
|
691
690
|
@service.delete_default_acl @bucket, entity,
|
692
691
|
user_project: user_project
|
693
|
-
@owners
|
694
|
-
@readers
|
692
|
+
@owners&.delete entity
|
693
|
+
@readers&.delete entity
|
695
694
|
true
|
696
695
|
end
|
697
696
|
|
@@ -829,8 +828,7 @@ module Google
|
|
829
828
|
|
830
829
|
def entities_from_acls acls, role
|
831
830
|
selected = acls.select { |acl| acl.role == role }
|
832
|
-
|
833
|
-
entities
|
831
|
+
selected.map(&:entity)
|
834
832
|
end
|
835
833
|
end
|
836
834
|
end
|
@@ -172,7 +172,10 @@ module Google
|
|
172
172
|
# rule.max_age #=> 3600
|
173
173
|
#
|
174
174
|
class Rule
|
175
|
-
attr_accessor :origin
|
175
|
+
attr_accessor :origin
|
176
|
+
attr_accessor :methods
|
177
|
+
attr_accessor :headers
|
178
|
+
attr_accessor :max_age
|
176
179
|
|
177
180
|
# @private
|
178
181
|
def initialize origin, methods, headers: nil, max_age: nil
|
@@ -53,6 +53,8 @@ module Google
|
|
53
53
|
# rule.storage_class #=> "COLDLINE"
|
54
54
|
# rule.age #=> 10
|
55
55
|
# rule.matches_storage_class #=> ["STANDARD", "NEARLINE"]
|
56
|
+
# rule.matches_prefix #=> ["myprefix/foo"]
|
57
|
+
# rule.matches_suffix #=> [".jpg", ".png"]
|
56
58
|
#
|
57
59
|
# @example Updating the bucket's lifecycle management rules in a block.
|
58
60
|
# require "google/cloud/storage"
|
@@ -138,6 +140,12 @@ module Google
|
|
138
140
|
# files. If the value is N, this condition is satisfied when there
|
139
141
|
# are at least N versions (including the live version) newer than
|
140
142
|
# this version of the file.
|
143
|
+
# @param [Array<String,Symbol>] matches_prefix
|
144
|
+
# Files having their name with the specified list of prefixs will be matched.
|
145
|
+
# Arguments will be converted from symbols to strings.
|
146
|
+
# @param [Array<String,Symbol>] matches_suffix
|
147
|
+
# Files having their name with the specified list of suffixes will be matched.
|
148
|
+
# Arguments will be converted from symbols to strings.
|
141
149
|
#
|
142
150
|
# @example
|
143
151
|
# require "google/cloud/storage"
|
@@ -157,7 +165,9 @@ module Google
|
|
157
165
|
is_live: nil,
|
158
166
|
matches_storage_class: nil,
|
159
167
|
noncurrent_time_before: nil,
|
160
|
-
num_newer_versions: nil
|
168
|
+
num_newer_versions: nil,
|
169
|
+
matches_prefix: nil,
|
170
|
+
matches_suffix: nil
|
161
171
|
push Rule.new(
|
162
172
|
"SetStorageClass",
|
163
173
|
storage_class: storage_class_for(storage_class),
|
@@ -169,12 +179,14 @@ module Google
|
|
169
179
|
is_live: is_live,
|
170
180
|
matches_storage_class: storage_class_for(matches_storage_class),
|
171
181
|
noncurrent_time_before: noncurrent_time_before,
|
172
|
-
num_newer_versions: num_newer_versions
|
182
|
+
num_newer_versions: num_newer_versions,
|
183
|
+
matches_prefix: Array(matches_prefix),
|
184
|
+
matches_suffix: Array(matches_suffix)
|
173
185
|
)
|
174
186
|
end
|
175
187
|
|
176
188
|
##
|
177
|
-
# Adds a
|
189
|
+
# Adds a Delete lifecycle rule to the Object Lifecycle
|
178
190
|
# Management rules for a bucket.
|
179
191
|
#
|
180
192
|
# @see https://cloud.google.com/storage/docs/lifecycle Object
|
@@ -221,6 +233,12 @@ module Google
|
|
221
233
|
# files. If the value is N, this condition is satisfied when there
|
222
234
|
# are at least N versions (including the live version) newer than
|
223
235
|
# this version of the file.
|
236
|
+
# @param [Array<String,Symbol>] matches_prefix
|
237
|
+
# Files having their name with the specified list of prefixs will be matched.
|
238
|
+
# Arguments will be converted from symbols to strings.
|
239
|
+
# @param [Array<String,Symbol>] matches_suffix
|
240
|
+
# Files having their name with the specified list of suffixes will be matched.
|
241
|
+
# Arguments will be converted from symbols to strings.
|
224
242
|
#
|
225
243
|
# @example
|
226
244
|
# require "google/cloud/storage"
|
@@ -239,7 +257,9 @@ module Google
|
|
239
257
|
is_live: nil,
|
240
258
|
matches_storage_class: nil,
|
241
259
|
noncurrent_time_before: nil,
|
242
|
-
num_newer_versions: nil
|
260
|
+
num_newer_versions: nil,
|
261
|
+
matches_prefix: nil,
|
262
|
+
matches_suffix: nil
|
243
263
|
push Rule.new(
|
244
264
|
"Delete",
|
245
265
|
age: age,
|
@@ -250,7 +270,49 @@ module Google
|
|
250
270
|
is_live: is_live,
|
251
271
|
matches_storage_class: storage_class_for(matches_storage_class),
|
252
272
|
noncurrent_time_before: noncurrent_time_before,
|
253
|
-
num_newer_versions: num_newer_versions
|
273
|
+
num_newer_versions: num_newer_versions,
|
274
|
+
matches_prefix: Array(matches_prefix),
|
275
|
+
matches_suffix: Array(matches_suffix)
|
276
|
+
)
|
277
|
+
end
|
278
|
+
|
279
|
+
##
|
280
|
+
# Adds a AbortIncompleteMultipartUpload lifecycle rule to the Object Lifecycle
|
281
|
+
# Management rules for a bucket.
|
282
|
+
#
|
283
|
+
# @see https://cloud.google.com/storage/docs/lifecycle Object
|
284
|
+
# Lifecycle Management
|
285
|
+
# @see https://cloud.google.com/storage/docs/managing-lifecycles
|
286
|
+
# Managing Object Lifecycles
|
287
|
+
#
|
288
|
+
# @param [Integer] age The age of a file (in days). This condition is
|
289
|
+
# satisfied when a file reaches the specified age.
|
290
|
+
# @param [Array<String,Symbol>] matches_prefix
|
291
|
+
# Files having their name with the specified list of prefixs will be matched.
|
292
|
+
# Arguments will be converted from symbols to strings.
|
293
|
+
# @param [Array<String,Symbol>] matches_suffix
|
294
|
+
# Files having their name with the specified list of suffixes will be matched.
|
295
|
+
# Arguments will be converted from symbols to strings.
|
296
|
+
#
|
297
|
+
# @example
|
298
|
+
# require "google/cloud/storage"
|
299
|
+
#
|
300
|
+
# storage = Google::Cloud::Storage.new
|
301
|
+
#
|
302
|
+
# bucket = storage.create_bucket "my-bucket" do |b|
|
303
|
+
# b.lifecycle.add_abort_incomplete_multipart_upload_rule age: 10,
|
304
|
+
# matches_prefix: ["images/"],
|
305
|
+
# matches_suffix: [".pdf"]
|
306
|
+
# end
|
307
|
+
#
|
308
|
+
def add_abort_incomplete_multipart_upload_rule age: nil,
|
309
|
+
matches_prefix: nil,
|
310
|
+
matches_suffix: nil
|
311
|
+
push Rule.new(
|
312
|
+
"AbortIncompleteMultipartUpload",
|
313
|
+
age: age,
|
314
|
+
matches_prefix: Array(matches_prefix),
|
315
|
+
matches_suffix: Array(matches_suffix)
|
254
316
|
)
|
255
317
|
end
|
256
318
|
|
@@ -346,6 +408,8 @@ module Google
|
|
346
408
|
# rule.storage_class #=> "COLDLINE"
|
347
409
|
# rule.age #=> 10
|
348
410
|
# rule.matches_storage_class #=> ["STANDARD", "NEARLINE"]
|
411
|
+
# rule.matches_prefix #=> ["myprefix/foo"]
|
412
|
+
# rule.matches_suffix #=> [".jpg", ".png"]
|
349
413
|
#
|
350
414
|
# @example Updating the bucket's lifecycle rules in a block.
|
351
415
|
# require "google/cloud/storage"
|
@@ -371,17 +435,19 @@ module Google
|
|
371
435
|
# end
|
372
436
|
#
|
373
437
|
class Rule
|
374
|
-
attr_accessor :action
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
438
|
+
attr_accessor :action
|
439
|
+
attr_accessor :storage_class
|
440
|
+
attr_accessor :age
|
441
|
+
attr_accessor :created_before
|
442
|
+
attr_accessor :custom_time_before
|
443
|
+
attr_accessor :days_since_custom_time
|
444
|
+
attr_accessor :days_since_noncurrent_time
|
445
|
+
attr_accessor :is_live
|
446
|
+
attr_accessor :matches_storage_class
|
447
|
+
attr_accessor :noncurrent_time_before
|
448
|
+
attr_accessor :num_newer_versions
|
449
|
+
attr_accessor :matches_prefix
|
450
|
+
attr_accessor :matches_suffix
|
385
451
|
|
386
452
|
# @private
|
387
453
|
def initialize action,
|
@@ -394,7 +460,9 @@ module Google
|
|
394
460
|
is_live: nil,
|
395
461
|
matches_storage_class: nil,
|
396
462
|
noncurrent_time_before: nil,
|
397
|
-
num_newer_versions: nil
|
463
|
+
num_newer_versions: nil,
|
464
|
+
matches_prefix: nil,
|
465
|
+
matches_suffix: nil
|
398
466
|
@action = action
|
399
467
|
@storage_class = storage_class
|
400
468
|
@age = age
|
@@ -406,6 +474,8 @@ module Google
|
|
406
474
|
@matches_storage_class = Array(matches_storage_class)
|
407
475
|
@noncurrent_time_before = noncurrent_time_before
|
408
476
|
@num_newer_versions = num_newer_versions
|
477
|
+
@matches_prefix = Array(matches_prefix)
|
478
|
+
@matches_suffix = Array(matches_suffix)
|
409
479
|
end
|
410
480
|
|
411
481
|
# @private
|
@@ -420,7 +490,9 @@ module Google
|
|
420
490
|
is_live,
|
421
491
|
matches_storage_class,
|
422
492
|
noncurrent_time_before,
|
423
|
-
num_newer_versions
|
493
|
+
num_newer_versions,
|
494
|
+
matches_prefix,
|
495
|
+
matches_suffix
|
424
496
|
)
|
425
497
|
Google::Apis::StorageV1::Bucket::Lifecycle::Rule.new(
|
426
498
|
action: action_gapi(action, storage_class),
|
@@ -445,7 +517,9 @@ module Google
|
|
445
517
|
is_live,
|
446
518
|
matches_storage_class,
|
447
519
|
noncurrent_time_before,
|
448
|
-
num_newer_versions
|
520
|
+
num_newer_versions,
|
521
|
+
matches_prefix,
|
522
|
+
matches_suffix
|
449
523
|
Google::Apis::StorageV1::Bucket::Lifecycle::Rule::Condition.new(
|
450
524
|
age: age,
|
451
525
|
created_before: created_before,
|
@@ -455,7 +529,9 @@ module Google
|
|
455
529
|
is_live: is_live,
|
456
530
|
matches_storage_class: Array(matches_storage_class),
|
457
531
|
noncurrent_time_before: noncurrent_time_before,
|
458
|
-
num_newer_versions: num_newer_versions
|
532
|
+
num_newer_versions: num_newer_versions,
|
533
|
+
matches_prefix: Array(matches_prefix),
|
534
|
+
matches_suffix: Array(matches_suffix)
|
459
535
|
)
|
460
536
|
end
|
461
537
|
|
@@ -475,7 +551,9 @@ module Google
|
|
475
551
|
is_live: c.is_live,
|
476
552
|
matches_storage_class: c.matches_storage_class,
|
477
553
|
noncurrent_time_before: c.noncurrent_time_before,
|
478
|
-
num_newer_versions: c.num_newer_versions
|
554
|
+
num_newer_versions: c.num_newer_versions,
|
555
|
+
matches_prefix: c.matches_prefix,
|
556
|
+
matches_suffix: c.matches_suffix
|
479
557
|
)
|
480
558
|
end
|
481
559
|
|
@@ -125,17 +125,17 @@ module Google
|
|
125
125
|
# puts bucket.name
|
126
126
|
# end
|
127
127
|
#
|
128
|
-
def all request_limit: nil
|
128
|
+
def all request_limit: nil, &block
|
129
129
|
request_limit = request_limit.to_i if request_limit
|
130
130
|
unless block_given?
|
131
131
|
return enum_for :all, request_limit: request_limit
|
132
132
|
end
|
133
133
|
results = self
|
134
134
|
loop do
|
135
|
-
results.each
|
135
|
+
results.each(&block)
|
136
136
|
if request_limit
|
137
137
|
request_limit -= 1
|
138
|
-
break if request_limit
|
138
|
+
break if request_limit.negative?
|
139
139
|
end
|
140
140
|
break unless results.next?
|
141
141
|
results = results.next
|