gcloud 0.1.1 → 0.2.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 +8 -8
- data/AUTHENTICATION.md +1 -1
- data/CHANGELOG.md +14 -0
- data/OVERVIEW.md +87 -0
- data/lib/gcloud.rb +106 -0
- data/lib/gcloud/credentials.rb +1 -1
- data/lib/gcloud/datastore.rb +44 -31
- data/lib/gcloud/datastore/credentials.rb +1 -1
- data/lib/gcloud/datastore/dataset.rb +20 -14
- data/lib/gcloud/datastore/entity.rb +25 -18
- data/lib/gcloud/datastore/key.rb +11 -8
- data/lib/gcloud/pubsub.rb +375 -0
- data/lib/gcloud/pubsub/connection.rb +284 -0
- data/lib/gcloud/pubsub/credentials.rb +29 -0
- data/lib/gcloud/pubsub/errors.rb +91 -0
- data/lib/gcloud/pubsub/message.rb +90 -0
- data/lib/gcloud/pubsub/project.rb +408 -0
- data/lib/gcloud/pubsub/received_message.rb +170 -0
- data/lib/gcloud/pubsub/subscription.rb +605 -0
- data/lib/gcloud/pubsub/subscription/list.rb +50 -0
- data/lib/gcloud/pubsub/topic.rb +640 -0
- data/lib/gcloud/pubsub/topic/list.rb +46 -0
- data/lib/gcloud/storage.rb +84 -66
- data/lib/gcloud/storage/bucket.rb +87 -68
- data/lib/gcloud/storage/bucket/acl.rb +140 -105
- data/lib/gcloud/storage/credentials.rb +1 -1
- data/lib/gcloud/storage/errors.rb +8 -0
- data/lib/gcloud/storage/file.rb +138 -78
- data/lib/gcloud/storage/file/acl.rb +98 -80
- data/lib/gcloud/storage/project.rb +42 -32
- data/lib/gcloud/version.rb +1 -1
- metadata +16 -9
- data/CONTRIBUTING.md +0 -93
- data/LICENSE +0 -201
- data/README.md +0 -110
@@ -18,7 +18,7 @@ require "gcloud/credentials"
|
|
18
18
|
module Gcloud
|
19
19
|
module Storage
|
20
20
|
##
|
21
|
-
# Represents the
|
21
|
+
# Represents the OAuth 2.0 signing logic for Storage.
|
22
22
|
class Credentials < Gcloud::Credentials #:nodoc:
|
23
23
|
SCOPE = ["https://www.googleapis.com/auth/devstorage.full_control"]
|
24
24
|
PATH_ENV_VARS = %w(STORAGE_KEYFILE GOOGLE_CLOUD_KEYFILE)
|
@@ -82,5 +82,13 @@ module Gcloud
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
85
|
+
|
86
|
+
##
|
87
|
+
# = SignedUrlUnavailable Error
|
88
|
+
#
|
89
|
+
# This is raised when File#signed_url is unable to generate a URL due to
|
90
|
+
# missing credentials needed to create the URL.
|
91
|
+
class SignedUrlUnavailable < Error
|
92
|
+
end
|
85
93
|
end
|
86
94
|
end
|
data/lib/gcloud/storage/file.rb
CHANGED
@@ -24,13 +24,14 @@ module Gcloud
|
|
24
24
|
#
|
25
25
|
# Represents the File/Object that belong to a Bucket.
|
26
26
|
#
|
27
|
-
# require "
|
27
|
+
# require "gcloud"
|
28
28
|
#
|
29
|
-
#
|
29
|
+
# gcloud = Gcloud.new
|
30
|
+
# storage = gcloud.storage
|
30
31
|
#
|
31
|
-
# bucket = storage.
|
32
|
+
# bucket = storage.bucket "my-bucket"
|
32
33
|
#
|
33
|
-
# file = bucket.
|
34
|
+
# file = bucket.file "path/to/my-file.ext"
|
34
35
|
# file.download "/downloads/#{bucket.name}/#{file.name}"
|
35
36
|
#
|
36
37
|
class File
|
@@ -138,16 +139,16 @@ module Gcloud
|
|
138
139
|
# The path on the local file system to write the data to.
|
139
140
|
# The path provided must be writable. (+String+)
|
140
141
|
# +options+::
|
141
|
-
# An optional Hash for controlling additional
|
142
|
-
#
|
142
|
+
# An optional Hash for controlling additional behavior. (+Hash+)
|
143
|
+
# <code>options[:verify]</code>::
|
143
144
|
# The verification algoruthm used to ensure the downloaded file contents
|
144
145
|
# are correct. Default is +:md5+. (+Symbol+)
|
145
146
|
#
|
146
147
|
# Acceptable values are:
|
147
|
-
# * +md5
|
148
|
-
# * +crc32c
|
149
|
-
# * +all
|
150
|
-
# * +none
|
148
|
+
# * +md5+ - Verify file content match using the MD5 hash.
|
149
|
+
# * +crc32c+ - Verify file content match using the CRC32c hash.
|
150
|
+
# * +all+ - Perform all available file content verification.
|
151
|
+
# * +none+ - Don't perform file content verification.
|
151
152
|
#
|
152
153
|
# === Returns
|
153
154
|
#
|
@@ -155,47 +156,51 @@ module Gcloud
|
|
155
156
|
#
|
156
157
|
# === Examples
|
157
158
|
#
|
158
|
-
# require "
|
159
|
+
# require "gcloud"
|
159
160
|
#
|
160
|
-
#
|
161
|
+
# gcloud = Gcloud.new
|
162
|
+
# storage = gcloud.storage
|
161
163
|
#
|
162
|
-
# bucket = storage.
|
164
|
+
# bucket = storage.bucket "my-bucket"
|
163
165
|
#
|
164
|
-
# file = bucket.
|
166
|
+
# file = bucket.file "path/to/my-file.ext"
|
165
167
|
# file.download "path/to/downloaded/file.ext"
|
166
168
|
#
|
167
169
|
# The download is verified by calculating the MD5 digest.
|
168
170
|
# The CRC32c digest can be used by passing :crc32c.
|
169
171
|
#
|
170
|
-
# require "
|
172
|
+
# require "gcloud"
|
171
173
|
#
|
172
|
-
#
|
174
|
+
# gcloud = Gcloud.new
|
175
|
+
# storage = gcloud.storage
|
173
176
|
#
|
174
|
-
# bucket = storage.
|
177
|
+
# bucket = storage.bucket "my-bucket"
|
175
178
|
#
|
176
|
-
# file = bucket.
|
179
|
+
# file = bucket.file "path/to/my-file.ext"
|
177
180
|
# file.download "path/to/downloaded/file.ext", verify: :crc32c
|
178
181
|
#
|
179
182
|
# Both the MD5 and CRC32c digest can be used by passing :all.
|
180
183
|
#
|
181
|
-
# require "
|
184
|
+
# require "gcloud"
|
182
185
|
#
|
183
|
-
#
|
186
|
+
# gcloud = Gcloud.new
|
187
|
+
# storage = gcloud.storage
|
184
188
|
#
|
185
|
-
# bucket = storage.
|
189
|
+
# bucket = storage.bucket "my-bucket"
|
186
190
|
#
|
187
|
-
# file = bucket.
|
191
|
+
# file = bucket.file "path/to/my-file.ext"
|
188
192
|
# file.download "path/to/downloaded/file.ext", verify: :all
|
189
193
|
#
|
190
194
|
# The download verification can be disabled by passing :none
|
191
195
|
#
|
192
|
-
# require "
|
196
|
+
# require "gcloud"
|
193
197
|
#
|
194
|
-
#
|
198
|
+
# gcloud = Gcloud.new
|
199
|
+
# storage = gcloud.storage
|
195
200
|
#
|
196
|
-
# bucket = storage.
|
201
|
+
# bucket = storage.bucket "my-bucket"
|
197
202
|
#
|
198
|
-
# file = bucket.
|
203
|
+
# file = bucket.file "path/to/my-file.ext"
|
199
204
|
# file.download "path/to/downloaded/file.ext", verify: :none
|
200
205
|
#
|
201
206
|
def download path, options = {}
|
@@ -223,23 +228,23 @@ module Gcloud
|
|
223
228
|
# If a bucket was provided in the first parameter, this contains the
|
224
229
|
# path to copy the file to in the given bucket. (+String+)
|
225
230
|
# +options+::
|
226
|
-
# An optional Hash for controlling additional
|
227
|
-
#
|
231
|
+
# An optional Hash for controlling additional behavior. (+Hash+)
|
232
|
+
# <code>options[:acl]</code>::
|
228
233
|
# A predefined set of access controls to apply to new file.
|
229
234
|
# (+String+)
|
230
235
|
#
|
231
236
|
# Acceptable values are:
|
232
237
|
# * +auth+, +auth_read+, +authenticated+, +authenticated_read+,
|
233
|
-
# +authenticatedRead
|
238
|
+
# +authenticatedRead+ - File owner gets OWNER access, and
|
234
239
|
# allAuthenticatedUsers get READER access.
|
235
|
-
# * +owner_full+, +bucketOwnerFullControl
|
240
|
+
# * +owner_full+, +bucketOwnerFullControl+ - File owner gets OWNER
|
236
241
|
# access, and project team owners get OWNER access.
|
237
|
-
# * +owner_read+, +bucketOwnerRead
|
242
|
+
# * +owner_read+, +bucketOwnerRead+ - File owner gets OWNER access, and
|
238
243
|
# project team owners get READER access.
|
239
|
-
# * +private
|
240
|
-
# * +project_private+, +projectPrivate
|
244
|
+
# * +private+ - File owner gets OWNER access.
|
245
|
+
# * +project_private+, +projectPrivate+ - File owner gets OWNER access,
|
241
246
|
# and project team members get access according to their roles.
|
242
|
-
# * +public+, +public_read+, +publicRead
|
247
|
+
# * +public+, +public_read+, +publicRead+ - File owner gets OWNER
|
243
248
|
# access, and allUsers get READER access.
|
244
249
|
#
|
245
250
|
# === Returns
|
@@ -250,24 +255,26 @@ module Gcloud
|
|
250
255
|
#
|
251
256
|
# The file can also be copied to a new path in the current bucket:
|
252
257
|
#
|
253
|
-
# require "
|
258
|
+
# require "gcloud"
|
254
259
|
#
|
255
|
-
#
|
260
|
+
# gcloud = Gcloud.new
|
261
|
+
# storage = gcloud.storage
|
256
262
|
#
|
257
|
-
# bucket = storage.
|
263
|
+
# bucket = storage.bucket "my-bucket"
|
258
264
|
#
|
259
|
-
# file = bucket.
|
265
|
+
# file = bucket.file "path/to/my-file.ext"
|
260
266
|
# file.copy "path/to/destination/file.ext"
|
261
267
|
#
|
262
268
|
# The file can also be copied to a different bucket:
|
263
269
|
#
|
264
|
-
# require "
|
270
|
+
# require "gcloud"
|
265
271
|
#
|
266
|
-
#
|
272
|
+
# gcloud = Gcloud.new
|
273
|
+
# storage = gcloud.storage
|
267
274
|
#
|
268
|
-
# bucket = storage.
|
275
|
+
# bucket = storage.bucket "my-bucket"
|
269
276
|
#
|
270
|
-
# file = bucket.
|
277
|
+
# file = bucket.file "path/to/my-file.ext"
|
271
278
|
# file.copy "new-destination-bucket",
|
272
279
|
# "path/to/destination/file.ext"
|
273
280
|
#
|
@@ -294,13 +301,14 @@ module Gcloud
|
|
294
301
|
#
|
295
302
|
# === Example
|
296
303
|
#
|
297
|
-
# require "
|
304
|
+
# require "gcloud"
|
298
305
|
#
|
299
|
-
#
|
306
|
+
# gcloud = Gcloud.new
|
307
|
+
# storage = gcloud.storage
|
300
308
|
#
|
301
|
-
# bucket = storage.
|
309
|
+
# bucket = storage.bucket "my-bucket"
|
302
310
|
#
|
303
|
-
# file = bucket.
|
311
|
+
# file = bucket.file "path/to/my-file.ext"
|
304
312
|
# file.delete
|
305
313
|
#
|
306
314
|
def delete
|
@@ -321,46 +329,77 @@ module Gcloud
|
|
321
329
|
# }[https://cloud.google.com/storage/docs/access-control#Signed-URLs]
|
322
330
|
# for more.
|
323
331
|
#
|
332
|
+
# Generating a URL requires service account credentials, either by
|
333
|
+
# connecting with a service account when calling Gcloud.storage, or by
|
334
|
+
# passing in the service account +issuer+ and +signing_key+ values. A
|
335
|
+
# SignedUrlUnavailable is raised if the service account credentials are
|
336
|
+
# missing. Service account credentials are acquired by following the steps
|
337
|
+
# in {Service Account Authentication}[
|
338
|
+
# https://cloud.google.com/storage/docs/authentication#service_accounts].
|
339
|
+
#
|
324
340
|
# === Parameters
|
325
341
|
#
|
326
342
|
# +options+::
|
327
|
-
# An optional Hash for controlling additional
|
328
|
-
#
|
343
|
+
# An optional Hash for controlling additional behavior. (+Hash+)
|
344
|
+
# <code>options[:method]</code>::
|
329
345
|
# The HTTP verb to be used with the signed URL. Signed URLs can be used
|
330
346
|
# with +GET+, +HEAD+, +PUT+, and +DELETE+ requests. Default is +GET+.
|
331
347
|
# (+String+)
|
332
|
-
#
|
348
|
+
# <code>options[:expires]</code>::
|
333
349
|
# The number of seconds until the URL expires. Default is 300/5 minutes.
|
334
350
|
# (+Integer+)
|
335
|
-
#
|
351
|
+
# <code>options[:content_type]</code>::
|
336
352
|
# When provided, the client (browser) must send this value in the
|
337
353
|
# HTTP header. e.g. +text/plain+ (+String+)
|
338
|
-
#
|
354
|
+
# <code>options[:content_md5]</code>::
|
339
355
|
# The MD5 digest value in base64. If you provide this in the string, the
|
340
356
|
# client (usually a browser) must provide this HTTP header with this
|
341
357
|
# same value in its request. (+String+)
|
358
|
+
# <code>options[:issuer]</code>::
|
359
|
+
# Service Account's Client Email. (+String+)
|
360
|
+
# <code>options[:signing_key]</code>::
|
361
|
+
# Service Account's Private Key. (+OpenSSL::PKey::RSA+ or +String+)
|
342
362
|
#
|
343
363
|
# === Examples
|
344
364
|
#
|
345
|
-
# require "gcloud
|
365
|
+
# require "gcloud"
|
346
366
|
#
|
347
|
-
#
|
367
|
+
# gcloud = Gcloud.new
|
368
|
+
# storage = gcloud.storage
|
348
369
|
#
|
349
|
-
# bucket = storage.
|
350
|
-
# file = bucket.
|
370
|
+
# bucket = storage.bucket "my-todo-app"
|
371
|
+
# file = bucket.file "avatars/heidi/400x400.png"
|
351
372
|
# shared_url = file.signed_url
|
352
373
|
#
|
353
374
|
# Any of the option parameters may be specified:
|
354
375
|
#
|
355
|
-
# require "gcloud
|
376
|
+
# require "gcloud"
|
356
377
|
#
|
357
|
-
#
|
378
|
+
# gcloud = Gcloud.new
|
379
|
+
# storage = gcloud.storage
|
358
380
|
#
|
359
|
-
# bucket = storage.
|
360
|
-
# file = bucket.
|
381
|
+
# bucket = storage.bucket "my-todo-app"
|
382
|
+
# file = bucket.file "avatars/heidi/400x400.png"
|
361
383
|
# shared_url = file.signed_url method: "GET",
|
362
384
|
# expires: 300 # 5 minutes from now
|
363
385
|
#
|
386
|
+
# Signed URLs require service account credentials. If you are not
|
387
|
+
# authenticated with a service account, those credentials can be passed in
|
388
|
+
# using the +issuer+ and +signing_key+ options. Although the private key
|
389
|
+
# can be passed as a string for convenience, creating and storing an
|
390
|
+
# instance of +OpenSSL::PKey::RSA+ is more efficient when making multiple
|
391
|
+
# calls to +signed_url+.
|
392
|
+
#
|
393
|
+
# require "gcloud/storage"
|
394
|
+
#
|
395
|
+
# storage = Gcloud.storage
|
396
|
+
#
|
397
|
+
# bucket = storage.bucket "my-todo-app"
|
398
|
+
# file = bucket.file "avatars/heidi/400x400.png"
|
399
|
+
# key = OpenSSL::PKey::RSA.new "-----BEGIN PRIVATE KEY-----\n..."
|
400
|
+
# shared_url = file.signed_url issuer: "service-account@gcloud.com",
|
401
|
+
# signing_key: key
|
402
|
+
#
|
364
403
|
def signed_url options = {}
|
365
404
|
ensure_connection!
|
366
405
|
signer = File::Signer.new self
|
@@ -382,12 +421,13 @@ module Gcloud
|
|
382
421
|
# Access to a file can be granted to a user by appending +"user-"+ to the
|
383
422
|
# email address:
|
384
423
|
#
|
385
|
-
# require "gcloud
|
424
|
+
# require "gcloud"
|
386
425
|
#
|
387
|
-
#
|
426
|
+
# gcloud = Gcloud.new
|
427
|
+
# storage = gcloud.storage
|
388
428
|
#
|
389
|
-
# bucket = storage.
|
390
|
-
# file = bucket.
|
429
|
+
# bucket = storage.bucket "my-todo-app"
|
430
|
+
# file = bucket.file "avatars/heidi/400x400.png"
|
391
431
|
#
|
392
432
|
# email = "heidi@example.net"
|
393
433
|
# file.acl.add_reader "user-#{email}"
|
@@ -395,12 +435,13 @@ module Gcloud
|
|
395
435
|
# Access to a file can be granted to a group by appending +"group-"+ to
|
396
436
|
# the email address:
|
397
437
|
#
|
398
|
-
# require "gcloud
|
438
|
+
# require "gcloud"
|
399
439
|
#
|
400
|
-
#
|
440
|
+
# gcloud = Gcloud.new
|
441
|
+
# storage = gcloud.storage
|
401
442
|
#
|
402
|
-
# bucket = storage.
|
403
|
-
# file = bucket.
|
443
|
+
# bucket = storage.bucket "my-todo-app"
|
444
|
+
# file = bucket.file "avatars/heidi/400x400.png"
|
404
445
|
#
|
405
446
|
# email = "authors@example.net"
|
406
447
|
# file.acl.add_reader "group-#{email}"
|
@@ -408,12 +449,13 @@ module Gcloud
|
|
408
449
|
# Access to a file can also be granted to a predefined list of
|
409
450
|
# permissions:
|
410
451
|
#
|
411
|
-
# require "gcloud
|
452
|
+
# require "gcloud"
|
412
453
|
#
|
413
|
-
#
|
454
|
+
# gcloud = Gcloud.new
|
455
|
+
# storage = gcloud.storage
|
414
456
|
#
|
415
|
-
# bucket = storage.
|
416
|
-
# file = bucket.
|
457
|
+
# bucket = storage.bucket "my-todo-app"
|
458
|
+
# file = bucket.file "avatars/heidi/400x400.png"
|
417
459
|
#
|
418
460
|
# file.acl.public!
|
419
461
|
#
|
@@ -489,21 +531,39 @@ module Gcloud
|
|
489
531
|
ext_path].join "\n"
|
490
532
|
end
|
491
533
|
|
492
|
-
def
|
493
|
-
|
534
|
+
def determine_signing_key options = {}
|
535
|
+
options[:signing_key] || options[:private_key] ||
|
536
|
+
@file.connection.credentials.signing_key
|
494
537
|
end
|
495
538
|
|
496
|
-
def
|
497
|
-
|
539
|
+
def determine_issuer options = {}
|
540
|
+
options[:issuer] || options[:client_email] ||
|
541
|
+
@file.connection.credentials.issuer
|
498
542
|
end
|
499
543
|
|
500
544
|
def signed_url options
|
501
545
|
options = apply_option_defaults options
|
502
|
-
|
503
|
-
|
546
|
+
|
547
|
+
i = determine_issuer options
|
548
|
+
s = determine_signing_key options
|
549
|
+
|
550
|
+
fail SignedUrlUnavailable unless i && s
|
551
|
+
|
552
|
+
sig = generate_signature s, options
|
553
|
+
generate_signed_url i, sig, options[:expires]
|
554
|
+
end
|
555
|
+
|
556
|
+
def generate_signature signing_key, options = {}
|
557
|
+
unless signing_key.respond_to? :sign
|
558
|
+
signing_key = OpenSSL::PKey::RSA.new signing_key
|
559
|
+
end
|
560
|
+
signing_key.sign OpenSSL::Digest::SHA256.new, signature_str(options)
|
561
|
+
end
|
562
|
+
|
563
|
+
def generate_signed_url issuer, signed_string, expires
|
504
564
|
signature = Base64.encode64(signed_string).gsub("\n", "")
|
505
565
|
"#{ext_url}?GoogleAccessId=#{CGI.escape issuer}" \
|
506
|
-
"&Expires=#{
|
566
|
+
"&Expires=#{expires}" \
|
507
567
|
"&Signature=#{CGI.escape signature}"
|
508
568
|
end
|
509
569
|
end
|
@@ -21,13 +21,14 @@ module Gcloud
|
|
21
21
|
#
|
22
22
|
# Represents a File's Access Control List.
|
23
23
|
#
|
24
|
-
# require "
|
24
|
+
# require "gcloud"
|
25
25
|
#
|
26
|
-
#
|
26
|
+
# gcloud = Gcloud.new
|
27
|
+
# storage = gcloud.storage
|
27
28
|
#
|
28
|
-
# bucket = storage.
|
29
|
+
# bucket = storage.bucket "my-bucket"
|
29
30
|
#
|
30
|
-
# file = bucket.
|
31
|
+
# file = bucket.file "path/to/my-file.ext"
|
31
32
|
# file.acl.readers.each { |reader| puts reader }
|
32
33
|
#
|
33
34
|
class Acl
|
@@ -64,13 +65,14 @@ module Gcloud
|
|
64
65
|
#
|
65
66
|
# === Example
|
66
67
|
#
|
67
|
-
# require "
|
68
|
+
# require "gcloud"
|
68
69
|
#
|
69
|
-
#
|
70
|
+
# gcloud = Gcloud.new
|
71
|
+
# storage = gcloud.storage
|
70
72
|
#
|
71
|
-
# bucket = storage.
|
73
|
+
# bucket = storage.bucket "my-bucket"
|
72
74
|
#
|
73
|
-
# file = bucket.
|
75
|
+
# file = bucket.file "path/to/my-file.ext"
|
74
76
|
# file.acl.refresh!
|
75
77
|
#
|
76
78
|
def refresh!
|
@@ -90,13 +92,14 @@ module Gcloud
|
|
90
92
|
#
|
91
93
|
# === Example
|
92
94
|
#
|
93
|
-
# require "
|
95
|
+
# require "gcloud"
|
94
96
|
#
|
95
|
-
#
|
97
|
+
# gcloud = Gcloud.new
|
98
|
+
# storage = gcloud.storage
|
96
99
|
#
|
97
|
-
# bucket = storage.
|
100
|
+
# bucket = storage.bucket "my-bucket"
|
98
101
|
#
|
99
|
-
# file = bucket.
|
102
|
+
# file = bucket.file "path/to/my-file.ext"
|
100
103
|
# file.acl.owners.each { |owner| puts owner }
|
101
104
|
#
|
102
105
|
def owners
|
@@ -113,13 +116,14 @@ module Gcloud
|
|
113
116
|
#
|
114
117
|
# === Example
|
115
118
|
#
|
116
|
-
# require "
|
119
|
+
# require "gcloud"
|
117
120
|
#
|
118
|
-
#
|
121
|
+
# gcloud = Gcloud.new
|
122
|
+
# storage = gcloud.storage
|
119
123
|
#
|
120
|
-
# bucket = storage.
|
124
|
+
# bucket = storage.bucket "my-bucket"
|
121
125
|
#
|
122
|
-
# file = bucket.
|
126
|
+
# file = bucket.file "path/to/my-file.ext"
|
123
127
|
# file.acl.writers.each { |writer| puts writer }
|
124
128
|
#
|
125
129
|
def writers
|
@@ -136,13 +140,14 @@ module Gcloud
|
|
136
140
|
#
|
137
141
|
# === Example
|
138
142
|
#
|
139
|
-
# require "
|
143
|
+
# require "gcloud"
|
140
144
|
#
|
141
|
-
#
|
145
|
+
# gcloud = Gcloud.new
|
146
|
+
# storage = gcloud.storage
|
142
147
|
#
|
143
|
-
# bucket = storage.
|
148
|
+
# bucket = storage.bucket "my-bucket"
|
144
149
|
#
|
145
|
-
# file = bucket.
|
150
|
+
# file = bucket.file "path/to/my-file.ext"
|
146
151
|
# file.acl.readers.each { |reader| puts reader }
|
147
152
|
#
|
148
153
|
def readers
|
@@ -169,8 +174,8 @@ module Gcloud
|
|
169
174
|
# * allAuthenticatedUsers
|
170
175
|
#
|
171
176
|
# +options+::
|
172
|
-
# An optional Hash for controlling additional
|
173
|
-
#
|
177
|
+
# An optional Hash for controlling additional behavior. (+Hash+)
|
178
|
+
# <code>options[:generation]</code>::
|
174
179
|
# When present, selects a specific revision of this object.
|
175
180
|
# Default is the latest version. (+Integer+)
|
176
181
|
#
|
@@ -179,26 +184,28 @@ module Gcloud
|
|
179
184
|
# Access to a file can be granted to a user by appending +"user-"+ to
|
180
185
|
# the email address:
|
181
186
|
#
|
182
|
-
# require "
|
187
|
+
# require "gcloud"
|
183
188
|
#
|
184
|
-
#
|
189
|
+
# gcloud = Gcloud.new
|
190
|
+
# storage = gcloud.storage
|
185
191
|
#
|
186
|
-
# bucket = storage.
|
192
|
+
# bucket = storage.bucket "my-bucket"
|
187
193
|
#
|
188
|
-
# file = bucket.
|
194
|
+
# file = bucket.file "path/to/my-file.ext"
|
189
195
|
# email = "heidi@example.net"
|
190
196
|
# file.acl.add_owner "user-#{email}"
|
191
197
|
#
|
192
198
|
# Access to a file can be granted to a group by appending +"group-"+ to
|
193
199
|
# the email address:
|
194
200
|
#
|
195
|
-
# require "
|
201
|
+
# require "gcloud"
|
196
202
|
#
|
197
|
-
#
|
203
|
+
# gcloud = Gcloud.new
|
204
|
+
# storage = gcloud.storage
|
198
205
|
#
|
199
|
-
# bucket = storage.
|
206
|
+
# bucket = storage.bucket "my-bucket"
|
200
207
|
#
|
201
|
-
# file = bucket.
|
208
|
+
# file = bucket.file "path/to/my-file.ext"
|
202
209
|
# email = "authors@example.net"
|
203
210
|
# file.acl.add_owner "group-#{email}"
|
204
211
|
#
|
@@ -232,8 +239,8 @@ module Gcloud
|
|
232
239
|
# * allAuthenticatedUsers
|
233
240
|
#
|
234
241
|
# +options+::
|
235
|
-
# An optional Hash for controlling additional
|
236
|
-
#
|
242
|
+
# An optional Hash for controlling additional behavior. (+Hash+)
|
243
|
+
# <code>options[:generation]</code>::
|
237
244
|
# When present, selects a specific revision of this object.
|
238
245
|
# Default is the latest version. (+Integer+)
|
239
246
|
#
|
@@ -242,26 +249,28 @@ module Gcloud
|
|
242
249
|
# Access to a file can be granted to a user by appending +"user-"+ to
|
243
250
|
# the email address:
|
244
251
|
#
|
245
|
-
# require "
|
252
|
+
# require "gcloud"
|
246
253
|
#
|
247
|
-
#
|
254
|
+
# gcloud = Gcloud.new
|
255
|
+
# storage = gcloud.storage
|
248
256
|
#
|
249
|
-
# bucket = storage.
|
257
|
+
# bucket = storage.bucket "my-bucket"
|
250
258
|
#
|
251
|
-
# file = bucket.
|
259
|
+
# file = bucket.file "path/to/my-file.ext"
|
252
260
|
# email = "heidi@example.net"
|
253
261
|
# file.acl.add_writer "user-#{email}"
|
254
262
|
#
|
255
263
|
# Access to a file can be granted to a group by appending +"group-"+ to
|
256
264
|
# the email address:
|
257
265
|
#
|
258
|
-
# require "
|
266
|
+
# require "gcloud"
|
259
267
|
#
|
260
|
-
#
|
268
|
+
# gcloud = Gcloud.new
|
269
|
+
# storage = gcloud.storage
|
261
270
|
#
|
262
|
-
# bucket = storage.
|
271
|
+
# bucket = storage.bucket "my-bucket"
|
263
272
|
#
|
264
|
-
# file = bucket.
|
273
|
+
# file = bucket.file "path/to/my-file.ext"
|
265
274
|
# email = "authors@example.net"
|
266
275
|
# file.acl.add_writer "group-#{email}"
|
267
276
|
#
|
@@ -295,8 +304,8 @@ module Gcloud
|
|
295
304
|
# * allAuthenticatedUsers
|
296
305
|
#
|
297
306
|
# +options+::
|
298
|
-
# An optional Hash for controlling additional
|
299
|
-
#
|
307
|
+
# An optional Hash for controlling additional behavior. (+Hash+)
|
308
|
+
# <code>options[:generation]</code>::
|
300
309
|
# When present, selects a specific revision of this object.
|
301
310
|
# Default is the latest version. (+Integer+)
|
302
311
|
#
|
@@ -305,26 +314,28 @@ module Gcloud
|
|
305
314
|
# Access to a file can be granted to a user by appending +"user-"+ to
|
306
315
|
# the email address:
|
307
316
|
#
|
308
|
-
# require "
|
317
|
+
# require "gcloud"
|
309
318
|
#
|
310
|
-
#
|
319
|
+
# gcloud = Gcloud.new
|
320
|
+
# storage = gcloud.storage
|
311
321
|
#
|
312
|
-
# bucket = storage.
|
322
|
+
# bucket = storage.bucket "my-bucket"
|
313
323
|
#
|
314
|
-
# file = bucket.
|
324
|
+
# file = bucket.file "path/to/my-file.ext"
|
315
325
|
# email = "heidi@example.net"
|
316
326
|
# file.acl.add_reader "user-#{email}"
|
317
327
|
#
|
318
328
|
# Access to a file can be granted to a group by appending +"group-"+ to
|
319
329
|
# the email address:
|
320
330
|
#
|
321
|
-
# require "
|
331
|
+
# require "gcloud"
|
322
332
|
#
|
323
|
-
#
|
333
|
+
# gcloud = Gcloud.new
|
334
|
+
# storage = gcloud.storage
|
324
335
|
#
|
325
|
-
# bucket = storage.
|
336
|
+
# bucket = storage.bucket "my-bucket"
|
326
337
|
#
|
327
|
-
# file = bucket.
|
338
|
+
# file = bucket.file "path/to/my-file.ext"
|
328
339
|
# email = "authors@example.net"
|
329
340
|
# file.acl.add_reader "group-#{email}"
|
330
341
|
#
|
@@ -358,20 +369,21 @@ module Gcloud
|
|
358
369
|
# * allAuthenticatedUsers
|
359
370
|
#
|
360
371
|
# +options+::
|
361
|
-
# An optional Hash for controlling additional
|
362
|
-
#
|
372
|
+
# An optional Hash for controlling additional behavior. (+Hash+)
|
373
|
+
# <code>options[:generation]</code>::
|
363
374
|
# When present, selects a specific revision of this object.
|
364
375
|
# Default is the latest version. (+Integer+)
|
365
376
|
#
|
366
377
|
# === Example
|
367
378
|
#
|
368
|
-
# require "
|
379
|
+
# require "gcloud"
|
369
380
|
#
|
370
|
-
#
|
381
|
+
# gcloud = Gcloud.new
|
382
|
+
# storage = gcloud.storage
|
371
383
|
#
|
372
|
-
# bucket = storage.
|
384
|
+
# bucket = storage.bucket "my-bucket"
|
373
385
|
#
|
374
|
-
# file = bucket.
|
386
|
+
# file = bucket.file "path/to/my-file.ext"
|
375
387
|
# email = "heidi@example.net"
|
376
388
|
# file.acl.delete "user-#{email}"
|
377
389
|
#
|
@@ -398,13 +410,14 @@ module Gcloud
|
|
398
410
|
#
|
399
411
|
# === Example
|
400
412
|
#
|
401
|
-
# require "
|
413
|
+
# require "gcloud"
|
402
414
|
#
|
403
|
-
#
|
415
|
+
# gcloud = Gcloud.new
|
416
|
+
# storage = gcloud.storage
|
404
417
|
#
|
405
|
-
# bucket = storage.
|
418
|
+
# bucket = storage.bucket "my-bucket"
|
406
419
|
#
|
407
|
-
# file = bucket.
|
420
|
+
# file = bucket.file "path/to/my-file.ext"
|
408
421
|
# file.acl.auth!
|
409
422
|
#
|
410
423
|
def auth!
|
@@ -421,13 +434,14 @@ module Gcloud
|
|
421
434
|
#
|
422
435
|
# === Example
|
423
436
|
#
|
424
|
-
# require "
|
437
|
+
# require "gcloud"
|
425
438
|
#
|
426
|
-
#
|
439
|
+
# gcloud = Gcloud.new
|
440
|
+
# storage = gcloud.storage
|
427
441
|
#
|
428
|
-
# bucket = storage.
|
442
|
+
# bucket = storage.bucket "my-bucket"
|
429
443
|
#
|
430
|
-
# file = bucket.
|
444
|
+
# file = bucket.file "path/to/my-file.ext"
|
431
445
|
# file.acl.owner_full!
|
432
446
|
#
|
433
447
|
def owner_full!
|
@@ -441,13 +455,14 @@ module Gcloud
|
|
441
455
|
#
|
442
456
|
# === Example
|
443
457
|
#
|
444
|
-
# require "
|
458
|
+
# require "gcloud"
|
445
459
|
#
|
446
|
-
#
|
460
|
+
# gcloud = Gcloud.new
|
461
|
+
# storage = gcloud.storage
|
447
462
|
#
|
448
|
-
# bucket = storage.
|
463
|
+
# bucket = storage.bucket "my-bucket"
|
449
464
|
#
|
450
|
-
# file = bucket.
|
465
|
+
# file = bucket.file "path/to/my-file.ext"
|
451
466
|
# file.acl.owner_read!
|
452
467
|
#
|
453
468
|
def owner_read!
|
@@ -461,13 +476,14 @@ module Gcloud
|
|
461
476
|
#
|
462
477
|
# === Example
|
463
478
|
#
|
464
|
-
# require "
|
479
|
+
# require "gcloud"
|
465
480
|
#
|
466
|
-
#
|
481
|
+
# gcloud = Gcloud.new
|
482
|
+
# storage = gcloud.storage
|
467
483
|
#
|
468
|
-
# bucket = storage.
|
484
|
+
# bucket = storage.bucket "my-bucket"
|
469
485
|
#
|
470
|
-
# file = bucket.
|
486
|
+
# file = bucket.file "path/to/my-file.ext"
|
471
487
|
# file.acl.private!
|
472
488
|
#
|
473
489
|
def private!
|
@@ -480,13 +496,14 @@ module Gcloud
|
|
480
496
|
#
|
481
497
|
# === Example
|
482
498
|
#
|
483
|
-
# require "
|
499
|
+
# require "gcloud"
|
484
500
|
#
|
485
|
-
#
|
501
|
+
# gcloud = Gcloud.new
|
502
|
+
# storage = gcloud.storage
|
486
503
|
#
|
487
|
-
# bucket = storage.
|
504
|
+
# bucket = storage.bucket "my-bucket"
|
488
505
|
#
|
489
|
-
# file = bucket.
|
506
|
+
# file = bucket.file "path/to/my-file.ext"
|
490
507
|
# file.acl.project_private!
|
491
508
|
#
|
492
509
|
def project_private!
|
@@ -500,13 +517,14 @@ module Gcloud
|
|
500
517
|
#
|
501
518
|
# === Example
|
502
519
|
#
|
503
|
-
# require "
|
520
|
+
# require "gcloud"
|
504
521
|
#
|
505
|
-
#
|
522
|
+
# gcloud = Gcloud.new
|
523
|
+
# storage = gcloud.storage
|
506
524
|
#
|
507
|
-
# bucket = storage.
|
525
|
+
# bucket = storage.bucket "my-bucket"
|
508
526
|
#
|
509
|
-
# file = bucket.
|
527
|
+
# file = bucket.file "path/to/my-file.ext"
|
510
528
|
# file.acl.public!
|
511
529
|
#
|
512
530
|
def public!
|