google-cloud-storage 1.0.1 → 1.1.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aedabfdd29823eedcac9c139bd352c3361ba5d0d
|
4
|
+
data.tar.gz: be5105b8c9183e3294a6bb7116f45007747c49a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b5160e32c88c4a8b4c20c04cd08ebd3081c94807f2489f1d45852519d12da64d596b38aa7d90a736f409a5f5193e8044b0941f0fa092733cb519cd65418f4d0
|
7
|
+
data.tar.gz: ad3994f964a5f67b324cd6c475b5d59eae0ccec407a6c37018be2f3198985b9031d3faf3746f67865c9c946bd055e5043a5420af8507fb4401b3801632f59b31
|
@@ -264,6 +264,22 @@ module Google
|
|
264
264
|
@gapi.website.not_found_page if @gapi.website
|
265
265
|
end
|
266
266
|
|
267
|
+
##
|
268
|
+
# A hash of user-provided labels. The hash is frozen and changes are not
|
269
|
+
# allowed.
|
270
|
+
def labels
|
271
|
+
m = @gapi.labels
|
272
|
+
m = m.to_h if m.respond_to? :to_h
|
273
|
+
m.dup.freeze
|
274
|
+
end
|
275
|
+
|
276
|
+
##
|
277
|
+
# Updates the hash of user-provided labels.
|
278
|
+
def labels= labels
|
279
|
+
@gapi.labels = labels
|
280
|
+
patch_gapi! :labels
|
281
|
+
end
|
282
|
+
|
267
283
|
##
|
268
284
|
# Updates the page returned from a static website served from the bucket
|
269
285
|
# when a site visitor requests a resource that does not exist.
|
@@ -320,6 +336,7 @@ module Google
|
|
320
336
|
updater = Updater.new @gapi
|
321
337
|
yield updater
|
322
338
|
# Add check for mutable cors
|
339
|
+
updater.check_for_changed_labels!
|
323
340
|
updater.check_for_mutable_cors!
|
324
341
|
patch_gapi! updater.updates unless updater.updates.empty?
|
325
342
|
end
|
@@ -898,9 +915,9 @@ module Google
|
|
898
915
|
# @see https://cloud.google.com/storage/docs/json_api/v1/buckets/setIamPolicy
|
899
916
|
# Buckets: setIamPolicy
|
900
917
|
#
|
901
|
-
# @param [Boolean] force Force
|
902
|
-
#
|
903
|
-
#
|
918
|
+
# @param [Boolean] force [Deprecated] Force the latest policy to be
|
919
|
+
# retrieved from the Storage service when `true`. Deprecated because
|
920
|
+
# the latest policy is now always retrieved. The default is `nil`.
|
904
921
|
#
|
905
922
|
# @yield [policy] A block for updating the policy. The latest policy
|
906
923
|
# will be read from the service and passed to the block. After the
|
@@ -910,27 +927,16 @@ module Google
|
|
910
927
|
#
|
911
928
|
# @return [Policy] the current Cloud IAM Policy for this bucket
|
912
929
|
#
|
913
|
-
# @example
|
914
|
-
# require "google/cloud/storage"
|
915
|
-
#
|
916
|
-
# storage = Google::Cloud::Storage.new
|
917
|
-
#
|
918
|
-
# bucket = storage.bucket "my-todo-app"
|
919
|
-
#
|
920
|
-
# policy = bucket.policy # API call
|
921
|
-
# policy_2 = bucket.policy # No API call
|
922
|
-
#
|
923
|
-
# @example Use `force` to retrieve the latest policy from the service:
|
930
|
+
# @example
|
924
931
|
# require "google/cloud/storage"
|
925
932
|
#
|
926
933
|
# storage = Google::Cloud::Storage.new
|
927
934
|
#
|
928
935
|
# bucket = storage.bucket "my-todo-app"
|
929
936
|
#
|
930
|
-
# policy = bucket.policy
|
931
|
-
# policy_2 = bucket.policy force: true # API call
|
937
|
+
# policy = bucket.policy
|
932
938
|
#
|
933
|
-
# @example
|
939
|
+
# @example Retrieve the latest policy and update it in a block:
|
934
940
|
# require "google/cloud/storage"
|
935
941
|
#
|
936
942
|
# storage = Google::Cloud::Storage.new
|
@@ -939,19 +945,16 @@ module Google
|
|
939
945
|
#
|
940
946
|
# bucket.policy do |p|
|
941
947
|
# p.add "roles/owner", "user:owner@example.com"
|
942
|
-
# end
|
943
|
-
#
|
944
|
-
def policy force:
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
p = @policy.deep_dup
|
953
|
-
yield p
|
954
|
-
self.policy = p
|
948
|
+
# end
|
949
|
+
#
|
950
|
+
def policy force: nil
|
951
|
+
warn "DEPRECATED: 'force' in Bucket#policy" unless force.nil?
|
952
|
+
ensure_service!
|
953
|
+
gapi = service.get_bucket_policy name
|
954
|
+
policy = Policy.from_gapi gapi
|
955
|
+
return policy unless block_given?
|
956
|
+
yield policy
|
957
|
+
self.policy = policy
|
955
958
|
end
|
956
959
|
|
957
960
|
##
|
@@ -971,6 +974,8 @@ module Google
|
|
971
974
|
# @param [Policy] new_policy a new or modified Cloud IAM Policy for this
|
972
975
|
# bucket
|
973
976
|
#
|
977
|
+
# @return [Policy] The policy returned by the API update operation.
|
978
|
+
#
|
974
979
|
# @example
|
975
980
|
# require "google/cloud/storage"
|
976
981
|
#
|
@@ -987,7 +992,7 @@ module Google
|
|
987
992
|
def policy= new_policy
|
988
993
|
ensure_service!
|
989
994
|
gapi = service.set_bucket_policy name, new_policy.to_gapi
|
990
|
-
|
995
|
+
Policy.from_gapi gapi
|
991
996
|
end
|
992
997
|
|
993
998
|
##
|
@@ -1088,9 +1093,32 @@ module Google
|
|
1088
1093
|
def initialize gapi
|
1089
1094
|
@updates = []
|
1090
1095
|
@gapi = gapi
|
1096
|
+
@labels = @gapi.labels.to_h.dup
|
1091
1097
|
@cors_builder = nil
|
1092
1098
|
end
|
1093
1099
|
|
1100
|
+
##
|
1101
|
+
# A hash of user-provided labels. Changes are allowed.
|
1102
|
+
def labels
|
1103
|
+
@labels
|
1104
|
+
end
|
1105
|
+
|
1106
|
+
##
|
1107
|
+
# Updates the hash of user-provided labels.
|
1108
|
+
def labels= labels
|
1109
|
+
@labels = labels
|
1110
|
+
@gapi.labels = @labels
|
1111
|
+
patch_gapi! :labels
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
##
|
1115
|
+
# @private Make sure any labels changes are saved
|
1116
|
+
def check_for_changed_labels!
|
1117
|
+
return if @labels == @gapi.labels.to_h
|
1118
|
+
@gapi.labels = @labels
|
1119
|
+
patch_gapi! :labels
|
1120
|
+
end
|
1121
|
+
|
1094
1122
|
def cors
|
1095
1123
|
# Same as Bucket#cors, but not frozen
|
1096
1124
|
@cors_builder ||= Bucket::Cors.from_gapi @gapi.cors_configurations
|
@@ -164,9 +164,13 @@ module Google
|
|
164
164
|
##
|
165
165
|
# Returns a deep copy of the policy.
|
166
166
|
#
|
167
|
+
# @deprecated Because the latest policy is now always retrieved by
|
168
|
+
# {Bucket#policy}.
|
169
|
+
#
|
167
170
|
# @return [Policy]
|
168
171
|
#
|
169
172
|
def deep_dup
|
173
|
+
warn "DEPRECATED: Storage::Policy#deep_dup"
|
170
174
|
dup.tap do |p|
|
171
175
|
roles_dup = p.roles.each_with_object({}) do |(k, v), memo|
|
172
176
|
memo[k] = v.dup rescue value
|
@@ -293,6 +293,7 @@ module Google
|
|
293
293
|
b.versioning = versioning unless versioning.nil?
|
294
294
|
end
|
295
295
|
yield updater if block_given?
|
296
|
+
updater.check_for_changed_labels!
|
296
297
|
updater.check_for_mutable_cors!
|
297
298
|
gapi = service.insert_bucket \
|
298
299
|
new_bucket, acl: acl_rule(acl), default_acl: acl_rule(default_acl)
|
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.0
|
4
|
+
version: 1.1.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: 2017-
|
12
|
+
date: 2017-06-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -208,7 +208,7 @@ files:
|
|
208
208
|
- lib/google/cloud/storage/project.rb
|
209
209
|
- lib/google/cloud/storage/service.rb
|
210
210
|
- lib/google/cloud/storage/version.rb
|
211
|
-
homepage:
|
211
|
+
homepage: https://github.com/GoogleCloudPlatform/google-cloud-ruby/tree/master/google-cloud-storage
|
212
212
|
licenses:
|
213
213
|
- Apache-2.0
|
214
214
|
metadata: {}
|
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
228
|
version: '0'
|
229
229
|
requirements: []
|
230
230
|
rubyforge_project:
|
231
|
-
rubygems_version: 2.6.
|
231
|
+
rubygems_version: 2.6.12
|
232
232
|
signing_key:
|
233
233
|
specification_version: 4
|
234
234
|
summary: API Client library for Google Cloud Storage
|