gcloud 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/AUTHENTICATION.md +71 -0
- data/CHANGELOG.md +5 -0
- data/README.md +10 -15
- data/lib/gcloud.rb +30 -0
- data/lib/gcloud/backoff.rb +3 -0
- data/lib/gcloud/credentials.rb +47 -30
- data/lib/gcloud/datastore.rb +246 -15
- data/lib/gcloud/datastore/connection.rb +4 -2
- data/lib/gcloud/datastore/credentials.rb +3 -1
- data/lib/gcloud/datastore/dataset.rb +130 -25
- data/lib/gcloud/datastore/dataset/lookup_results.rb +1 -0
- data/lib/gcloud/datastore/dataset/query_results.rb +7 -5
- data/lib/gcloud/datastore/entity.rb +99 -17
- data/lib/gcloud/datastore/errors.rb +13 -2
- data/lib/gcloud/datastore/key.rb +133 -2
- data/lib/gcloud/datastore/properties.rb +6 -1
- data/lib/gcloud/datastore/proto.rb +2 -1
- data/lib/gcloud/datastore/query.rb +4 -4
- data/lib/gcloud/datastore/transaction.rb +3 -0
- data/lib/gcloud/storage.rb +280 -13
- data/lib/gcloud/storage/bucket.rb +248 -11
- data/lib/gcloud/storage/bucket/acl.rb +631 -4
- data/lib/gcloud/storage/bucket/list.rb +1 -0
- data/lib/gcloud/storage/connection.rb +1 -0
- data/lib/gcloud/storage/credentials.rb +3 -1
- data/lib/gcloud/storage/errors.rb +9 -1
- data/lib/gcloud/storage/file.rb +231 -6
- data/lib/gcloud/storage/file/acl.rb +365 -2
- data/lib/gcloud/storage/file/list.rb +1 -0
- data/lib/gcloud/storage/file/verifier.rb +1 -0
- data/lib/gcloud/storage/project.rb +119 -10
- data/lib/gcloud/version.rb +18 -3
- metadata +33 -80
- data/.gemtest +0 -0
- data/.rubocop.yml +0 -17
- data/Manifest.txt +0 -66
- data/Rakefile +0 -35
- data/gcloud.gemspec +0 -63
- data/rakelib/console.rake +0 -28
- data/rakelib/manifest.rake +0 -24
- data/rakelib/proto.rake +0 -17
- data/rakelib/rubocop.rake +0 -17
- data/rakelib/test.rake +0 -144
- data/test/gcloud/datastore/proto/test_cursor.rb +0 -36
- data/test/gcloud/datastore/proto/test_direction.rb +0 -60
- data/test/gcloud/datastore/proto/test_operator.rb +0 -76
- data/test/gcloud/datastore/proto/test_value.rb +0 -231
- data/test/gcloud/datastore/test_connection.rb +0 -93
- data/test/gcloud/datastore/test_credentials.rb +0 -38
- data/test/gcloud/datastore/test_dataset.rb +0 -413
- data/test/gcloud/datastore/test_entity.rb +0 -161
- data/test/gcloud/datastore/test_entity_exclude.rb +0 -225
- data/test/gcloud/datastore/test_key.rb +0 -189
- data/test/gcloud/datastore/test_query.rb +0 -271
- data/test/gcloud/datastore/test_transaction.rb +0 -121
- data/test/gcloud/storage/test_backoff.rb +0 -127
- data/test/gcloud/storage/test_bucket.rb +0 -270
- data/test/gcloud/storage/test_bucket_acl.rb +0 -253
- data/test/gcloud/storage/test_default_acl.rb +0 -256
- data/test/gcloud/storage/test_file.rb +0 -221
- data/test/gcloud/storage/test_file_acl.rb +0 -367
- data/test/gcloud/storage/test_project.rb +0 -180
- data/test/gcloud/storage/test_storage.rb +0 -29
- data/test/gcloud/storage/test_verifier.rb +0 -62
- data/test/gcloud/test_version.rb +0 -8
- data/test/helper.rb +0 -91
@@ -1,3 +1,4 @@
|
|
1
|
+
#--
|
1
2
|
# Copyright 2014 Google Inc. All rights reserved.
|
2
3
|
#
|
3
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -19,7 +20,17 @@ require "gcloud/storage/file"
|
|
19
20
|
module Gcloud
|
20
21
|
module Storage
|
21
22
|
##
|
22
|
-
#
|
23
|
+
# = Bucket
|
24
|
+
#
|
25
|
+
# Represents a Storage bucket. Belongs to a Project and has many Files.
|
26
|
+
#
|
27
|
+
# require "glcoud/storage"
|
28
|
+
#
|
29
|
+
# storage = Gcloud.storage
|
30
|
+
#
|
31
|
+
# bucket = storage.find_bucket "my-bucket"
|
32
|
+
# file = bucket.find_file "path/to/my-file.ext"
|
33
|
+
#
|
23
34
|
class Bucket
|
24
35
|
##
|
25
36
|
# The Connection object.
|
@@ -31,14 +42,14 @@ module Gcloud
|
|
31
42
|
|
32
43
|
##
|
33
44
|
# Create an empty Bucket object.
|
34
|
-
def initialize
|
45
|
+
def initialize #:nodoc:
|
35
46
|
@connection = nil
|
36
47
|
@gapi = {}
|
37
48
|
end
|
38
49
|
|
39
50
|
##
|
40
51
|
# The kind of item this is.
|
41
|
-
# For buckets, this is always storage#bucket
|
52
|
+
# For buckets, this is always +storage#bucket+.
|
42
53
|
def kind
|
43
54
|
@gapi["kind"]
|
44
55
|
end
|
@@ -80,15 +91,40 @@ module Gcloud
|
|
80
91
|
|
81
92
|
##
|
82
93
|
# Permenently deletes the bucket.
|
83
|
-
# The bucket must be empty.
|
94
|
+
# The bucket must be empty before it can be deleted.
|
84
95
|
#
|
96
|
+
# === Parameters
|
97
|
+
#
|
98
|
+
# +options+::
|
99
|
+
# An optional Hash for controlling additional behavor. (+Hash+)
|
100
|
+
# +options [:retries]+::
|
101
|
+
# The number of times the API call should be retried.
|
102
|
+
# Default is Gcloud::Backoff.retries. (+Integer+)
|
103
|
+
#
|
104
|
+
# === Returns
|
105
|
+
#
|
106
|
+
# +true+ if the bucket was deleted.
|
107
|
+
#
|
108
|
+
# === Examples
|
109
|
+
#
|
110
|
+
# require "gcloud/storage"
|
111
|
+
#
|
112
|
+
# storage = Gcloud.storage
|
113
|
+
#
|
114
|
+
# bucket = storage.find_bucket "my-bucket"
|
85
115
|
# bucket.delete
|
86
116
|
#
|
87
117
|
# The API call to delete the bucket may be retried under certain
|
88
118
|
# conditions. See Gcloud::Backoff to control this behavior, or
|
89
119
|
# specify the wanted behavior in the call:
|
90
120
|
#
|
121
|
+
# require "gcloud/storage"
|
122
|
+
#
|
123
|
+
# storage = Gcloud.storage
|
124
|
+
#
|
125
|
+
# bucket = storage.find_bucket "my-bucket"
|
91
126
|
# bucket.delete retries: 5
|
127
|
+
#
|
92
128
|
def delete options = {}
|
93
129
|
ensure_connection!
|
94
130
|
resp = connection.delete_bucket name, options
|
@@ -102,14 +138,66 @@ module Gcloud
|
|
102
138
|
##
|
103
139
|
# Retrieves a list of files matching the criteria.
|
104
140
|
#
|
141
|
+
# === Parameters
|
142
|
+
#
|
143
|
+
# +options+::
|
144
|
+
# An optional Hash for controlling additional behavor. (+Hash+)
|
145
|
+
# +options [:prefix]+::
|
146
|
+
# Filter results to files whose names begin with this prefix.
|
147
|
+
# (+String+)
|
148
|
+
# +options [:token]+::
|
149
|
+
# A previously-returned page token representing part of the larger set
|
150
|
+
# of results to view. (+String+)
|
151
|
+
# +options [:max]+::
|
152
|
+
# Maximum number of items plus prefixes to return. As duplicate prefixes
|
153
|
+
# are omitted, fewer total results may be returned than requested.
|
154
|
+
# The default value of this parameter is 1,000 items. (+Integer+)
|
155
|
+
# +options [:versions]+::
|
156
|
+
# If +true+, lists all versions of an object as distinct results.
|
157
|
+
# The default is +false+. For more information, see
|
158
|
+
# {Object Versioning
|
159
|
+
# }[https://cloud.google.com/storage/docs/object-versioning].
|
160
|
+
# (+Boolean+)
|
161
|
+
# +options [:max]+::
|
162
|
+
# Maximum number of buckets to return. (+Integer+)
|
163
|
+
#
|
164
|
+
# === Returns
|
165
|
+
#
|
166
|
+
# Array of Gcloud::Datastore::File (Gcloud::Datastore::File::List)
|
167
|
+
#
|
168
|
+
# === Examples
|
169
|
+
#
|
170
|
+
# require "gcloud/storage"
|
171
|
+
#
|
105
172
|
# storage = Gcloud.storage
|
173
|
+
#
|
106
174
|
# bucket = storage.find_bucket "my-bucket"
|
107
175
|
# files = bucket.files
|
108
176
|
# files.each do |file|
|
109
177
|
# puts file.name
|
110
178
|
# end
|
111
179
|
#
|
112
|
-
#
|
180
|
+
# If you have a significant number of files, you may need to paginate
|
181
|
+
# through them: (See File::List#token)
|
182
|
+
#
|
183
|
+
# require "gcloud/storage"
|
184
|
+
#
|
185
|
+
# storage = Gcloud.storage
|
186
|
+
#
|
187
|
+
# bucket = storage.find_bucket "my-bucket"
|
188
|
+
#
|
189
|
+
# all_files = []
|
190
|
+
# tmp_files = bucket.files
|
191
|
+
# while tmp_files.any? do
|
192
|
+
# tmp_files.each do |file|
|
193
|
+
# all_files << file
|
194
|
+
# end
|
195
|
+
# # break loop if no more buckets available
|
196
|
+
# break if tmp_files.token.nil?
|
197
|
+
# # get the next group of files
|
198
|
+
# tmp_files = bucket.files token: tmp_files.token
|
199
|
+
# end
|
200
|
+
#
|
113
201
|
def files options = {}
|
114
202
|
ensure_connection!
|
115
203
|
resp = connection.list_files name, options
|
@@ -123,12 +211,26 @@ module Gcloud
|
|
123
211
|
##
|
124
212
|
# Retrieves a file matching the path.
|
125
213
|
#
|
214
|
+
# === Parameters
|
215
|
+
#
|
216
|
+
# +path+::
|
217
|
+
# Name (path) of the file. (+String+)
|
218
|
+
#
|
219
|
+
# === Returns
|
220
|
+
#
|
221
|
+
# Gcloud::Datastore::File or nil if file does not exist
|
222
|
+
#
|
223
|
+
# === Example
|
224
|
+
#
|
225
|
+
# require "gcloud/storage"
|
226
|
+
#
|
126
227
|
# storage = Gcloud.storage
|
228
|
+
#
|
127
229
|
# bucket = storage.find_bucket "my-bucket"
|
230
|
+
#
|
128
231
|
# file = bucket.find_file "path/to/my-file.ext"
|
129
232
|
# puts file.name
|
130
233
|
#
|
131
|
-
# See Gcloud::Storage::File
|
132
234
|
def find_file path, options = {}
|
133
235
|
ensure_connection!
|
134
236
|
resp = connection.get_file name, path, options
|
@@ -140,17 +242,57 @@ module Gcloud
|
|
140
242
|
end
|
141
243
|
|
142
244
|
##
|
143
|
-
# Create a new
|
144
|
-
#
|
245
|
+
# Create a new File object by providing a path to a local file to upload
|
246
|
+
# and the path to store it with in the bucket.
|
247
|
+
#
|
248
|
+
# === Parameters
|
249
|
+
#
|
250
|
+
# +file+::
|
251
|
+
# Path of the file on the filesystem to upload. (+String+)
|
252
|
+
# +path+::
|
253
|
+
# Path to store the file in Google Cloud Storage. (+String+)
|
254
|
+
# +options+::
|
255
|
+
# An optional Hash for controlling additional behavor. (+Hash+)
|
256
|
+
# +options [:acl]+::
|
257
|
+
# A predefined set of access controls to apply to this file.
|
258
|
+
# (+String+)
|
259
|
+
#
|
260
|
+
# Acceptable values are:
|
261
|
+
# * +auth+, +auth_read+, +authenticated+, +authenticated_read+,
|
262
|
+
# +authenticatedRead+:: File owner gets OWNER access, and
|
263
|
+
# allAuthenticatedUsers get READER access.
|
264
|
+
# * +owner_full+, +bucketOwnerFullControl+:: File owner gets OWNER
|
265
|
+
# access, and project team owners get OWNER access.
|
266
|
+
# * +owner_read+, +bucketOwnerRead+:: File owner gets OWNER access, and
|
267
|
+
# project team owners get READER access.
|
268
|
+
# * +private+:: File owner gets OWNER access.
|
269
|
+
# * +project_private+, +projectPrivate+:: File owner gets OWNER access,
|
270
|
+
# and project team members get access according to their roles.
|
271
|
+
# * +public+, +public_read+, +publicRead+:: File owner gets OWNER
|
272
|
+
# access, and allUsers get READER access.
|
273
|
+
#
|
274
|
+
# === Returns
|
275
|
+
#
|
276
|
+
# Gcloud::Datastore::File
|
277
|
+
#
|
278
|
+
# === Examples
|
279
|
+
#
|
280
|
+
# require "gcloud/storage"
|
145
281
|
#
|
146
282
|
# storage = Gcloud.storage
|
283
|
+
#
|
147
284
|
# bucket = storage.find_bucket "my-bucket"
|
285
|
+
#
|
148
286
|
# bucket.create_file "path/to/local.file.ext"
|
149
287
|
#
|
150
288
|
# Additionally, a destination path can be specified.
|
151
289
|
#
|
290
|
+
# require "gcloud/storage"
|
291
|
+
#
|
152
292
|
# storage = Gcloud.storage
|
293
|
+
#
|
153
294
|
# bucket = storage.find_bucket "my-bucket"
|
295
|
+
#
|
154
296
|
# bucket.create_file "path/to/local.file.ext",
|
155
297
|
# "destination/path/file.ext"
|
156
298
|
#
|
@@ -160,11 +302,16 @@ module Gcloud
|
|
160
302
|
# by 265KB then it will be lowered to the nearest acceptible
|
161
303
|
# value.
|
162
304
|
#
|
305
|
+
# require "gcloud/storage"
|
306
|
+
#
|
307
|
+
# storage = Gcloud.storage
|
308
|
+
#
|
309
|
+
# bucket = storage.find_bucket "my-bucket"
|
310
|
+
#
|
163
311
|
# bucket.create_file "path/to/local.file.ext",
|
164
312
|
# "destination/path/file.ext",
|
165
313
|
# chunk_size: 1024*1024 # 1 MB chunk
|
166
314
|
#
|
167
|
-
# See Gcloud::Storage::File
|
168
315
|
def create_file file, path = nil, options = {}
|
169
316
|
ensure_connection!
|
170
317
|
# TODO: Raise if file doesn't exist
|
@@ -181,13 +328,103 @@ module Gcloud
|
|
181
328
|
end
|
182
329
|
|
183
330
|
##
|
184
|
-
#
|
331
|
+
# The Bucket::Acl instance used to control access to the bucket.
|
332
|
+
#
|
333
|
+
# A bucket has owners, writers, and readers. Permissions can be granted to
|
334
|
+
# an individual user's email address, a group's email address, as well as
|
335
|
+
# many predefined lists. See the
|
336
|
+
# {Access Control guide
|
337
|
+
# }[https://cloud.google.com/storage/docs/access-control]
|
338
|
+
# for more.
|
339
|
+
#
|
340
|
+
# === Examples
|
341
|
+
#
|
342
|
+
# Access to a bucket can be granted to a user by appending +"user-"+ to
|
343
|
+
# the email address:
|
344
|
+
#
|
345
|
+
# require "gcloud/storage"
|
346
|
+
#
|
347
|
+
# storage = Gcloud.storage
|
348
|
+
#
|
349
|
+
# bucket = storage.find_bucket "my-todo-app"
|
350
|
+
#
|
351
|
+
# email = "heidi@example.net"
|
352
|
+
# bucket.acl.add_reader "user-#{email}"
|
353
|
+
#
|
354
|
+
# Access to a bucket can be granted to a group by appending +"group-"+ to
|
355
|
+
# the email address:
|
356
|
+
#
|
357
|
+
# require "gcloud/storage"
|
358
|
+
#
|
359
|
+
# storage = Gcloud.storage
|
360
|
+
#
|
361
|
+
# bucket = storage.find_bucket "my-todo-app"
|
362
|
+
#
|
363
|
+
# email = "authors@example.net"
|
364
|
+
# bucket.acl.add_reader "group-#{email}"
|
365
|
+
#
|
366
|
+
# Access to a bucket can also be granted to a predefined list of
|
367
|
+
# permissions:
|
368
|
+
#
|
369
|
+
# require "gcloud/storage"
|
370
|
+
#
|
371
|
+
# storage = Gcloud.storage
|
372
|
+
#
|
373
|
+
# bucket = storage.find_bucket "my-todo-app"
|
374
|
+
#
|
375
|
+
# bucket.acl.public!
|
376
|
+
#
|
185
377
|
def acl
|
186
378
|
@acl ||= Bucket::Acl.new self
|
187
379
|
end
|
188
380
|
|
189
381
|
##
|
190
|
-
#
|
382
|
+
# The Bucket::DefaultAcl instance used to control access to the bucket's
|
383
|
+
# files.
|
384
|
+
#
|
385
|
+
# A bucket's files have owners, writers, and readers. Permissions can be
|
386
|
+
# granted to an individual user's email address, a group's email address,
|
387
|
+
# as well as many predefined lists. See the
|
388
|
+
# {Access Control guide
|
389
|
+
# }[https://cloud.google.com/storage/docs/access-control]
|
390
|
+
# for more.
|
391
|
+
#
|
392
|
+
# === Examples
|
393
|
+
#
|
394
|
+
# Access to a bucket's files can be granted to a user by appending
|
395
|
+
# +"user-"+ to the email address:
|
396
|
+
#
|
397
|
+
# require "gcloud/storage"
|
398
|
+
#
|
399
|
+
# storage = Gcloud.storage
|
400
|
+
#
|
401
|
+
# bucket = storage.find_bucket "my-todo-app"
|
402
|
+
#
|
403
|
+
# email = "heidi@example.net"
|
404
|
+
# bucket.default_acl.add_reader "user-#{email}"
|
405
|
+
#
|
406
|
+
# Access to a bucket's files can be granted to a group by appending
|
407
|
+
# +"group-"+ to the email address:
|
408
|
+
#
|
409
|
+
# require "gcloud/storage"
|
410
|
+
#
|
411
|
+
# storage = Gcloud.storage
|
412
|
+
#
|
413
|
+
# bucket = storage.find_bucket "my-todo-app"
|
414
|
+
#
|
415
|
+
# email = "authors@example.net"
|
416
|
+
# bucket.default_acl.add_reader "group-#{email}"
|
417
|
+
#
|
418
|
+
# Access to a bucket's files can also be granted to a predefined list of
|
419
|
+
# permissions:
|
420
|
+
#
|
421
|
+
# require "gcloud/storage"
|
422
|
+
#
|
423
|
+
# storage = Gcloud.storage
|
424
|
+
#
|
425
|
+
# bucket = storage.find_bucket "my-todo-app"
|
426
|
+
#
|
427
|
+
# bucket.default_acl.public!
|
191
428
|
def default_acl
|
192
429
|
@default_acl ||= Bucket::DefaultAcl.new self
|
193
430
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#--
|
1
2
|
# Copyright 2015 Google Inc. All rights reserved.
|
2
3
|
#
|
3
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -16,7 +17,18 @@ module Gcloud
|
|
16
17
|
module Storage
|
17
18
|
class Bucket
|
18
19
|
##
|
20
|
+
# = Bucket Access Control List
|
21
|
+
#
|
19
22
|
# Represents a Bucket's Access Control List.
|
23
|
+
#
|
24
|
+
# require "glcoud/storage"
|
25
|
+
#
|
26
|
+
# storage = Gcloud.storage
|
27
|
+
#
|
28
|
+
# bucket = storage.find_bucket "my-bucket"
|
29
|
+
#
|
30
|
+
# bucket.acl.readers.each { |reader| puts reader }
|
31
|
+
#
|
20
32
|
class Acl
|
21
33
|
RULES = { "authenticatedRead" => "authenticatedRead",
|
22
34
|
"auth" => "authenticatedRead",
|
@@ -31,7 +43,7 @@ module Gcloud
|
|
31
43
|
"public" => "publicRead",
|
32
44
|
"public_read" => "publicRead",
|
33
45
|
"publicReadWrite" => "publicReadWrite",
|
34
|
-
"public_write" => "publicReadWrite" }
|
46
|
+
"public_write" => "publicReadWrite" } #:nodoc:
|
35
47
|
|
36
48
|
##
|
37
49
|
# Initialized a new Acl object.
|
@@ -44,6 +56,19 @@ module Gcloud
|
|
44
56
|
@readers = nil
|
45
57
|
end
|
46
58
|
|
59
|
+
##
|
60
|
+
# Reloads all Access Control List data for the bucket.
|
61
|
+
#
|
62
|
+
# === Example
|
63
|
+
#
|
64
|
+
# require "glcoud/storage"
|
65
|
+
#
|
66
|
+
# storage = Gcloud.storage
|
67
|
+
#
|
68
|
+
# bucket = storage.find_bucket "my-bucket"
|
69
|
+
#
|
70
|
+
# bucket.acl.refresh!
|
71
|
+
#
|
47
72
|
def refresh!
|
48
73
|
resp = @connection.list_bucket_acls @bucket
|
49
74
|
acls = resp.data["items"]
|
@@ -52,21 +77,116 @@ module Gcloud
|
|
52
77
|
@readers = entities_from_acls acls, "READER"
|
53
78
|
end
|
54
79
|
|
80
|
+
##
|
81
|
+
# Lists the owners of the bucket.
|
82
|
+
#
|
83
|
+
# === Returns
|
84
|
+
#
|
85
|
+
# Array of Strings
|
86
|
+
#
|
87
|
+
# === Example
|
88
|
+
#
|
89
|
+
# require "glcoud/storage"
|
90
|
+
#
|
91
|
+
# storage = Gcloud.storage
|
92
|
+
#
|
93
|
+
# bucket = storage.find_bucket "my-bucket"
|
94
|
+
#
|
95
|
+
# bucket.acl.owners.each { |owner| puts owner }
|
96
|
+
#
|
55
97
|
def owners
|
56
98
|
refresh! if @owners.nil?
|
57
99
|
@owners
|
58
100
|
end
|
59
101
|
|
102
|
+
##
|
103
|
+
# Lists the owners of the bucket.
|
104
|
+
#
|
105
|
+
# === Returns
|
106
|
+
#
|
107
|
+
# Array of Strings
|
108
|
+
#
|
109
|
+
# === Example
|
110
|
+
#
|
111
|
+
# require "glcoud/storage"
|
112
|
+
#
|
113
|
+
# storage = Gcloud.storage
|
114
|
+
#
|
115
|
+
# bucket = storage.find_bucket "my-bucket"
|
116
|
+
#
|
117
|
+
# bucket.acl.writers.each { |writer| puts writer }
|
118
|
+
#
|
60
119
|
def writers
|
61
120
|
refresh! if @writers.nil?
|
62
121
|
@writers
|
63
122
|
end
|
64
123
|
|
124
|
+
##
|
125
|
+
# Lists the readers of the bucket.
|
126
|
+
#
|
127
|
+
# === Returns
|
128
|
+
#
|
129
|
+
# Array of Strings
|
130
|
+
#
|
131
|
+
# === Example
|
132
|
+
#
|
133
|
+
# require "glcoud/storage"
|
134
|
+
#
|
135
|
+
# storage = Gcloud.storage
|
136
|
+
#
|
137
|
+
# bucket = storage.find_bucket "my-bucket"
|
138
|
+
#
|
139
|
+
# bucket.acl.readers.each { |reader| puts reader }
|
140
|
+
#
|
65
141
|
def readers
|
66
142
|
refresh! if @readers.nil?
|
67
143
|
@readers
|
68
144
|
end
|
69
145
|
|
146
|
+
##
|
147
|
+
# Grants owner permission to the bucket.
|
148
|
+
#
|
149
|
+
# === Parameters
|
150
|
+
#
|
151
|
+
# +entity+::
|
152
|
+
# The entity holding the permission, in one of the following forms:
|
153
|
+
# (+String+)
|
154
|
+
#
|
155
|
+
# * user-userId
|
156
|
+
# * user-email
|
157
|
+
# * group-groupId
|
158
|
+
# * group-email
|
159
|
+
# * domain-domain
|
160
|
+
# * project-team-projectId
|
161
|
+
# * allUsers
|
162
|
+
# * allAuthenticatedUsers
|
163
|
+
#
|
164
|
+
# === Examples
|
165
|
+
#
|
166
|
+
# Access to a bucket can be granted to a user by appending +"user-"+ to
|
167
|
+
# the email address:
|
168
|
+
#
|
169
|
+
# require "glcoud/storage"
|
170
|
+
#
|
171
|
+
# storage = Gcloud.storage
|
172
|
+
#
|
173
|
+
# bucket = storage.find_bucket "my-bucket"
|
174
|
+
#
|
175
|
+
# email = "heidi@example.net"
|
176
|
+
# bucket.acl.add_owner "user-#{email}"
|
177
|
+
#
|
178
|
+
# Access to a bucket can be granted to a group by appending +"group-"+
|
179
|
+
# to the email address:
|
180
|
+
#
|
181
|
+
# require "glcoud/storage"
|
182
|
+
#
|
183
|
+
# storage = Gcloud.storage
|
184
|
+
#
|
185
|
+
# bucket = storage.find_bucket "my-bucket"
|
186
|
+
#
|
187
|
+
# email = "authors@example.net"
|
188
|
+
# bucket.acl.add_owner "group-#{email}"
|
189
|
+
#
|
70
190
|
def add_owner entity
|
71
191
|
resp = @connection.insert_bucket_acl @bucket, entity, "OWNER"
|
72
192
|
if resp.success?
|
@@ -77,6 +197,50 @@ module Gcloud
|
|
77
197
|
nil
|
78
198
|
end
|
79
199
|
|
200
|
+
##
|
201
|
+
# Grants writer permission to the bucket.
|
202
|
+
#
|
203
|
+
# === Parameters
|
204
|
+
#
|
205
|
+
# +entity+::
|
206
|
+
# The entity holding the permission, in one of the following forms:
|
207
|
+
# (+String+)
|
208
|
+
#
|
209
|
+
# * user-userId
|
210
|
+
# * user-email
|
211
|
+
# * group-groupId
|
212
|
+
# * group-email
|
213
|
+
# * domain-domain
|
214
|
+
# * project-team-projectId
|
215
|
+
# * allUsers
|
216
|
+
# * allAuthenticatedUsers
|
217
|
+
#
|
218
|
+
# === Examples
|
219
|
+
#
|
220
|
+
# Access to a bucket can be granted to a user by appending +"user-"+ to
|
221
|
+
# the email address:
|
222
|
+
#
|
223
|
+
# require "glcoud/storage"
|
224
|
+
#
|
225
|
+
# storage = Gcloud.storage
|
226
|
+
#
|
227
|
+
# bucket = storage.find_bucket "my-bucket"
|
228
|
+
#
|
229
|
+
# email = "heidi@example.net"
|
230
|
+
# bucket.acl.add_writer "user-#{email}"
|
231
|
+
#
|
232
|
+
# Access to a bucket can be granted to a group by appending +"group-"+
|
233
|
+
# to the email address:
|
234
|
+
#
|
235
|
+
# require "glcoud/storage"
|
236
|
+
#
|
237
|
+
# storage = Gcloud.storage
|
238
|
+
#
|
239
|
+
# bucket = storage.find_bucket "my-bucket"
|
240
|
+
#
|
241
|
+
# email = "authors@example.net"
|
242
|
+
# bucket.acl.add_writer "group-#{email}"
|
243
|
+
#
|
80
244
|
def add_writer entity
|
81
245
|
resp = @connection.insert_bucket_acl @bucket, entity, "WRITER"
|
82
246
|
if resp.success?
|
@@ -87,6 +251,50 @@ module Gcloud
|
|
87
251
|
nil
|
88
252
|
end
|
89
253
|
|
254
|
+
##
|
255
|
+
# Grants reader permission to the bucket.
|
256
|
+
#
|
257
|
+
# === Parameters
|
258
|
+
#
|
259
|
+
# +entity+::
|
260
|
+
# The entity holding the permission, in one of the following forms:
|
261
|
+
# (+String+)
|
262
|
+
#
|
263
|
+
# * user-userId
|
264
|
+
# * user-email
|
265
|
+
# * group-groupId
|
266
|
+
# * group-email
|
267
|
+
# * domain-domain
|
268
|
+
# * project-team-projectId
|
269
|
+
# * allUsers
|
270
|
+
# * allAuthenticatedUsers
|
271
|
+
#
|
272
|
+
# === Examples
|
273
|
+
#
|
274
|
+
# Access to a bucket can be granted to a user by appending +"user-"+ to
|
275
|
+
# the email address:
|
276
|
+
#
|
277
|
+
# require "glcoud/storage"
|
278
|
+
#
|
279
|
+
# storage = Gcloud.storage
|
280
|
+
#
|
281
|
+
# bucket = storage.find_bucket "my-bucket"
|
282
|
+
#
|
283
|
+
# email = "heidi@example.net"
|
284
|
+
# bucket.acl.add_reader "user-#{email}"
|
285
|
+
#
|
286
|
+
# Access to a bucket can be granted to a group by appending +"group-"+
|
287
|
+
# to the email address:
|
288
|
+
#
|
289
|
+
# require "glcoud/storage"
|
290
|
+
#
|
291
|
+
# storage = Gcloud.storage
|
292
|
+
#
|
293
|
+
# bucket = storage.find_bucket "my-bucket"
|
294
|
+
#
|
295
|
+
# email = "authors@example.net"
|
296
|
+
# bucket.acl.add_reader "group-#{email}"
|
297
|
+
#
|
90
298
|
def add_reader entity
|
91
299
|
resp = @connection.insert_bucket_acl @bucket, entity, "READER"
|
92
300
|
if resp.success?
|
@@ -97,6 +305,35 @@ module Gcloud
|
|
97
305
|
nil
|
98
306
|
end
|
99
307
|
|
308
|
+
##
|
309
|
+
# Permenently deletes the entity from the bucket's access control list.
|
310
|
+
#
|
311
|
+
# === Parameters
|
312
|
+
#
|
313
|
+
# +entity+::
|
314
|
+
# The entity holding the permission, in one of the following forms:
|
315
|
+
# (+String+)
|
316
|
+
#
|
317
|
+
# * user-userId
|
318
|
+
# * user-email
|
319
|
+
# * group-groupId
|
320
|
+
# * group-email
|
321
|
+
# * domain-domain
|
322
|
+
# * project-team-projectId
|
323
|
+
# * allUsers
|
324
|
+
# * allAuthenticatedUsers
|
325
|
+
#
|
326
|
+
# === Example
|
327
|
+
#
|
328
|
+
# require "glcoud/storage"
|
329
|
+
#
|
330
|
+
# storage = Gcloud.storage
|
331
|
+
#
|
332
|
+
# bucket = storage.find_bucket "my-bucket"
|
333
|
+
#
|
334
|
+
# email = "heidi@example.net"
|
335
|
+
# bucket.acl.delete "user-#{email}"
|
336
|
+
#
|
100
337
|
def delete entity
|
101
338
|
resp = @connection.delete_bucket_acl @bucket, entity
|
102
339
|
if resp.success?
|
@@ -108,12 +345,26 @@ module Gcloud
|
|
108
345
|
false
|
109
346
|
end
|
110
347
|
|
111
|
-
def self.predefined_rule_for rule_name
|
348
|
+
def self.predefined_rule_for rule_name #:nodoc:
|
112
349
|
RULES[rule_name.to_s]
|
113
350
|
end
|
114
351
|
|
115
352
|
# Predefined ACL helpers
|
116
353
|
|
354
|
+
##
|
355
|
+
# Convenience method to apply the +authenticatedRead+ predefined ACL
|
356
|
+
# rule to the bucket.
|
357
|
+
#
|
358
|
+
# === Example
|
359
|
+
#
|
360
|
+
# require "glcoud/storage"
|
361
|
+
#
|
362
|
+
# storage = Gcloud.storage
|
363
|
+
#
|
364
|
+
# bucket = storage.find_bucket "my-bucket"
|
365
|
+
#
|
366
|
+
# bucket.acl.auth!
|
367
|
+
#
|
117
368
|
def auth!
|
118
369
|
update_predefined_acl! "authenticatedRead"
|
119
370
|
end
|
@@ -122,21 +373,76 @@ module Gcloud
|
|
122
373
|
alias_method :authenticated!, :auth!
|
123
374
|
alias_method :authenticated_read!, :auth!
|
124
375
|
|
376
|
+
##
|
377
|
+
# Convenience method to apply the +private+ predefined ACL
|
378
|
+
# rule to the bucket.
|
379
|
+
#
|
380
|
+
# === Example
|
381
|
+
#
|
382
|
+
# require "glcoud/storage"
|
383
|
+
#
|
384
|
+
# storage = Gcloud.storage
|
385
|
+
#
|
386
|
+
# bucket = storage.find_bucket "my-bucket"
|
387
|
+
#
|
388
|
+
# bucket.acl.private!
|
389
|
+
#
|
125
390
|
def private!
|
126
391
|
update_predefined_acl! "private"
|
127
392
|
end
|
128
393
|
|
394
|
+
##
|
395
|
+
# Convenience method to apply the +projectPrivate+ predefined ACL
|
396
|
+
# rule to the bucket.
|
397
|
+
#
|
398
|
+
# === Example
|
399
|
+
#
|
400
|
+
# require "glcoud/storage"
|
401
|
+
#
|
402
|
+
# storage = Gcloud.storage
|
403
|
+
#
|
404
|
+
# bucket = storage.find_bucket "my-bucket"
|
405
|
+
#
|
406
|
+
# bucket.acl.project_private!
|
407
|
+
#
|
129
408
|
def project_private!
|
130
409
|
update_predefined_acl! "projectPrivate"
|
131
410
|
end
|
132
411
|
alias_method :projectPrivate!, :project_private!
|
133
412
|
|
413
|
+
##
|
414
|
+
# Convenience method to apply the +publicRead+ predefined ACL
|
415
|
+
# rule to the bucket.
|
416
|
+
#
|
417
|
+
# === Example
|
418
|
+
#
|
419
|
+
# require "glcoud/storage"
|
420
|
+
#
|
421
|
+
# storage = Gcloud.storage
|
422
|
+
#
|
423
|
+
# bucket = storage.find_bucket "my-bucket"
|
424
|
+
#
|
425
|
+
# bucket.acl.public!
|
426
|
+
#
|
134
427
|
def public!
|
135
428
|
update_predefined_acl! "publicRead"
|
136
429
|
end
|
137
430
|
alias_method :publicRead!, :public!
|
138
431
|
alias_method :public_read!, :public!
|
139
432
|
|
433
|
+
# Convenience method to apply the +publicReadWrite+ predefined ACL
|
434
|
+
# rule to the bucket.
|
435
|
+
#
|
436
|
+
# === Example
|
437
|
+
#
|
438
|
+
# require "glcoud/storage"
|
439
|
+
#
|
440
|
+
# storage = Gcloud.storage
|
441
|
+
#
|
442
|
+
# bucket = storage.find_bucket "my-bucket"
|
443
|
+
#
|
444
|
+
# bucket.acl.public_write!
|
445
|
+
#
|
140
446
|
def public_write!
|
141
447
|
update_predefined_acl! "publicReadWrite"
|
142
448
|
end
|
@@ -159,7 +465,18 @@ module Gcloud
|
|
159
465
|
end
|
160
466
|
|
161
467
|
##
|
468
|
+
# = Bucket Default Access Control List
|
469
|
+
#
|
162
470
|
# Represents a Bucket's Default Access Control List.
|
471
|
+
#
|
472
|
+
# require "glcoud/storage"
|
473
|
+
#
|
474
|
+
# storage = Gcloud.storage
|
475
|
+
#
|
476
|
+
# bucket = storage.find_bucket "my-bucket"
|
477
|
+
#
|
478
|
+
# bucket.default_acl.readers.each { |reader| puts reader }
|
479
|
+
#
|
163
480
|
class DefaultAcl
|
164
481
|
RULES = { "authenticatedRead" => "authenticatedRead",
|
165
482
|
"auth" => "authenticatedRead",
|
@@ -175,7 +492,7 @@ module Gcloud
|
|
175
492
|
"project_private" => "projectPrivate",
|
176
493
|
"publicRead" => "publicRead",
|
177
494
|
"public" => "publicRead",
|
178
|
-
"public_read" => "publicRead" }
|
495
|
+
"public_read" => "publicRead" } #:nodoc:
|
179
496
|
|
180
497
|
##
|
181
498
|
# Initialized a new DefaultAcl object.
|
@@ -188,6 +505,19 @@ module Gcloud
|
|
188
505
|
@readers = nil
|
189
506
|
end
|
190
507
|
|
508
|
+
##
|
509
|
+
# Reloads all Default Access Control List data for the bucket.
|
510
|
+
#
|
511
|
+
# === Example
|
512
|
+
#
|
513
|
+
# require "glcoud/storage"
|
514
|
+
#
|
515
|
+
# storage = Gcloud.storage
|
516
|
+
#
|
517
|
+
# bucket = storage.find_bucket "my-bucket"
|
518
|
+
#
|
519
|
+
# bucket.default_acl.refresh!
|
520
|
+
#
|
191
521
|
def refresh!
|
192
522
|
resp = @connection.list_default_acls @bucket
|
193
523
|
acls = resp.data["items"]
|
@@ -196,21 +526,116 @@ module Gcloud
|
|
196
526
|
@readers = entities_from_acls acls, "READER"
|
197
527
|
end
|
198
528
|
|
529
|
+
##
|
530
|
+
# Lists the default owners for files in the bucket.
|
531
|
+
#
|
532
|
+
# === Returns
|
533
|
+
#
|
534
|
+
# Array of Strings
|
535
|
+
#
|
536
|
+
# === Example
|
537
|
+
#
|
538
|
+
# require "glcoud/storage"
|
539
|
+
#
|
540
|
+
# storage = Gcloud.storage
|
541
|
+
#
|
542
|
+
# bucket = storage.find_bucket "my-bucket"
|
543
|
+
#
|
544
|
+
# bucket.default_acl.owners.each { |owner| puts owner }
|
545
|
+
#
|
199
546
|
def owners
|
200
547
|
refresh! if @owners.nil?
|
201
548
|
@owners
|
202
549
|
end
|
203
550
|
|
551
|
+
##
|
552
|
+
# Lists the default writers for files in the bucket.
|
553
|
+
#
|
554
|
+
# === Returns
|
555
|
+
#
|
556
|
+
# Array of Strings
|
557
|
+
#
|
558
|
+
# === Example
|
559
|
+
#
|
560
|
+
# require "glcoud/storage"
|
561
|
+
#
|
562
|
+
# storage = Gcloud.storage
|
563
|
+
#
|
564
|
+
# bucket = storage.find_bucket "my-bucket"
|
565
|
+
#
|
566
|
+
# bucket.default_acl.writers.each { |writer| puts writer }
|
567
|
+
#
|
204
568
|
def writers
|
205
569
|
refresh! if @writers.nil?
|
206
570
|
@writers
|
207
571
|
end
|
208
572
|
|
573
|
+
##
|
574
|
+
# Lists the default readers for files in the bucket.
|
575
|
+
#
|
576
|
+
# === Returns
|
577
|
+
#
|
578
|
+
# Array of Strings
|
579
|
+
#
|
580
|
+
# === Example
|
581
|
+
#
|
582
|
+
# require "glcoud/storage"
|
583
|
+
#
|
584
|
+
# storage = Gcloud.storage
|
585
|
+
#
|
586
|
+
# bucket = storage.find_bucket "my-bucket"
|
587
|
+
#
|
588
|
+
# bucket.default_acl.readers.each { |reader| puts reader }
|
589
|
+
#
|
209
590
|
def readers
|
210
591
|
refresh! if @readers.nil?
|
211
592
|
@readers
|
212
593
|
end
|
213
594
|
|
595
|
+
##
|
596
|
+
# Grants default owner permission to files in the bucket.
|
597
|
+
#
|
598
|
+
# === Parameters
|
599
|
+
#
|
600
|
+
# +entity+::
|
601
|
+
# The entity holding the permission, in one of the following forms:
|
602
|
+
# (+String+)
|
603
|
+
#
|
604
|
+
# * user-userId
|
605
|
+
# * user-email
|
606
|
+
# * group-groupId
|
607
|
+
# * group-email
|
608
|
+
# * domain-domain
|
609
|
+
# * project-team-projectId
|
610
|
+
# * allUsers
|
611
|
+
# * allAuthenticatedUsers
|
612
|
+
#
|
613
|
+
# === Examples
|
614
|
+
#
|
615
|
+
# Access to a bucket can be granted to a user by appending +"user-"+ to
|
616
|
+
# the email address:
|
617
|
+
#
|
618
|
+
# require "glcoud/storage"
|
619
|
+
#
|
620
|
+
# storage = Gcloud.storage
|
621
|
+
#
|
622
|
+
# bucket = storage.find_bucket "my-bucket"
|
623
|
+
#
|
624
|
+
# email = "heidi@example.net"
|
625
|
+
# bucket.default_acl.add_owner "user-#{email}"
|
626
|
+
#
|
627
|
+
# Access to a bucket can be granted to a group by appending +"group-"+
|
628
|
+
# to the email address:
|
629
|
+
#
|
630
|
+
# require "glcoud/storage"
|
631
|
+
#
|
632
|
+
# storage = Gcloud.storage
|
633
|
+
#
|
634
|
+
# bucket = storage.find_bucket "my-bucket"
|
635
|
+
#
|
636
|
+
# email = "authors@example.net"
|
637
|
+
# bucket.default_acl.add_owner "group-#{email}"
|
638
|
+
#
|
214
639
|
def add_owner entity
|
215
640
|
resp = @connection.insert_default_acl @bucket, entity, "OWNER"
|
216
641
|
if resp.success?
|
@@ -221,6 +646,50 @@ module Gcloud
|
|
221
646
|
nil
|
222
647
|
end
|
223
648
|
|
649
|
+
##
|
650
|
+
# Grants default writer permission to files in the bucket.
|
651
|
+
#
|
652
|
+
# === Parameters
|
653
|
+
#
|
654
|
+
# +entity+::
|
655
|
+
# The entity holding the permission, in one of the following forms:
|
656
|
+
# (+String+)
|
657
|
+
#
|
658
|
+
# * user-userId
|
659
|
+
# * user-email
|
660
|
+
# * group-groupId
|
661
|
+
# * group-email
|
662
|
+
# * domain-domain
|
663
|
+
# * project-team-projectId
|
664
|
+
# * allUsers
|
665
|
+
# * allAuthenticatedUsers
|
666
|
+
#
|
667
|
+
# === Examples
|
668
|
+
#
|
669
|
+
# Access to a bucket can be granted to a user by appending +"user-"+ to
|
670
|
+
# the email address:
|
671
|
+
#
|
672
|
+
# require "glcoud/storage"
|
673
|
+
#
|
674
|
+
# storage = Gcloud.storage
|
675
|
+
#
|
676
|
+
# bucket = storage.find_bucket "my-bucket"
|
677
|
+
#
|
678
|
+
# email = "heidi@example.net"
|
679
|
+
# bucket.default_acl.add_writer "user-#{email}"
|
680
|
+
#
|
681
|
+
# Access to a bucket can be granted to a group by appending +"group-"+
|
682
|
+
# to the email address:
|
683
|
+
#
|
684
|
+
# require "glcoud/storage"
|
685
|
+
#
|
686
|
+
# storage = Gcloud.storage
|
687
|
+
#
|
688
|
+
# bucket = storage.find_bucket "my-bucket"
|
689
|
+
#
|
690
|
+
# email = "authors@example.net"
|
691
|
+
# bucket.default_acl.add_writer "group-#{email}"
|
692
|
+
#
|
224
693
|
def add_writer entity
|
225
694
|
resp = @connection.insert_default_acl @bucket, entity, "WRITER"
|
226
695
|
if resp.success?
|
@@ -231,6 +700,50 @@ module Gcloud
|
|
231
700
|
nil
|
232
701
|
end
|
233
702
|
|
703
|
+
##
|
704
|
+
# Grants default reader permission to files in the bucket.
|
705
|
+
#
|
706
|
+
# === Parameters
|
707
|
+
#
|
708
|
+
# +entity+::
|
709
|
+
# The entity holding the permission, in one of the following forms:
|
710
|
+
# (+String+)
|
711
|
+
#
|
712
|
+
# * user-userId
|
713
|
+
# * user-email
|
714
|
+
# * group-groupId
|
715
|
+
# * group-email
|
716
|
+
# * domain-domain
|
717
|
+
# * project-team-projectId
|
718
|
+
# * allUsers
|
719
|
+
# * allAuthenticatedUsers
|
720
|
+
#
|
721
|
+
# === Examples
|
722
|
+
#
|
723
|
+
# Access to a bucket can be granted to a user by appending +"user-"+ to
|
724
|
+
# the email address:
|
725
|
+
#
|
726
|
+
# require "glcoud/storage"
|
727
|
+
#
|
728
|
+
# storage = Gcloud.storage
|
729
|
+
#
|
730
|
+
# bucket = storage.find_bucket "my-bucket"
|
731
|
+
#
|
732
|
+
# email = "heidi@example.net"
|
733
|
+
# bucket.default_acl.add_reader "user-#{email}"
|
734
|
+
#
|
735
|
+
# Access to a bucket can be granted to a group by appending +"group-"+
|
736
|
+
# to the email address:
|
737
|
+
#
|
738
|
+
# require "glcoud/storage"
|
739
|
+
#
|
740
|
+
# storage = Gcloud.storage
|
741
|
+
#
|
742
|
+
# bucket = storage.find_bucket "my-bucket"
|
743
|
+
#
|
744
|
+
# email = "authors@example.net"
|
745
|
+
# bucket.default_acl.add_reader "group-#{email}"
|
746
|
+
#
|
234
747
|
def add_reader entity
|
235
748
|
resp = @connection.insert_default_acl @bucket, entity, "READER"
|
236
749
|
if resp.success?
|
@@ -241,6 +754,36 @@ module Gcloud
|
|
241
754
|
nil
|
242
755
|
end
|
243
756
|
|
757
|
+
##
|
758
|
+
# Permenently deletes the entity from the bucket's default access
|
759
|
+
# control list for files.
|
760
|
+
#
|
761
|
+
# === Parameters
|
762
|
+
#
|
763
|
+
# +entity+::
|
764
|
+
# The entity holding the permission, in one of the following forms:
|
765
|
+
# (+String+)
|
766
|
+
#
|
767
|
+
# * user-userId
|
768
|
+
# * user-email
|
769
|
+
# * group-groupId
|
770
|
+
# * group-email
|
771
|
+
# * domain-domain
|
772
|
+
# * project-team-projectId
|
773
|
+
# * allUsers
|
774
|
+
# * allAuthenticatedUsers
|
775
|
+
#
|
776
|
+
# === Example
|
777
|
+
#
|
778
|
+
# require "glcoud/storage"
|
779
|
+
#
|
780
|
+
# storage = Gcloud.storage
|
781
|
+
#
|
782
|
+
# bucket = storage.find_bucket "my-bucket"
|
783
|
+
#
|
784
|
+
# email = "heidi@example.net"
|
785
|
+
# bucket.default_acl.delete "user-#{email}"
|
786
|
+
#
|
244
787
|
def delete entity
|
245
788
|
resp = @connection.delete_default_acl @bucket, entity
|
246
789
|
if resp.success?
|
@@ -252,12 +795,26 @@ module Gcloud
|
|
252
795
|
false
|
253
796
|
end
|
254
797
|
|
255
|
-
def self.predefined_rule_for rule_name
|
798
|
+
def self.predefined_rule_for rule_name #:nodoc:
|
256
799
|
RULES[rule_name.to_s]
|
257
800
|
end
|
258
801
|
|
259
802
|
# Predefined ACL helpers
|
260
803
|
|
804
|
+
##
|
805
|
+
# Convenience method to apply the default +authenticatedRead+
|
806
|
+
# predefined ACL rule to files in the bucket.
|
807
|
+
#
|
808
|
+
# === Example
|
809
|
+
#
|
810
|
+
# require "glcoud/storage"
|
811
|
+
#
|
812
|
+
# storage = Gcloud.storage
|
813
|
+
#
|
814
|
+
# bucket = storage.find_bucket "my-bucket"
|
815
|
+
#
|
816
|
+
# bucket.acl.auth!
|
817
|
+
#
|
261
818
|
def auth!
|
262
819
|
update_predefined_default_acl! "authenticatedRead"
|
263
820
|
end
|
@@ -266,25 +823,95 @@ module Gcloud
|
|
266
823
|
alias_method :authenticated!, :auth!
|
267
824
|
alias_method :authenticated_read!, :auth!
|
268
825
|
|
826
|
+
##
|
827
|
+
# Convenience method to apply the default +bucketOwnerFullControl+
|
828
|
+
# predefined ACL rule to files in the bucket.
|
829
|
+
#
|
830
|
+
# === Example
|
831
|
+
#
|
832
|
+
# require "glcoud/storage"
|
833
|
+
#
|
834
|
+
# storage = Gcloud.storage
|
835
|
+
#
|
836
|
+
# bucket = storage.find_bucket "my-bucket"
|
837
|
+
#
|
838
|
+
# bucket.acl.owner_full!
|
839
|
+
#
|
269
840
|
def owner_full!
|
270
841
|
update_predefined_default_acl! "bucketOwnerFullControl"
|
271
842
|
end
|
272
843
|
alias_method :bucketOwnerFullControl!, :owner_full!
|
273
844
|
|
845
|
+
##
|
846
|
+
# Convenience method to apply the default +bucketOwnerRead+
|
847
|
+
# predefined ACL rule to files in the bucket.
|
848
|
+
#
|
849
|
+
# === Example
|
850
|
+
#
|
851
|
+
# require "glcoud/storage"
|
852
|
+
#
|
853
|
+
# storage = Gcloud.storage
|
854
|
+
#
|
855
|
+
# bucket = storage.find_bucket "my-bucket"
|
856
|
+
#
|
857
|
+
# bucket.acl.owner_read!
|
858
|
+
#
|
274
859
|
def owner_read!
|
275
860
|
update_predefined_default_acl! "bucketOwnerRead"
|
276
861
|
end
|
277
862
|
alias_method :bucketOwnerRead!, :owner_read!
|
278
863
|
|
864
|
+
##
|
865
|
+
# Convenience method to apply the default +private+
|
866
|
+
# predefined ACL rule to files in the bucket.
|
867
|
+
#
|
868
|
+
# === Example
|
869
|
+
#
|
870
|
+
# require "glcoud/storage"
|
871
|
+
#
|
872
|
+
# storage = Gcloud.storage
|
873
|
+
#
|
874
|
+
# bucket = storage.find_bucket "my-bucket"
|
875
|
+
#
|
876
|
+
# bucket.acl.private!
|
877
|
+
#
|
279
878
|
def private!
|
280
879
|
update_predefined_default_acl! "private"
|
281
880
|
end
|
282
881
|
|
882
|
+
##
|
883
|
+
# Convenience method to apply the default +projectPrivate+
|
884
|
+
# predefined ACL rule to files in the bucket.
|
885
|
+
#
|
886
|
+
# === Example
|
887
|
+
#
|
888
|
+
# require "glcoud/storage"
|
889
|
+
#
|
890
|
+
# storage = Gcloud.storage
|
891
|
+
#
|
892
|
+
# bucket = storage.find_bucket "my-bucket"
|
893
|
+
#
|
894
|
+
# bucket.acl.project_private!
|
895
|
+
#
|
283
896
|
def project_private!
|
284
897
|
update_predefined_default_acl! "projectPrivate"
|
285
898
|
end
|
286
899
|
alias_method :projectPrivate!, :project_private!
|
287
900
|
|
901
|
+
##
|
902
|
+
# Convenience method to apply the default +publicRead+
|
903
|
+
# predefined ACL rule to files in the bucket.
|
904
|
+
#
|
905
|
+
# === Example
|
906
|
+
#
|
907
|
+
# require "glcoud/storage"
|
908
|
+
#
|
909
|
+
# storage = Gcloud.storage
|
910
|
+
#
|
911
|
+
# bucket = storage.find_bucket "my-bucket"
|
912
|
+
#
|
913
|
+
# bucket.acl.public!
|
914
|
+
#
|
288
915
|
def public!
|
289
916
|
update_predefined_default_acl! "publicRead"
|
290
917
|
end
|