google-cloud-storage 1.30.0 → 1.31.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 +6 -0
- data/CONTRIBUTING.md +1 -1
- data/lib/google/cloud/storage/bucket.rb +13 -11
- 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 +11 -11
- data/lib/google/cloud/storage/bucket/list.rb +3 -3
- data/lib/google/cloud/storage/credentials.rb +16 -14
- data/lib/google/cloud/storage/file.rb +3 -2
- data/lib/google/cloud/storage/file/acl.rb +5 -6
- data/lib/google/cloud/storage/file/list.rb +3 -3
- data/lib/google/cloud/storage/file/signer_v2.rb +2 -4
- data/lib/google/cloud/storage/file/signer_v4.rb +9 -9
- data/lib/google/cloud/storage/hmac_key/list.rb +3 -3
- data/lib/google/cloud/storage/policy.rb +2 -2
- 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/post_object.rb +2 -1
- data/lib/google/cloud/storage/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c1b17e5256dade278dacc588b1dd5483769f352fa6a44075f8984c9b98e6951b
|
|
4
|
+
data.tar.gz: 9a17da5e7e0f0da605e290e4a17ad75d6d89c2d2c83549d6a70378f77b86c8c8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33b1ad115cb14c993607c4c173a8d117b19ebbe1515c7fbbaf6f7f38650dfcef0219b68e404a02a785f1092d6c1b04ffdab273c5546370569134b5fdbf596cc4
|
|
7
|
+
data.tar.gz: 8f4595aa9df9901462e1a2d522f35fd9b84ab2d96bbaf765e78582b4378c6270324efb3b43b037aa99e38377a5ed410c2dbe63c8ab34daf4b81004c0318a1edf
|
data/CHANGELOG.md
CHANGED
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).
|
|
@@ -309,7 +309,7 @@ module Google
|
|
|
309
309
|
# @see https://cloud.google.com/storage/docs/access-logs Access Logs
|
|
310
310
|
#
|
|
311
311
|
def logging_bucket
|
|
312
|
-
@gapi.logging
|
|
312
|
+
@gapi.logging&.log_bucket
|
|
313
313
|
end
|
|
314
314
|
|
|
315
315
|
##
|
|
@@ -333,7 +333,7 @@ module Google
|
|
|
333
333
|
# @return [String]
|
|
334
334
|
#
|
|
335
335
|
def logging_prefix
|
|
336
|
-
@gapi.logging
|
|
336
|
+
@gapi.logging&.log_object_prefix
|
|
337
337
|
end
|
|
338
338
|
|
|
339
339
|
##
|
|
@@ -392,7 +392,7 @@ module Google
|
|
|
392
392
|
# @return [Boolean]
|
|
393
393
|
#
|
|
394
394
|
def versioning?
|
|
395
|
-
@gapi.versioning
|
|
395
|
+
@gapi.versioning&.enabled?
|
|
396
396
|
end
|
|
397
397
|
|
|
398
398
|
##
|
|
@@ -422,7 +422,7 @@ module Google
|
|
|
422
422
|
# @return [String] The main page suffix.
|
|
423
423
|
#
|
|
424
424
|
def website_main
|
|
425
|
-
@gapi.website
|
|
425
|
+
@gapi.website&.main_page_suffix
|
|
426
426
|
end
|
|
427
427
|
|
|
428
428
|
##
|
|
@@ -449,7 +449,7 @@ module Google
|
|
|
449
449
|
# @return [String]
|
|
450
450
|
#
|
|
451
451
|
def website_404
|
|
452
|
-
@gapi.website
|
|
452
|
+
@gapi.website&.not_found_page
|
|
453
453
|
end
|
|
454
454
|
|
|
455
455
|
##
|
|
@@ -498,7 +498,7 @@ module Google
|
|
|
498
498
|
# the bucket.
|
|
499
499
|
#
|
|
500
500
|
def requester_pays
|
|
501
|
-
@gapi.billing
|
|
501
|
+
@gapi.billing&.requester_pays
|
|
502
502
|
end
|
|
503
503
|
alias requester_pays? requester_pays
|
|
504
504
|
|
|
@@ -550,7 +550,7 @@ module Google
|
|
|
550
550
|
# bucket.default_kms_key #=> kms_key_name
|
|
551
551
|
#
|
|
552
552
|
def default_kms_key
|
|
553
|
-
@gapi.encryption
|
|
553
|
+
@gapi.encryption&.default_kms_key_name
|
|
554
554
|
end
|
|
555
555
|
|
|
556
556
|
##
|
|
@@ -599,7 +599,7 @@ module Google
|
|
|
599
599
|
# retention policy exists for the bucket.
|
|
600
600
|
#
|
|
601
601
|
def retention_period
|
|
602
|
-
@gapi.retention_policy
|
|
602
|
+
@gapi.retention_policy&.retention_period
|
|
603
603
|
end
|
|
604
604
|
|
|
605
605
|
##
|
|
@@ -658,7 +658,7 @@ module Google
|
|
|
658
658
|
# policy, if a policy exists.
|
|
659
659
|
#
|
|
660
660
|
def retention_effective_at
|
|
661
|
-
@gapi.retention_policy
|
|
661
|
+
@gapi.retention_policy&.effective_time
|
|
662
662
|
end
|
|
663
663
|
|
|
664
664
|
##
|
|
@@ -808,7 +808,7 @@ module Google
|
|
|
808
808
|
# bucket.uniform_bucket_level_access? # true
|
|
809
809
|
#
|
|
810
810
|
def uniform_bucket_level_access?
|
|
811
|
-
return false unless @gapi.iam_configuration
|
|
811
|
+
return false unless @gapi.iam_configuration&.uniform_bucket_level_access
|
|
812
812
|
!@gapi.iam_configuration.uniform_bucket_level_access.enabled.nil? &&
|
|
813
813
|
@gapi.iam_configuration.uniform_bucket_level_access.enabled
|
|
814
814
|
end
|
|
@@ -870,7 +870,7 @@ module Google
|
|
|
870
870
|
# puts bucket.uniform_bucket_level_access_locked_at
|
|
871
871
|
#
|
|
872
872
|
def uniform_bucket_level_access_locked_at
|
|
873
|
-
return nil unless @gapi.iam_configuration
|
|
873
|
+
return nil unless @gapi.iam_configuration&.uniform_bucket_level_access
|
|
874
874
|
@gapi.iam_configuration.uniform_bucket_level_access.locked_time
|
|
875
875
|
end
|
|
876
876
|
|
|
@@ -2572,9 +2572,11 @@ module Google
|
|
|
2572
2572
|
# Yielded to a block to accumulate changes for a patch request.
|
|
2573
2573
|
class Updater < Bucket
|
|
2574
2574
|
attr_reader :updates
|
|
2575
|
+
|
|
2575
2576
|
##
|
|
2576
2577
|
# Create an Updater object.
|
|
2577
2578
|
def initialize gapi
|
|
2579
|
+
super()
|
|
2578
2580
|
@updates = []
|
|
2579
2581
|
@gapi = gapi
|
|
2580
2582
|
@labels = @gapi.labels.to_h.dup
|
|
@@ -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
|
|
@@ -371,17 +371,17 @@ module Google
|
|
|
371
371
|
# end
|
|
372
372
|
#
|
|
373
373
|
class Rule
|
|
374
|
-
attr_accessor :action
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
374
|
+
attr_accessor :action
|
|
375
|
+
attr_accessor :storage_class
|
|
376
|
+
attr_accessor :age
|
|
377
|
+
attr_accessor :created_before
|
|
378
|
+
attr_accessor :custom_time_before
|
|
379
|
+
attr_accessor :days_since_custom_time
|
|
380
|
+
attr_accessor :days_since_noncurrent_time
|
|
381
|
+
attr_accessor :is_live
|
|
382
|
+
attr_accessor :matches_storage_class
|
|
383
|
+
attr_accessor :noncurrent_time_before
|
|
384
|
+
attr_accessor :num_newer_versions
|
|
385
385
|
|
|
386
386
|
# @private
|
|
387
387
|
def initialize action,
|
|
@@ -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
|
|
@@ -38,20 +38,22 @@ module Google
|
|
|
38
38
|
# storage.project_id #=> "my-project"
|
|
39
39
|
#
|
|
40
40
|
class Credentials < Google::Auth::Credentials
|
|
41
|
-
SCOPE =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
41
|
+
SCOPE = ["https://www.googleapis.com/auth/devstorage.full_control"].freeze
|
|
42
|
+
PATH_ENV_VARS = [
|
|
43
|
+
"STORAGE_CREDENTIALS",
|
|
44
|
+
"STORAGE_KEYFILE",
|
|
45
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
|
46
|
+
"GOOGLE_CLOUD_KEYFILE",
|
|
47
|
+
"GCLOUD_KEYFILE"
|
|
48
|
+
].freeze
|
|
49
|
+
JSON_ENV_VARS = [
|
|
50
|
+
"STORAGE_CREDENTIALS_JSON",
|
|
51
|
+
"STORAGE_KEYFILE_JSON",
|
|
52
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
|
53
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
|
54
|
+
"GCLOUD_KEYFILE_JSON"
|
|
55
|
+
].freeze
|
|
56
|
+
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"].freeze
|
|
55
57
|
end
|
|
56
58
|
end
|
|
57
59
|
end
|
|
@@ -191,7 +191,7 @@ module Google
|
|
|
191
191
|
# @return [Integer]
|
|
192
192
|
#
|
|
193
193
|
def size
|
|
194
|
-
@gapi.size
|
|
194
|
+
@gapi.size&.to_i
|
|
195
195
|
end
|
|
196
196
|
|
|
197
197
|
##
|
|
@@ -1873,7 +1873,7 @@ module Google
|
|
|
1873
1873
|
|
|
1874
1874
|
ensure_service!
|
|
1875
1875
|
|
|
1876
|
-
rewrite_attrs =
|
|
1876
|
+
rewrite_attrs = [:storage_class, :kms_key_name]
|
|
1877
1877
|
@gapi = if attributes.any? { |a| rewrite_attrs.include? a }
|
|
1878
1878
|
rewrite_gapi \
|
|
1879
1879
|
bucket, name, update_gapi, user_project: user_project
|
|
@@ -1972,6 +1972,7 @@ module Google
|
|
|
1972
1972
|
##
|
|
1973
1973
|
# @private Create an Updater object.
|
|
1974
1974
|
def initialize gapi
|
|
1975
|
+
super()
|
|
1975
1976
|
@updates = []
|
|
1976
1977
|
@gapi = gapi
|
|
1977
1978
|
@metadata ||= @gapi.metadata.to_h.dup
|
|
@@ -190,7 +190,7 @@ module Google
|
|
|
190
190
|
generation: generation,
|
|
191
191
|
user_project: user_project
|
|
192
192
|
entity = gapi.entity
|
|
193
|
-
@owners
|
|
193
|
+
@owners&.push entity
|
|
194
194
|
entity
|
|
195
195
|
end
|
|
196
196
|
|
|
@@ -241,7 +241,7 @@ module Google
|
|
|
241
241
|
generation: generation,
|
|
242
242
|
user_project: user_project
|
|
243
243
|
entity = gapi.entity
|
|
244
|
-
@readers
|
|
244
|
+
@readers&.push entity
|
|
245
245
|
entity
|
|
246
246
|
end
|
|
247
247
|
|
|
@@ -281,8 +281,8 @@ module Google
|
|
|
281
281
|
@service.delete_file_acl \
|
|
282
282
|
@bucket, @file, entity,
|
|
283
283
|
generation: generation, user_project: user_project
|
|
284
|
-
@owners
|
|
285
|
-
@readers
|
|
284
|
+
@owners&.delete entity
|
|
285
|
+
@readers&.delete entity
|
|
286
286
|
true
|
|
287
287
|
end
|
|
288
288
|
|
|
@@ -428,8 +428,7 @@ module Google
|
|
|
428
428
|
|
|
429
429
|
def entities_from_acls acls, role
|
|
430
430
|
selected = acls.select { |acl| acl.role == role }
|
|
431
|
-
|
|
432
|
-
entities
|
|
431
|
+
selected.map(&:entity)
|
|
433
432
|
end
|
|
434
433
|
end
|
|
435
434
|
end
|
|
@@ -141,17 +141,17 @@ module Google
|
|
|
141
141
|
# puts file.name
|
|
142
142
|
# end
|
|
143
143
|
#
|
|
144
|
-
def all request_limit: nil
|
|
144
|
+
def all request_limit: nil, &block
|
|
145
145
|
request_limit = request_limit.to_i if request_limit
|
|
146
146
|
unless block_given?
|
|
147
147
|
return enum_for :all, request_limit: request_limit
|
|
148
148
|
end
|
|
149
149
|
results = self
|
|
150
150
|
loop do
|
|
151
|
-
results.each
|
|
151
|
+
results.each(&block)
|
|
152
152
|
if request_limit
|
|
153
153
|
request_limit -= 1
|
|
154
|
-
break if request_limit
|
|
154
|
+
break if request_limit.negative?
|
|
155
155
|
end
|
|
156
156
|
break unless results.next?
|
|
157
157
|
results = results.next
|
|
@@ -147,10 +147,8 @@ module Google
|
|
|
147
147
|
"&Expires=#{expires}" \
|
|
148
148
|
"&Signature=#{url_escape signed_string}"
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
url << "&#{url_escape name}=#{url_escape value}"
|
|
153
|
-
end
|
|
150
|
+
query&.each do |name, value|
|
|
151
|
+
url << "&#{url_escape name}=#{url_escape value}"
|
|
154
152
|
end
|
|
155
153
|
|
|
156
154
|
url
|
|
@@ -60,7 +60,7 @@ module Google
|
|
|
60
60
|
|
|
61
61
|
p = {}
|
|
62
62
|
p["conditions"] = policy_conditions base_fields, conditions, fields
|
|
63
|
-
expires ||= 60*60*24
|
|
63
|
+
expires ||= 60 * 60 * 24
|
|
64
64
|
p["expiration"] = (now + expires).strftime "%Y-%m-%dT%H:%M:%SZ"
|
|
65
65
|
|
|
66
66
|
policy_str = escape_characters p.to_json
|
|
@@ -100,7 +100,7 @@ module Google
|
|
|
100
100
|
|
|
101
101
|
algorithm = "GOOG4-RSA-SHA256"
|
|
102
102
|
expires = determine_expires expires
|
|
103
|
-
credential = issuer
|
|
103
|
+
credential = "#{issuer}/#{scope}"
|
|
104
104
|
canonical_query_str = canonical_query query, algorithm, credential, goog_date, expires, signed_headers_str
|
|
105
105
|
|
|
106
106
|
# From AWS: You don't include a payload hash in the Canonical
|
|
@@ -131,9 +131,7 @@ module Google
|
|
|
131
131
|
# methods below are public visibility only for unit testing
|
|
132
132
|
def escape_characters str
|
|
133
133
|
str.split("").map do |s|
|
|
134
|
-
if
|
|
135
|
-
escape_special_unicode s
|
|
136
|
-
else
|
|
134
|
+
if s.ascii_only?
|
|
137
135
|
case s
|
|
138
136
|
when "\\"
|
|
139
137
|
'\\'
|
|
@@ -152,12 +150,14 @@ module Google
|
|
|
152
150
|
else
|
|
153
151
|
s
|
|
154
152
|
end
|
|
153
|
+
else
|
|
154
|
+
escape_special_unicode s
|
|
155
155
|
end
|
|
156
156
|
end.join
|
|
157
157
|
end
|
|
158
158
|
|
|
159
159
|
def escape_special_unicode str
|
|
160
|
-
str.unpack("U*").map { |i|
|
|
160
|
+
str.unpack("U*").map { |i| "\\u#{i.to_s(16).rjust(4, '0')}" }.join
|
|
161
161
|
end
|
|
162
162
|
|
|
163
163
|
protected
|
|
@@ -212,14 +212,14 @@ module Google
|
|
|
212
212
|
if signer.is_a? Proc
|
|
213
213
|
lambda do |string_to_sign|
|
|
214
214
|
sig = signer.call string_to_sign
|
|
215
|
-
sig.
|
|
215
|
+
sig.unpack1 "H*"
|
|
216
216
|
end
|
|
217
217
|
else
|
|
218
218
|
signer = OpenSSL::PKey::RSA.new signer unless signer.respond_to? :sign
|
|
219
219
|
# Sign string to sign
|
|
220
220
|
lambda do |string_to_sign|
|
|
221
221
|
sig = signer.sign OpenSSL::Digest::SHA256.new, string_to_sign
|
|
222
|
-
sig.
|
|
222
|
+
sig.unpack1 "H*"
|
|
223
223
|
end
|
|
224
224
|
end
|
|
225
225
|
end
|
|
@@ -359,7 +359,7 @@ module Google
|
|
|
359
359
|
end
|
|
360
360
|
packed_signature = signing_key.sign OpenSSL::Digest::SHA256.new, data
|
|
361
361
|
end
|
|
362
|
-
packed_signature.
|
|
362
|
+
packed_signature.unpack1("H*").force_encoding "utf-8"
|
|
363
363
|
end
|
|
364
364
|
end
|
|
365
365
|
end
|
|
@@ -131,17 +131,17 @@ module Google
|
|
|
131
131
|
# puts key.access_id
|
|
132
132
|
# end
|
|
133
133
|
#
|
|
134
|
-
def all request_limit: nil
|
|
134
|
+
def all request_limit: nil, &block
|
|
135
135
|
request_limit = request_limit.to_i if request_limit
|
|
136
136
|
unless block_given?
|
|
137
137
|
return enum_for :all, request_limit: request_limit
|
|
138
138
|
end
|
|
139
139
|
results = self
|
|
140
140
|
loop do
|
|
141
|
-
results.each
|
|
141
|
+
results.each(&block)
|
|
142
142
|
if request_limit
|
|
143
143
|
request_limit -= 1
|
|
144
|
-
break if request_limit
|
|
144
|
+
break if request_limit.negative?
|
|
145
145
|
end
|
|
146
146
|
break unless results.next?
|
|
147
147
|
results = results.next
|
|
@@ -212,8 +212,8 @@ module Google
|
|
|
212
212
|
def deep_dup
|
|
213
213
|
warn "DEPRECATED: Storage::PolicyV1#deep_dup"
|
|
214
214
|
dup.tap do |p|
|
|
215
|
-
roles_dup = p.roles.
|
|
216
|
-
|
|
215
|
+
roles_dup = p.roles.transform_values do |v|
|
|
216
|
+
v.dup rescue value
|
|
217
217
|
end
|
|
218
218
|
p.instance_variable_set :@roles, roles_dup
|
|
219
219
|
end
|
|
@@ -89,7 +89,9 @@ module Google
|
|
|
89
89
|
# end
|
|
90
90
|
#
|
|
91
91
|
class Binding
|
|
92
|
-
attr_reader :role
|
|
92
|
+
attr_reader :role
|
|
93
|
+
attr_reader :members
|
|
94
|
+
attr_reader :condition
|
|
93
95
|
|
|
94
96
|
##
|
|
95
97
|
# Creates a Binding object.
|
|
@@ -128,8 +130,8 @@ module Google
|
|
|
128
130
|
raise ArgumentError, "members is empty, must be provided" if @members.empty?
|
|
129
131
|
|
|
130
132
|
condition = Condition.new(**condition) if condition.is_a? Hash
|
|
131
|
-
if condition
|
|
132
|
-
raise ArgumentError, "expected Condition, not #{condition.inspect}"
|
|
133
|
+
if condition && !(condition.is_a? Condition)
|
|
134
|
+
raise ArgumentError, "expected Condition, not #{condition.inspect}"
|
|
133
135
|
end
|
|
134
136
|
@condition = condition
|
|
135
137
|
end
|
|
@@ -70,7 +70,9 @@ module Google
|
|
|
70
70
|
# end
|
|
71
71
|
#
|
|
72
72
|
class Condition
|
|
73
|
-
attr_reader :title
|
|
73
|
+
attr_reader :title
|
|
74
|
+
attr_reader :description
|
|
75
|
+
attr_reader :expression
|
|
74
76
|
|
|
75
77
|
##
|
|
76
78
|
# Creates a Condition object.
|
|
@@ -83,7 +85,7 @@ module Google
|
|
|
83
85
|
# one attributes, and statements are combined using logic operators,
|
|
84
86
|
# following CEL language specification. Required.
|
|
85
87
|
#
|
|
86
|
-
def initialize title:, description: nil
|
|
88
|
+
def initialize title:, expression:, description: nil
|
|
87
89
|
@title = String title
|
|
88
90
|
@description = String description
|
|
89
91
|
@expression = String expression
|
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.31.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: 2021-
|
|
12
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: google-cloud-core
|
|
@@ -115,14 +115,14 @@ dependencies:
|
|
|
115
115
|
requirements:
|
|
116
116
|
- - "~>"
|
|
117
117
|
- !ruby/object:Gem::Version
|
|
118
|
-
version: 1.
|
|
118
|
+
version: 1.25.1
|
|
119
119
|
type: :development
|
|
120
120
|
prerelease: false
|
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
|
122
122
|
requirements:
|
|
123
123
|
- - "~>"
|
|
124
124
|
- !ruby/object:Gem::Version
|
|
125
|
-
version: 1.
|
|
125
|
+
version: 1.25.1
|
|
126
126
|
- !ruby/object:Gem::Dependency
|
|
127
127
|
name: minitest
|
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -305,14 +305,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
305
305
|
requirements:
|
|
306
306
|
- - ">="
|
|
307
307
|
- !ruby/object:Gem::Version
|
|
308
|
-
version: '2.
|
|
308
|
+
version: '2.5'
|
|
309
309
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
310
|
requirements:
|
|
311
311
|
- - ">="
|
|
312
312
|
- !ruby/object:Gem::Version
|
|
313
313
|
version: '0'
|
|
314
314
|
requirements: []
|
|
315
|
-
rubygems_version: 3.
|
|
315
|
+
rubygems_version: 3.2.13
|
|
316
316
|
signing_key:
|
|
317
317
|
specification_version: 4
|
|
318
318
|
summary: API Client library for Google Cloud Storage
|