gcloud 0.6.3 → 0.7.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 +13 -9
- data/CHANGELOG.md +8 -3
- data/OVERVIEW.md +46 -8
- data/lib/gcloud.rb +123 -117
- data/lib/gcloud/backoff.rb +43 -15
- data/lib/gcloud/bigquery.rb +211 -195
- data/lib/gcloud/bigquery/connection.rb +9 -9
- data/lib/gcloud/bigquery/copy_job.rb +15 -16
- data/lib/gcloud/bigquery/credentials.rb +3 -3
- data/lib/gcloud/bigquery/data.rb +12 -11
- data/lib/gcloud/bigquery/dataset.rb +162 -216
- data/lib/gcloud/bigquery/dataset/access.rb +59 -43
- data/lib/gcloud/bigquery/dataset/list.rb +3 -3
- data/lib/gcloud/bigquery/errors.rb +9 -5
- data/lib/gcloud/bigquery/extract_job.rb +18 -18
- data/lib/gcloud/bigquery/insert_response.rb +7 -4
- data/lib/gcloud/bigquery/job.rb +48 -44
- data/lib/gcloud/bigquery/job/list.rb +3 -3
- data/lib/gcloud/bigquery/load_job.rb +24 -25
- data/lib/gcloud/bigquery/project.rb +145 -204
- data/lib/gcloud/bigquery/query_data.rb +10 -9
- data/lib/gcloud/bigquery/query_job.rb +23 -32
- data/lib/gcloud/bigquery/table.rb +238 -280
- data/lib/gcloud/bigquery/table/list.rb +3 -3
- data/lib/gcloud/bigquery/table/schema.rb +79 -87
- data/lib/gcloud/bigquery/view.rb +69 -82
- data/lib/gcloud/credentials.rb +3 -9
- data/lib/gcloud/datastore.rb +194 -170
- data/lib/gcloud/datastore/connection.rb +12 -8
- data/lib/gcloud/datastore/credentials.rb +6 -4
- data/lib/gcloud/datastore/dataset.rb +74 -141
- data/lib/gcloud/datastore/dataset/lookup_results.rb +6 -4
- data/lib/gcloud/datastore/dataset/query_results.rb +6 -4
- data/lib/gcloud/datastore/entity.rb +81 -76
- data/lib/gcloud/datastore/errors.rb +10 -8
- data/lib/gcloud/datastore/key.rb +41 -77
- data/lib/gcloud/datastore/properties.rb +3 -3
- data/lib/gcloud/datastore/proto.rb +7 -4
- data/lib/gcloud/datastore/query.rb +26 -3
- data/lib/gcloud/datastore/transaction.rb +12 -8
- data/lib/gcloud/dns.rb +180 -152
- data/lib/gcloud/dns/change.rb +16 -16
- data/lib/gcloud/dns/change/list.rb +3 -3
- data/lib/gcloud/dns/connection.rb +9 -10
- data/lib/gcloud/dns/credentials.rb +3 -3
- data/lib/gcloud/dns/errors.rb +9 -5
- data/lib/gcloud/dns/importer.rb +17 -23
- data/lib/gcloud/dns/project.rb +42 -64
- data/lib/gcloud/dns/record.rb +58 -46
- data/lib/gcloud/dns/record/list.rb +6 -7
- data/lib/gcloud/dns/zone.rb +198 -289
- data/lib/gcloud/dns/zone/list.rb +3 -3
- data/lib/gcloud/dns/zone/transaction.rb +56 -72
- data/lib/gcloud/errors.rb +174 -3
- data/lib/gcloud/gce.rb +3 -4
- data/lib/gcloud/grpc_utils.rb +76 -0
- data/lib/gcloud/logging.rb +308 -0
- data/lib/gcloud/logging/credentials.rb +29 -0
- data/lib/gcloud/logging/entry.rb +303 -0
- data/lib/gcloud/logging/entry/http_request.rb +141 -0
- data/lib/gcloud/logging/entry/list.rb +111 -0
- data/lib/gcloud/logging/entry/operation.rb +90 -0
- data/lib/gcloud/logging/logger.rb +307 -0
- data/lib/gcloud/logging/metric.rb +175 -0
- data/lib/gcloud/logging/metric/list.rb +98 -0
- data/lib/gcloud/logging/project.rb +650 -0
- data/lib/gcloud/logging/resource.rb +95 -0
- data/lib/gcloud/logging/resource_descriptor.rb +140 -0
- data/lib/gcloud/logging/resource_descriptor/list.rb +78 -0
- data/lib/gcloud/logging/service.rb +258 -0
- data/lib/gcloud/logging/sink.rb +233 -0
- data/lib/gcloud/logging/sink/list.rb +97 -0
- data/lib/gcloud/pubsub.rb +241 -199
- data/lib/gcloud/pubsub/credentials.rb +3 -3
- data/lib/gcloud/pubsub/message.rb +26 -20
- data/lib/gcloud/pubsub/project.rb +166 -233
- data/lib/gcloud/pubsub/received_message.rb +28 -38
- data/lib/gcloud/pubsub/service.rb +323 -0
- data/lib/gcloud/pubsub/subscription.rb +172 -242
- data/lib/gcloud/pubsub/subscription/list.rb +11 -9
- data/lib/gcloud/pubsub/topic.rb +152 -271
- data/lib/gcloud/pubsub/topic/batch.rb +66 -0
- data/lib/gcloud/pubsub/topic/list.rb +9 -7
- data/lib/gcloud/resource_manager.rb +158 -138
- data/lib/gcloud/resource_manager/connection.rb +6 -5
- data/lib/gcloud/resource_manager/credentials.rb +3 -3
- data/lib/gcloud/resource_manager/errors.rb +9 -5
- data/lib/gcloud/resource_manager/manager.rb +54 -86
- data/lib/gcloud/resource_manager/project.rb +69 -88
- data/lib/gcloud/resource_manager/project/list.rb +4 -5
- data/lib/gcloud/resource_manager/project/updater.rb +12 -14
- data/lib/gcloud/search.rb +158 -135
- data/lib/gcloud/search/api_client.rb +7 -7
- data/lib/gcloud/search/connection.rb +8 -8
- data/lib/gcloud/search/credentials.rb +3 -3
- data/lib/gcloud/search/document.rb +64 -87
- data/lib/gcloud/search/document/list.rb +5 -5
- data/lib/gcloud/search/errors.rb +9 -5
- data/lib/gcloud/search/field_value.rb +32 -38
- data/lib/gcloud/search/field_values.rb +50 -80
- data/lib/gcloud/search/fields.rb +44 -65
- data/lib/gcloud/search/index.rb +163 -204
- data/lib/gcloud/search/index/list.rb +5 -5
- data/lib/gcloud/search/project.rb +31 -47
- data/lib/gcloud/search/result.rb +27 -31
- data/lib/gcloud/search/result/list.rb +6 -6
- data/lib/gcloud/storage.rb +224 -190
- data/lib/gcloud/storage/bucket.rb +202 -227
- data/lib/gcloud/storage/bucket/acl.rb +83 -170
- data/lib/gcloud/storage/bucket/cors.rb +31 -34
- data/lib/gcloud/storage/bucket/list.rb +3 -3
- data/lib/gcloud/storage/connection.rb +11 -7
- data/lib/gcloud/storage/credentials.rb +3 -3
- data/lib/gcloud/storage/errors.rb +11 -8
- data/lib/gcloud/storage/file.rb +129 -171
- data/lib/gcloud/storage/file/acl.rb +51 -99
- data/lib/gcloud/storage/file/list.rb +3 -3
- data/lib/gcloud/storage/file/verifier.rb +3 -2
- data/lib/gcloud/storage/project.rb +111 -132
- data/lib/gcloud/upload.rb +4 -7
- data/lib/gcloud/version.rb +2 -4
- data/lib/google/api/annotations.rb +14 -0
- data/lib/google/api/http.rb +30 -0
- data/lib/google/api/label.rb +24 -0
- data/lib/google/api/monitored_resource.rb +25 -0
- data/lib/google/datastore/v1beta3/datastore.rb +115 -0
- data/lib/google/datastore/v1beta3/datastore_services.rb +33 -0
- data/lib/google/datastore/v1beta3/entity.rb +63 -0
- data/lib/google/datastore/v1beta3/query.rb +128 -0
- data/lib/google/devtools/cloudtrace/v1/trace.rb +78 -0
- data/lib/google/devtools/cloudtrace/v1/trace_services.rb +32 -0
- data/lib/google/example/library/v1/library.rb +91 -0
- data/lib/google/example/library/v1/library_services.rb +40 -0
- data/lib/google/iam/v1/iam_policy.rb +33 -0
- data/lib/google/iam/v1/iam_policy_services.rb +30 -0
- data/lib/google/iam/v1/policy.rb +25 -0
- data/lib/google/logging/type/http_request.rb +28 -0
- data/lib/google/logging/type/log_severity.rb +27 -0
- data/lib/google/logging/v2/log_entry.rb +44 -0
- data/lib/google/logging/v2/logging.rb +56 -0
- data/lib/google/logging/v2/logging_config.rb +59 -0
- data/lib/google/logging/v2/logging_config_services.rb +32 -0
- data/lib/google/logging/v2/logging_metrics.rb +51 -0
- data/lib/google/logging/v2/logging_metrics_services.rb +32 -0
- data/lib/google/logging/v2/logging_services.rb +31 -0
- data/lib/google/longrunning/operations.rb +50 -0
- data/lib/google/longrunning/operations_services.rb +29 -0
- data/lib/google/protobuf/any.rb +17 -0
- data/lib/google/protobuf/api.rb +31 -0
- data/lib/google/protobuf/descriptor.rb +0 -0
- data/lib/google/protobuf/duration.rb +17 -0
- data/lib/google/protobuf/empty.rb +15 -0
- data/lib/google/protobuf/field_mask.rb +16 -0
- data/lib/google/protobuf/source_context.rb +16 -0
- data/lib/google/protobuf/struct.rb +35 -0
- data/lib/google/protobuf/timestamp.rb +17 -0
- data/lib/google/protobuf/type.rb +79 -0
- data/lib/google/protobuf/wrappers.rb +48 -0
- data/lib/google/pubsub/v1/pubsub.rb +129 -0
- data/lib/google/pubsub/v1/pubsub_services.rb +56 -0
- data/lib/google/pubsub/v1beta2/pubsub.rb +126 -0
- data/lib/google/pubsub/v1beta2/pubsub_services.rb +56 -0
- data/lib/google/rpc/code.rb +32 -0
- data/lib/google/rpc/error_details.rb +61 -0
- data/lib/google/rpc/status.rb +19 -0
- data/lib/google/type/color.rb +20 -0
- data/lib/google/type/date.rb +18 -0
- data/lib/google/type/dayofweek.rb +23 -0
- data/lib/google/type/latlng.rb +17 -0
- data/lib/google/type/money.rb +18 -0
- data/lib/google/type/timeofday.rb +19 -0
- metadata +101 -4
- data/lib/gcloud/pubsub/connection.rb +0 -295
- data/lib/gcloud/pubsub/errors.rb +0 -93
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#--
|
|
2
1
|
# Copyright 2015 Google Inc. All rights reserved.
|
|
3
2
|
#
|
|
4
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,14 +12,16 @@
|
|
|
13
12
|
# See the License for the specific language governing permissions and
|
|
14
13
|
# limitations under the License.
|
|
15
14
|
|
|
15
|
+
|
|
16
16
|
module Gcloud
|
|
17
17
|
module Storage
|
|
18
18
|
class Bucket
|
|
19
19
|
##
|
|
20
|
-
#
|
|
20
|
+
# # Bucket Access Control List
|
|
21
21
|
#
|
|
22
22
|
# Represents a Bucket's Access Control List.
|
|
23
23
|
#
|
|
24
|
+
# @example
|
|
24
25
|
# require "gcloud"
|
|
25
26
|
#
|
|
26
27
|
# gcloud = Gcloud.new
|
|
@@ -31,6 +32,7 @@ module Gcloud
|
|
|
31
32
|
# bucket.acl.readers.each { |reader| puts reader }
|
|
32
33
|
#
|
|
33
34
|
class Acl
|
|
35
|
+
# @private
|
|
34
36
|
RULES = { "authenticatedRead" => "authenticatedRead",
|
|
35
37
|
"auth" => "authenticatedRead",
|
|
36
38
|
"auth_read" => "authenticatedRead",
|
|
@@ -44,12 +46,12 @@ module Gcloud
|
|
|
44
46
|
"public" => "publicRead",
|
|
45
47
|
"public_read" => "publicRead",
|
|
46
48
|
"publicReadWrite" => "publicReadWrite",
|
|
47
|
-
"public_write" => "publicReadWrite" }
|
|
49
|
+
"public_write" => "publicReadWrite" }
|
|
48
50
|
|
|
49
51
|
##
|
|
50
|
-
# Initialized a new Acl object.
|
|
52
|
+
# @private Initialized a new Acl object.
|
|
51
53
|
# Must provide a valid Bucket object.
|
|
52
|
-
def initialize bucket
|
|
54
|
+
def initialize bucket
|
|
53
55
|
@bucket = bucket.name
|
|
54
56
|
@connection = bucket.connection
|
|
55
57
|
@owners = nil
|
|
@@ -60,8 +62,7 @@ module Gcloud
|
|
|
60
62
|
##
|
|
61
63
|
# Reloads all Access Control List data for the bucket.
|
|
62
64
|
#
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
+
# @example
|
|
65
66
|
# require "gcloud"
|
|
66
67
|
#
|
|
67
68
|
# gcloud = Gcloud.new
|
|
@@ -83,12 +84,9 @@ module Gcloud
|
|
|
83
84
|
##
|
|
84
85
|
# Lists the owners of the bucket.
|
|
85
86
|
#
|
|
86
|
-
#
|
|
87
|
-
#
|
|
88
|
-
# Array of Strings
|
|
89
|
-
#
|
|
90
|
-
# === Example
|
|
87
|
+
# @return [Array<String>]
|
|
91
88
|
#
|
|
89
|
+
# @example
|
|
92
90
|
# require "gcloud"
|
|
93
91
|
#
|
|
94
92
|
# gcloud = Gcloud.new
|
|
@@ -106,12 +104,9 @@ module Gcloud
|
|
|
106
104
|
##
|
|
107
105
|
# Lists the owners of the bucket.
|
|
108
106
|
#
|
|
109
|
-
#
|
|
110
|
-
#
|
|
111
|
-
# Array of Strings
|
|
112
|
-
#
|
|
113
|
-
# === Example
|
|
107
|
+
# @return [Array<String>]
|
|
114
108
|
#
|
|
109
|
+
# @example
|
|
115
110
|
# require "gcloud"
|
|
116
111
|
#
|
|
117
112
|
# gcloud = Gcloud.new
|
|
@@ -129,12 +124,9 @@ module Gcloud
|
|
|
129
124
|
##
|
|
130
125
|
# Lists the readers of the bucket.
|
|
131
126
|
#
|
|
132
|
-
#
|
|
133
|
-
#
|
|
134
|
-
# Array of Strings
|
|
135
|
-
#
|
|
136
|
-
# === Example
|
|
127
|
+
# @return [Array<String>]
|
|
137
128
|
#
|
|
129
|
+
# @example
|
|
138
130
|
# require "gcloud"
|
|
139
131
|
#
|
|
140
132
|
# gcloud = Gcloud.new
|
|
@@ -152,11 +144,8 @@ module Gcloud
|
|
|
152
144
|
##
|
|
153
145
|
# Grants owner permission to the bucket.
|
|
154
146
|
#
|
|
155
|
-
#
|
|
156
|
-
#
|
|
157
|
-
# +entity+::
|
|
158
|
-
# The entity holding the permission, in one of the following forms:
|
|
159
|
-
# (+String+)
|
|
147
|
+
# @param [String] entity The entity holding the permission, in one of
|
|
148
|
+
# the following forms:
|
|
160
149
|
#
|
|
161
150
|
# * user-userId
|
|
162
151
|
# * user-email
|
|
@@ -167,11 +156,7 @@ module Gcloud
|
|
|
167
156
|
# * allUsers
|
|
168
157
|
# * allAuthenticatedUsers
|
|
169
158
|
#
|
|
170
|
-
#
|
|
171
|
-
#
|
|
172
|
-
# Access to a bucket can be granted to a user by appending +"user-"+ to
|
|
173
|
-
# the email address:
|
|
174
|
-
#
|
|
159
|
+
# @example Grant access to a user by pre-pending `"user-"` to an email:
|
|
175
160
|
# require "gcloud"
|
|
176
161
|
#
|
|
177
162
|
# gcloud = Gcloud.new
|
|
@@ -182,9 +167,7 @@ module Gcloud
|
|
|
182
167
|
# email = "heidi@example.net"
|
|
183
168
|
# bucket.acl.add_owner "user-#{email}"
|
|
184
169
|
#
|
|
185
|
-
#
|
|
186
|
-
# to the email address:
|
|
187
|
-
#
|
|
170
|
+
# @example Grant access to a group by pre-pending `"group-"` to an email
|
|
188
171
|
# require "gcloud"
|
|
189
172
|
#
|
|
190
173
|
# gcloud = Gcloud.new
|
|
@@ -208,11 +191,8 @@ module Gcloud
|
|
|
208
191
|
##
|
|
209
192
|
# Grants writer permission to the bucket.
|
|
210
193
|
#
|
|
211
|
-
#
|
|
212
|
-
#
|
|
213
|
-
# +entity+::
|
|
214
|
-
# The entity holding the permission, in one of the following forms:
|
|
215
|
-
# (+String+)
|
|
194
|
+
# @param [String] entity The entity holding the permission, in one of
|
|
195
|
+
# the following forms:
|
|
216
196
|
#
|
|
217
197
|
# * user-userId
|
|
218
198
|
# * user-email
|
|
@@ -223,11 +203,7 @@ module Gcloud
|
|
|
223
203
|
# * allUsers
|
|
224
204
|
# * allAuthenticatedUsers
|
|
225
205
|
#
|
|
226
|
-
#
|
|
227
|
-
#
|
|
228
|
-
# Access to a bucket can be granted to a user by appending +"user-"+ to
|
|
229
|
-
# the email address:
|
|
230
|
-
#
|
|
206
|
+
# @example Grant access to a user by pre-pending `"user-"` to an email:
|
|
231
207
|
# require "gcloud"
|
|
232
208
|
#
|
|
233
209
|
# gcloud = Gcloud.new
|
|
@@ -238,9 +214,7 @@ module Gcloud
|
|
|
238
214
|
# email = "heidi@example.net"
|
|
239
215
|
# bucket.acl.add_writer "user-#{email}"
|
|
240
216
|
#
|
|
241
|
-
#
|
|
242
|
-
# to the email address:
|
|
243
|
-
#
|
|
217
|
+
# @example Grant access to a group by pre-pending `"group-"` to an email
|
|
244
218
|
# require "gcloud"
|
|
245
219
|
#
|
|
246
220
|
# gcloud = Gcloud.new
|
|
@@ -264,11 +238,8 @@ module Gcloud
|
|
|
264
238
|
##
|
|
265
239
|
# Grants reader permission to the bucket.
|
|
266
240
|
#
|
|
267
|
-
#
|
|
268
|
-
#
|
|
269
|
-
# +entity+::
|
|
270
|
-
# The entity holding the permission, in one of the following forms:
|
|
271
|
-
# (+String+)
|
|
241
|
+
# @param [String] entity The entity holding the permission, in one of
|
|
242
|
+
# the following forms:
|
|
272
243
|
#
|
|
273
244
|
# * user-userId
|
|
274
245
|
# * user-email
|
|
@@ -279,11 +250,7 @@ module Gcloud
|
|
|
279
250
|
# * allUsers
|
|
280
251
|
# * allAuthenticatedUsers
|
|
281
252
|
#
|
|
282
|
-
#
|
|
283
|
-
#
|
|
284
|
-
# Access to a bucket can be granted to a user by appending +"user-"+ to
|
|
285
|
-
# the email address:
|
|
286
|
-
#
|
|
253
|
+
# @example Grant access to a user by pre-pending `"user-"` to an email:
|
|
287
254
|
# require "gcloud"
|
|
288
255
|
#
|
|
289
256
|
# gcloud = Gcloud.new
|
|
@@ -294,9 +261,7 @@ module Gcloud
|
|
|
294
261
|
# email = "heidi@example.net"
|
|
295
262
|
# bucket.acl.add_reader "user-#{email}"
|
|
296
263
|
#
|
|
297
|
-
#
|
|
298
|
-
# to the email address:
|
|
299
|
-
#
|
|
264
|
+
# @example Grant access to a group by pre-pending `"group-"` to an email
|
|
300
265
|
# require "gcloud"
|
|
301
266
|
#
|
|
302
267
|
# gcloud = Gcloud.new
|
|
@@ -320,11 +285,8 @@ module Gcloud
|
|
|
320
285
|
##
|
|
321
286
|
# Permanently deletes the entity from the bucket's access control list.
|
|
322
287
|
#
|
|
323
|
-
#
|
|
324
|
-
#
|
|
325
|
-
# +entity+::
|
|
326
|
-
# The entity holding the permission, in one of the following forms:
|
|
327
|
-
# (+String+)
|
|
288
|
+
# @param [String] entity The entity holding the permission, in one of
|
|
289
|
+
# the following forms:
|
|
328
290
|
#
|
|
329
291
|
# * user-userId
|
|
330
292
|
# * user-email
|
|
@@ -335,8 +297,7 @@ module Gcloud
|
|
|
335
297
|
# * allUsers
|
|
336
298
|
# * allAuthenticatedUsers
|
|
337
299
|
#
|
|
338
|
-
#
|
|
339
|
-
#
|
|
300
|
+
# @example
|
|
340
301
|
# require "gcloud"
|
|
341
302
|
#
|
|
342
303
|
# gcloud = Gcloud.new
|
|
@@ -358,18 +319,18 @@ module Gcloud
|
|
|
358
319
|
false
|
|
359
320
|
end
|
|
360
321
|
|
|
361
|
-
|
|
322
|
+
# @private
|
|
323
|
+
def self.predefined_rule_for rule_name
|
|
362
324
|
RULES[rule_name.to_s]
|
|
363
325
|
end
|
|
364
326
|
|
|
365
327
|
# Predefined ACL helpers
|
|
366
328
|
|
|
367
329
|
##
|
|
368
|
-
# Convenience method to apply the
|
|
330
|
+
# Convenience method to apply the `authenticatedRead` predefined ACL
|
|
369
331
|
# rule to the bucket.
|
|
370
332
|
#
|
|
371
|
-
#
|
|
372
|
-
#
|
|
333
|
+
# @example
|
|
373
334
|
# require "gcloud"
|
|
374
335
|
#
|
|
375
336
|
# gcloud = Gcloud.new
|
|
@@ -388,11 +349,10 @@ module Gcloud
|
|
|
388
349
|
alias_method :authenticated_read!, :auth!
|
|
389
350
|
|
|
390
351
|
##
|
|
391
|
-
# Convenience method to apply the
|
|
352
|
+
# Convenience method to apply the `private` predefined ACL
|
|
392
353
|
# rule to the bucket.
|
|
393
354
|
#
|
|
394
|
-
#
|
|
395
|
-
#
|
|
355
|
+
# @example
|
|
396
356
|
# require "gcloud"
|
|
397
357
|
#
|
|
398
358
|
# gcloud = Gcloud.new
|
|
@@ -407,11 +367,10 @@ module Gcloud
|
|
|
407
367
|
end
|
|
408
368
|
|
|
409
369
|
##
|
|
410
|
-
# Convenience method to apply the
|
|
370
|
+
# Convenience method to apply the `projectPrivate` predefined ACL
|
|
411
371
|
# rule to the bucket.
|
|
412
372
|
#
|
|
413
|
-
#
|
|
414
|
-
#
|
|
373
|
+
# @example
|
|
415
374
|
# require "gcloud"
|
|
416
375
|
#
|
|
417
376
|
# gcloud = Gcloud.new
|
|
@@ -427,11 +386,10 @@ module Gcloud
|
|
|
427
386
|
alias_method :projectPrivate!, :project_private!
|
|
428
387
|
|
|
429
388
|
##
|
|
430
|
-
# Convenience method to apply the
|
|
389
|
+
# Convenience method to apply the `publicRead` predefined ACL
|
|
431
390
|
# rule to the bucket.
|
|
432
391
|
#
|
|
433
|
-
#
|
|
434
|
-
#
|
|
392
|
+
# @example
|
|
435
393
|
# require "gcloud"
|
|
436
394
|
#
|
|
437
395
|
# gcloud = Gcloud.new
|
|
@@ -447,11 +405,10 @@ module Gcloud
|
|
|
447
405
|
alias_method :publicRead!, :public!
|
|
448
406
|
alias_method :public_read!, :public!
|
|
449
407
|
|
|
450
|
-
# Convenience method to apply the
|
|
408
|
+
# Convenience method to apply the `publicReadWrite` predefined ACL
|
|
451
409
|
# rule to the bucket.
|
|
452
410
|
#
|
|
453
|
-
#
|
|
454
|
-
#
|
|
411
|
+
# @example
|
|
455
412
|
# require "gcloud"
|
|
456
413
|
#
|
|
457
414
|
# gcloud = Gcloud.new
|
|
@@ -492,10 +449,11 @@ module Gcloud
|
|
|
492
449
|
end
|
|
493
450
|
|
|
494
451
|
##
|
|
495
|
-
#
|
|
452
|
+
# # Bucket Default Access Control List
|
|
496
453
|
#
|
|
497
454
|
# Represents a Bucket's Default Access Control List.
|
|
498
455
|
#
|
|
456
|
+
# @example
|
|
499
457
|
# require "gcloud"
|
|
500
458
|
#
|
|
501
459
|
# gcloud = Gcloud.new
|
|
@@ -506,6 +464,7 @@ module Gcloud
|
|
|
506
464
|
# bucket.default_acl.readers.each { |reader| puts reader }
|
|
507
465
|
#
|
|
508
466
|
class DefaultAcl
|
|
467
|
+
# @private
|
|
509
468
|
RULES = { "authenticatedRead" => "authenticatedRead",
|
|
510
469
|
"auth" => "authenticatedRead",
|
|
511
470
|
"auth_read" => "authenticatedRead",
|
|
@@ -520,12 +479,12 @@ module Gcloud
|
|
|
520
479
|
"project_private" => "projectPrivate",
|
|
521
480
|
"publicRead" => "publicRead",
|
|
522
481
|
"public" => "publicRead",
|
|
523
|
-
"public_read" => "publicRead" }
|
|
482
|
+
"public_read" => "publicRead" }
|
|
524
483
|
|
|
525
484
|
##
|
|
526
|
-
# Initialized a new DefaultAcl object.
|
|
485
|
+
# @private Initialized a new DefaultAcl object.
|
|
527
486
|
# Must provide a valid Bucket object.
|
|
528
|
-
def initialize bucket
|
|
487
|
+
def initialize bucket
|
|
529
488
|
@bucket = bucket.name
|
|
530
489
|
@connection = bucket.connection
|
|
531
490
|
@owners = nil
|
|
@@ -536,8 +495,7 @@ module Gcloud
|
|
|
536
495
|
##
|
|
537
496
|
# Reloads all Default Access Control List data for the bucket.
|
|
538
497
|
#
|
|
539
|
-
#
|
|
540
|
-
#
|
|
498
|
+
# @example
|
|
541
499
|
# require "gcloud"
|
|
542
500
|
#
|
|
543
501
|
# gcloud = Gcloud.new
|
|
@@ -559,12 +517,9 @@ module Gcloud
|
|
|
559
517
|
##
|
|
560
518
|
# Lists the default owners for files in the bucket.
|
|
561
519
|
#
|
|
562
|
-
#
|
|
563
|
-
#
|
|
564
|
-
# Array of Strings
|
|
565
|
-
#
|
|
566
|
-
# === Example
|
|
520
|
+
# @return [Array<String>]
|
|
567
521
|
#
|
|
522
|
+
# @example
|
|
568
523
|
# require "gcloud"
|
|
569
524
|
#
|
|
570
525
|
# gcloud = Gcloud.new
|
|
@@ -582,12 +537,9 @@ module Gcloud
|
|
|
582
537
|
##
|
|
583
538
|
# Lists the default writers for files in the bucket.
|
|
584
539
|
#
|
|
585
|
-
#
|
|
586
|
-
#
|
|
587
|
-
# Array of Strings
|
|
588
|
-
#
|
|
589
|
-
# === Example
|
|
540
|
+
# @return [Array<String>]
|
|
590
541
|
#
|
|
542
|
+
# @example
|
|
591
543
|
# require "gcloud"
|
|
592
544
|
#
|
|
593
545
|
# gcloud = Gcloud.new
|
|
@@ -605,12 +557,9 @@ module Gcloud
|
|
|
605
557
|
##
|
|
606
558
|
# Lists the default readers for files in the bucket.
|
|
607
559
|
#
|
|
608
|
-
#
|
|
609
|
-
#
|
|
610
|
-
# Array of Strings
|
|
611
|
-
#
|
|
612
|
-
# === Example
|
|
560
|
+
# @return [Array<String>]
|
|
613
561
|
#
|
|
562
|
+
# @example
|
|
614
563
|
# require "gcloud"
|
|
615
564
|
#
|
|
616
565
|
# gcloud = Gcloud.new
|
|
@@ -628,11 +577,8 @@ module Gcloud
|
|
|
628
577
|
##
|
|
629
578
|
# Grants default owner permission to files in the bucket.
|
|
630
579
|
#
|
|
631
|
-
#
|
|
632
|
-
#
|
|
633
|
-
# +entity+::
|
|
634
|
-
# The entity holding the permission, in one of the following forms:
|
|
635
|
-
# (+String+)
|
|
580
|
+
# @param [String] entity The entity holding the permission, in one of
|
|
581
|
+
# the following forms:
|
|
636
582
|
#
|
|
637
583
|
# * user-userId
|
|
638
584
|
# * user-email
|
|
@@ -643,11 +589,7 @@ module Gcloud
|
|
|
643
589
|
# * allUsers
|
|
644
590
|
# * allAuthenticatedUsers
|
|
645
591
|
#
|
|
646
|
-
#
|
|
647
|
-
#
|
|
648
|
-
# Access to a bucket can be granted to a user by appending +"user-"+ to
|
|
649
|
-
# the email address:
|
|
650
|
-
#
|
|
592
|
+
# @example Grant access to a user by pre-pending `"user-"` to an email:
|
|
651
593
|
# require "gcloud"
|
|
652
594
|
#
|
|
653
595
|
# gcloud = Gcloud.new
|
|
@@ -658,9 +600,7 @@ module Gcloud
|
|
|
658
600
|
# email = "heidi@example.net"
|
|
659
601
|
# bucket.default_acl.add_owner "user-#{email}"
|
|
660
602
|
#
|
|
661
|
-
#
|
|
662
|
-
# to the email address:
|
|
663
|
-
#
|
|
603
|
+
# @example Grant access to a group by pre-pending `"group-"` to an email
|
|
664
604
|
# require "gcloud"
|
|
665
605
|
#
|
|
666
606
|
# gcloud = Gcloud.new
|
|
@@ -684,11 +624,8 @@ module Gcloud
|
|
|
684
624
|
##
|
|
685
625
|
# Grants default writer permission to files in the bucket.
|
|
686
626
|
#
|
|
687
|
-
#
|
|
688
|
-
#
|
|
689
|
-
# +entity+::
|
|
690
|
-
# The entity holding the permission, in one of the following forms:
|
|
691
|
-
# (+String+)
|
|
627
|
+
# @param [String] entity The entity holding the permission, in one of
|
|
628
|
+
# the following forms:
|
|
692
629
|
#
|
|
693
630
|
# * user-userId
|
|
694
631
|
# * user-email
|
|
@@ -699,11 +636,7 @@ module Gcloud
|
|
|
699
636
|
# * allUsers
|
|
700
637
|
# * allAuthenticatedUsers
|
|
701
638
|
#
|
|
702
|
-
#
|
|
703
|
-
#
|
|
704
|
-
# Access to a bucket can be granted to a user by appending +"user-"+ to
|
|
705
|
-
# the email address:
|
|
706
|
-
#
|
|
639
|
+
# @example Grant access to a user by pre-pending `"user-"` to an email:
|
|
707
640
|
# require "gcloud"
|
|
708
641
|
#
|
|
709
642
|
# gcloud = Gcloud.new
|
|
@@ -714,9 +647,7 @@ module Gcloud
|
|
|
714
647
|
# email = "heidi@example.net"
|
|
715
648
|
# bucket.default_acl.add_writer "user-#{email}"
|
|
716
649
|
#
|
|
717
|
-
#
|
|
718
|
-
# to the email address:
|
|
719
|
-
#
|
|
650
|
+
# @example Grant access to a group by pre-pending `"group-"` to an email
|
|
720
651
|
# require "gcloud"
|
|
721
652
|
#
|
|
722
653
|
# gcloud = Gcloud.new
|
|
@@ -740,11 +671,8 @@ module Gcloud
|
|
|
740
671
|
##
|
|
741
672
|
# Grants default reader permission to files in the bucket.
|
|
742
673
|
#
|
|
743
|
-
#
|
|
744
|
-
#
|
|
745
|
-
# +entity+::
|
|
746
|
-
# The entity holding the permission, in one of the following forms:
|
|
747
|
-
# (+String+)
|
|
674
|
+
# @param [String] entity The entity holding the permission, in one of
|
|
675
|
+
# the following forms:
|
|
748
676
|
#
|
|
749
677
|
# * user-userId
|
|
750
678
|
# * user-email
|
|
@@ -755,11 +683,7 @@ module Gcloud
|
|
|
755
683
|
# * allUsers
|
|
756
684
|
# * allAuthenticatedUsers
|
|
757
685
|
#
|
|
758
|
-
#
|
|
759
|
-
#
|
|
760
|
-
# Access to a bucket can be granted to a user by appending +"user-"+ to
|
|
761
|
-
# the email address:
|
|
762
|
-
#
|
|
686
|
+
# @example Grant access to a user by pre-pending `"user-"` to an email:
|
|
763
687
|
# require "gcloud"
|
|
764
688
|
#
|
|
765
689
|
# gcloud = Gcloud.new
|
|
@@ -770,9 +694,7 @@ module Gcloud
|
|
|
770
694
|
# email = "heidi@example.net"
|
|
771
695
|
# bucket.default_acl.add_reader "user-#{email}"
|
|
772
696
|
#
|
|
773
|
-
#
|
|
774
|
-
# to the email address:
|
|
775
|
-
#
|
|
697
|
+
# @example Grant access to a group by pre-pending `"group-"` to an email
|
|
776
698
|
# require "gcloud"
|
|
777
699
|
#
|
|
778
700
|
# gcloud = Gcloud.new
|
|
@@ -797,11 +719,8 @@ module Gcloud
|
|
|
797
719
|
# Permanently deletes the entity from the bucket's default access
|
|
798
720
|
# control list for files.
|
|
799
721
|
#
|
|
800
|
-
#
|
|
801
|
-
#
|
|
802
|
-
# +entity+::
|
|
803
|
-
# The entity holding the permission, in one of the following forms:
|
|
804
|
-
# (+String+)
|
|
722
|
+
# @param [String] entity The entity holding the permission, in one of
|
|
723
|
+
# the following forms:
|
|
805
724
|
#
|
|
806
725
|
# * user-userId
|
|
807
726
|
# * user-email
|
|
@@ -812,8 +731,7 @@ module Gcloud
|
|
|
812
731
|
# * allUsers
|
|
813
732
|
# * allAuthenticatedUsers
|
|
814
733
|
#
|
|
815
|
-
#
|
|
816
|
-
#
|
|
734
|
+
# @example
|
|
817
735
|
# require "gcloud"
|
|
818
736
|
#
|
|
819
737
|
# gcloud = Gcloud.new
|
|
@@ -835,18 +753,18 @@ module Gcloud
|
|
|
835
753
|
false
|
|
836
754
|
end
|
|
837
755
|
|
|
838
|
-
|
|
756
|
+
# @private
|
|
757
|
+
def self.predefined_rule_for rule_name
|
|
839
758
|
RULES[rule_name.to_s]
|
|
840
759
|
end
|
|
841
760
|
|
|
842
761
|
# Predefined ACL helpers
|
|
843
762
|
|
|
844
763
|
##
|
|
845
|
-
# Convenience method to apply the default
|
|
764
|
+
# Convenience method to apply the default `authenticatedRead`
|
|
846
765
|
# predefined ACL rule to files in the bucket.
|
|
847
766
|
#
|
|
848
|
-
#
|
|
849
|
-
#
|
|
767
|
+
# @example
|
|
850
768
|
# require "gcloud"
|
|
851
769
|
#
|
|
852
770
|
# gcloud = Gcloud.new
|
|
@@ -865,11 +783,10 @@ module Gcloud
|
|
|
865
783
|
alias_method :authenticated_read!, :auth!
|
|
866
784
|
|
|
867
785
|
##
|
|
868
|
-
# Convenience method to apply the default
|
|
786
|
+
# Convenience method to apply the default `bucketOwnerFullControl`
|
|
869
787
|
# predefined ACL rule to files in the bucket.
|
|
870
788
|
#
|
|
871
|
-
#
|
|
872
|
-
#
|
|
789
|
+
# @example
|
|
873
790
|
# require "gcloud"
|
|
874
791
|
#
|
|
875
792
|
# gcloud = Gcloud.new
|
|
@@ -885,11 +802,10 @@ module Gcloud
|
|
|
885
802
|
alias_method :bucketOwnerFullControl!, :owner_full!
|
|
886
803
|
|
|
887
804
|
##
|
|
888
|
-
# Convenience method to apply the default
|
|
805
|
+
# Convenience method to apply the default `bucketOwnerRead`
|
|
889
806
|
# predefined ACL rule to files in the bucket.
|
|
890
807
|
#
|
|
891
|
-
#
|
|
892
|
-
#
|
|
808
|
+
# @example
|
|
893
809
|
# require "gcloud"
|
|
894
810
|
#
|
|
895
811
|
# gcloud = Gcloud.new
|
|
@@ -905,11 +821,10 @@ module Gcloud
|
|
|
905
821
|
alias_method :bucketOwnerRead!, :owner_read!
|
|
906
822
|
|
|
907
823
|
##
|
|
908
|
-
# Convenience method to apply the default
|
|
824
|
+
# Convenience method to apply the default `private`
|
|
909
825
|
# predefined ACL rule to files in the bucket.
|
|
910
826
|
#
|
|
911
|
-
#
|
|
912
|
-
#
|
|
827
|
+
# @example
|
|
913
828
|
# require "gcloud"
|
|
914
829
|
#
|
|
915
830
|
# gcloud = Gcloud.new
|
|
@@ -924,11 +839,10 @@ module Gcloud
|
|
|
924
839
|
end
|
|
925
840
|
|
|
926
841
|
##
|
|
927
|
-
# Convenience method to apply the default
|
|
842
|
+
# Convenience method to apply the default `projectPrivate`
|
|
928
843
|
# predefined ACL rule to files in the bucket.
|
|
929
844
|
#
|
|
930
|
-
#
|
|
931
|
-
#
|
|
845
|
+
# @example
|
|
932
846
|
# require "gcloud"
|
|
933
847
|
#
|
|
934
848
|
# gcloud = Gcloud.new
|
|
@@ -944,11 +858,10 @@ module Gcloud
|
|
|
944
858
|
alias_method :projectPrivate!, :project_private!
|
|
945
859
|
|
|
946
860
|
##
|
|
947
|
-
# Convenience method to apply the default
|
|
861
|
+
# Convenience method to apply the default `publicRead`
|
|
948
862
|
# predefined ACL rule to files in the bucket.
|
|
949
863
|
#
|
|
950
|
-
#
|
|
951
|
-
#
|
|
864
|
+
# @example
|
|
952
865
|
# require "gcloud"
|
|
953
866
|
#
|
|
954
867
|
# gcloud = Gcloud.new
|