google-cloud-storage 1.13.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/README.md +8 -8
- data/lib/google/cloud/storage/bucket.rb +74 -9
- data/lib/google/cloud/storage/bucket/acl.rb +8 -0
- data/lib/google/cloud/storage/file.rb +107 -7
- data/lib/google/cloud/storage/file/acl.rb +7 -0
- data/lib/google/cloud/storage/notification.rb +21 -0
- data/lib/google/cloud/storage/policy.rb +1 -1
- data/lib/google/cloud/storage/project.rb +16 -0
- data/lib/google/cloud/storage/service.rb +10 -0
- data/lib/google/cloud/storage/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ce659678f9b9f504dd5836bd4985ef9b92f9f6bc41e9ef7919effbed5967ad0
|
4
|
+
data.tar.gz: b4bdce219f6973d4f1ad1ba28501549b0c21ceb2b4fba993ecad37a972b18316
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ffdeb63b4ecb7aa95644e00ae5d60e244706814e2667314f00448a7cb42b677c4b0ceb8f64bae464984af82108d1fea2953539e77c985e18f381d56251acffe
|
7
|
+
data.tar.gz: 248716f033cdda7a205ed1711585d637be2a8dce3b6f0888e5ad1bb83da28ac06423115e93e7f4f266a4e9c327984c80036d42f87ebbdcdb99dfc0ce6be718a1
|
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -60,14 +60,14 @@ Google::Apis.logger = my_logger
|
|
60
60
|
|
61
61
|
## Supported Ruby Versions
|
62
62
|
|
63
|
-
This library is supported on Ruby 2.
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
63
|
+
This library is supported on Ruby 2.3+.
|
64
|
+
|
65
|
+
Google provides official support for Ruby versions that are actively supported
|
66
|
+
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
67
|
+
in security maintenance, and not end of life. Currently, this means Ruby 2.3
|
68
|
+
and later. Older versions of Ruby _may_ still work, but are unsupported and not
|
69
|
+
recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
|
70
|
+
about the Ruby support schedule.
|
71
71
|
|
72
72
|
## Versioning
|
73
73
|
|
@@ -86,30 +86,45 @@ module Google
|
|
86
86
|
##
|
87
87
|
# The kind of item this is.
|
88
88
|
# For buckets, this is always `storage#bucket`.
|
89
|
+
#
|
90
|
+
# @return [String]
|
91
|
+
#
|
89
92
|
def kind
|
90
93
|
@gapi.kind
|
91
94
|
end
|
92
95
|
|
93
96
|
##
|
94
97
|
# The ID of the bucket.
|
98
|
+
#
|
99
|
+
# @return [String]
|
100
|
+
#
|
95
101
|
def id
|
96
102
|
@gapi.id
|
97
103
|
end
|
98
104
|
|
99
105
|
##
|
100
106
|
# The name of the bucket.
|
107
|
+
#
|
108
|
+
# @return [String]
|
109
|
+
#
|
101
110
|
def name
|
102
111
|
@gapi.name
|
103
112
|
end
|
104
113
|
|
105
114
|
##
|
106
115
|
# A URL that can be used to access the bucket using the REST API.
|
116
|
+
#
|
117
|
+
# @return [String]
|
118
|
+
#
|
107
119
|
def api_url
|
108
120
|
@gapi.self_link
|
109
121
|
end
|
110
122
|
|
111
123
|
##
|
112
124
|
# Creation time of the bucket.
|
125
|
+
#
|
126
|
+
# @return [DateTime]
|
127
|
+
#
|
113
128
|
def created_at
|
114
129
|
@gapi.time_created
|
115
130
|
end
|
@@ -131,6 +146,8 @@ module Google
|
|
131
146
|
# @yield [cors] a block for setting CORS rules
|
132
147
|
# @yieldparam [Bucket::Cors] cors the object accepting CORS rules
|
133
148
|
#
|
149
|
+
# @return [Bucket::Cors] The frozen builder object.
|
150
|
+
#
|
134
151
|
# @example Retrieving the bucket's CORS rules.
|
135
152
|
# require "google/cloud/storage"
|
136
153
|
#
|
@@ -177,7 +194,10 @@ module Google
|
|
177
194
|
# storage within this region. Defaults to US.
|
178
195
|
# See the developer's guide for the authoritative list.
|
179
196
|
#
|
197
|
+
# @return [String]
|
198
|
+
#
|
180
199
|
# @see https://cloud.google.com/storage/docs/concepts-techniques
|
200
|
+
#
|
181
201
|
def location
|
182
202
|
@gapi.location
|
183
203
|
end
|
@@ -185,6 +205,8 @@ module Google
|
|
185
205
|
##
|
186
206
|
# The destination bucket name for the bucket's logs.
|
187
207
|
#
|
208
|
+
# @return [String]
|
209
|
+
#
|
188
210
|
# @see https://cloud.google.com/storage/docs/access-logs Access Logs
|
189
211
|
#
|
190
212
|
def logging_bucket
|
@@ -209,6 +231,8 @@ module Google
|
|
209
231
|
#
|
210
232
|
# @see https://cloud.google.com/storage/docs/access-logs Access Logs
|
211
233
|
#
|
234
|
+
# @return [String]
|
235
|
+
#
|
212
236
|
def logging_prefix
|
213
237
|
@gapi.logging.log_object_prefix if @gapi.logging
|
214
238
|
end
|
@@ -223,6 +247,8 @@ module Google
|
|
223
247
|
#
|
224
248
|
# @see https://cloud.google.com/storage/docs/access-logs Access Logs
|
225
249
|
#
|
250
|
+
# @param [String] logging_prefix The logging object prefix.
|
251
|
+
#
|
226
252
|
def logging_prefix= logging_prefix
|
227
253
|
@gapi.logging ||= Google::Apis::StorageV1::Bucket::Logging.new
|
228
254
|
@gapi.logging.log_object_prefix = logging_prefix
|
@@ -234,6 +260,9 @@ module Google
|
|
234
260
|
# stored and determines the SLA and the cost of storage. Values include
|
235
261
|
# `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, and
|
236
262
|
# `DURABLE_REDUCED_AVAILABILITY`.
|
263
|
+
#
|
264
|
+
# @return [String]
|
265
|
+
#
|
237
266
|
def storage_class
|
238
267
|
@gapi.storage_class
|
239
268
|
end
|
@@ -245,7 +274,9 @@ module Google
|
|
245
274
|
# and `:coldline`, as well as the equivalent strings returned by
|
246
275
|
# {Bucket#storage_class}. For more information, see [Storage
|
247
276
|
# Classes](https://cloud.google.com/storage/docs/storage-classes).
|
277
|
+
#
|
248
278
|
# @param [Symbol, String] new_storage_class Storage class of the bucket.
|
279
|
+
#
|
249
280
|
def storage_class= new_storage_class
|
250
281
|
@gapi.storage_class = storage_class_for(new_storage_class)
|
251
282
|
patch_gapi! :storage_class
|
@@ -255,6 +286,9 @@ module Google
|
|
255
286
|
# Whether [Object
|
256
287
|
# Versioning](https://cloud.google.com/storage/docs/object-versioning)
|
257
288
|
# is enabled for the bucket.
|
289
|
+
#
|
290
|
+
# @return [Boolean]
|
291
|
+
#
|
258
292
|
def versioning?
|
259
293
|
@gapi.versioning.enabled? unless @gapi.versioning.nil?
|
260
294
|
end
|
@@ -264,7 +298,8 @@ module Google
|
|
264
298
|
# Versioning](https://cloud.google.com/storage/docs/object-versioning)
|
265
299
|
# is enabled for the bucket.
|
266
300
|
#
|
267
|
-
# @
|
301
|
+
# @param [Boolean] new_versioning true if versioning is to be enabled
|
302
|
+
# for the bucket.
|
268
303
|
#
|
269
304
|
def versioning= new_versioning
|
270
305
|
@gapi.versioning ||= Google::Apis::StorageV1::Bucket::Versioning.new
|
@@ -273,23 +308,29 @@ module Google
|
|
273
308
|
end
|
274
309
|
|
275
310
|
##
|
276
|
-
# The
|
277
|
-
#
|
311
|
+
# The main page suffix for a static website. If the requested object
|
312
|
+
# path is missing, the service will ensure the path has a trailing '/',
|
313
|
+
# append this suffix, and attempt to retrieve the resulting object. This
|
314
|
+
# allows the creation of index.html objects to represent directory
|
315
|
+
# pages.
|
278
316
|
#
|
279
317
|
# @see https://cloud.google.com/storage/docs/website-configuration#step4
|
280
318
|
# How to Host a Static Website
|
281
319
|
#
|
320
|
+
# @return [String] The main page suffix.
|
321
|
+
#
|
282
322
|
def website_main
|
283
323
|
@gapi.website.main_page_suffix if @gapi.website
|
284
324
|
end
|
285
325
|
|
286
326
|
##
|
287
|
-
# Updates the
|
288
|
-
# bucket when a site visitor requests the top level directory.
|
327
|
+
# Updates the main page suffix for a static website.
|
289
328
|
#
|
290
329
|
# @see https://cloud.google.com/storage/docs/website-configuration#step4
|
291
330
|
# How to Host a Static Website
|
292
331
|
#
|
332
|
+
# @param [String] website_main The main page suffix.
|
333
|
+
#
|
293
334
|
def website_main= website_main
|
294
335
|
@gapi.website ||= Google::Apis::StorageV1::Bucket::Website.new
|
295
336
|
@gapi.website.main_page_suffix = website_main
|
@@ -303,6 +344,8 @@ module Google
|
|
303
344
|
# @see https://cloud.google.com/storage/docs/website-configuration#step4
|
304
345
|
# How to Host a Static Website
|
305
346
|
#
|
347
|
+
# @return [String]
|
348
|
+
#
|
306
349
|
def website_404
|
307
350
|
@gapi.website.not_found_page if @gapi.website
|
308
351
|
end
|
@@ -310,6 +353,9 @@ module Google
|
|
310
353
|
##
|
311
354
|
# A hash of user-provided labels. The hash is frozen and changes are not
|
312
355
|
# allowed.
|
356
|
+
#
|
357
|
+
# @return [Hash(String => String)]
|
358
|
+
#
|
313
359
|
def labels
|
314
360
|
m = @gapi.labels
|
315
361
|
m = m.to_h if m.respond_to? :to_h
|
@@ -318,6 +364,9 @@ module Google
|
|
318
364
|
|
319
365
|
##
|
320
366
|
# Updates the hash of user-provided labels.
|
367
|
+
#
|
368
|
+
# @param [Hash(String => String)] labels The user-provided labels.
|
369
|
+
#
|
321
370
|
def labels= labels
|
322
371
|
@gapi.labels = labels
|
323
372
|
patch_gapi! :labels
|
@@ -406,7 +455,7 @@ module Google
|
|
406
455
|
# Set the Cloud KMS encryption key that will be used to protect files.
|
407
456
|
# For example: `projects/a/locations/b/keyRings/c/cryptoKeys/d`
|
408
457
|
#
|
409
|
-
# @param [String] new_default_kms_key New Cloud KMS key name
|
458
|
+
# @param [String] new_default_kms_key New Cloud KMS key name.
|
410
459
|
#
|
411
460
|
# @example
|
412
461
|
# require "google/cloud/storage"
|
@@ -972,6 +1021,8 @@ module Google
|
|
972
1021
|
# corresponding values. (These values can be permanently set using
|
973
1022
|
# {File#content_disposition=} and {File#content_type=}.)
|
974
1023
|
#
|
1024
|
+
# @return [String]
|
1025
|
+
#
|
975
1026
|
# @example
|
976
1027
|
# require "google/cloud/storage"
|
977
1028
|
#
|
@@ -1136,7 +1187,7 @@ module Google
|
|
1136
1187
|
end
|
1137
1188
|
|
1138
1189
|
##
|
1139
|
-
# The Bucket::Acl instance used to control access to the bucket.
|
1190
|
+
# The {Bucket::Acl} instance used to control access to the bucket.
|
1140
1191
|
#
|
1141
1192
|
# A bucket has owners, writers, and readers. Permissions can be granted
|
1142
1193
|
# to an individual user's email address, a group's email address, as
|
@@ -1145,6 +1196,8 @@ module Google
|
|
1145
1196
|
# @see https://cloud.google.com/storage/docs/access-control Access
|
1146
1197
|
# Control guide
|
1147
1198
|
#
|
1199
|
+
# @return [Bucket::Acl]
|
1200
|
+
#
|
1148
1201
|
# @example Grant access to a user by prepending `"user-"` to an email:
|
1149
1202
|
# require "google/cloud/storage"
|
1150
1203
|
#
|
@@ -1179,8 +1232,8 @@ module Google
|
|
1179
1232
|
end
|
1180
1233
|
|
1181
1234
|
##
|
1182
|
-
# The Bucket::DefaultAcl instance used to control access to the
|
1183
|
-
# files.
|
1235
|
+
# The {Bucket::DefaultAcl} instance used to control access to the
|
1236
|
+
# bucket's files.
|
1184
1237
|
#
|
1185
1238
|
# A bucket's files have owners, writers, and readers. Permissions can be
|
1186
1239
|
# granted to an individual user's email address, a group's email
|
@@ -1189,6 +1242,8 @@ module Google
|
|
1189
1242
|
# @see https://cloud.google.com/storage/docs/access-control Access
|
1190
1243
|
# Control guide
|
1191
1244
|
#
|
1245
|
+
# @return [Bucket::DefaultAcl]
|
1246
|
+
#
|
1192
1247
|
# @example Grant access to a user by prepending `"user-"` to an email:
|
1193
1248
|
# require "google/cloud/storage"
|
1194
1249
|
#
|
@@ -1490,6 +1545,7 @@ module Google
|
|
1490
1545
|
|
1491
1546
|
##
|
1492
1547
|
# Reloads the bucket with current data from the Storage service.
|
1548
|
+
#
|
1493
1549
|
def reload!
|
1494
1550
|
ensure_service!
|
1495
1551
|
@gapi = service.get_bucket name, user_project: user_project
|
@@ -1501,6 +1557,9 @@ module Google
|
|
1501
1557
|
|
1502
1558
|
##
|
1503
1559
|
# Determines whether the bucket exists in the Storage service.
|
1560
|
+
#
|
1561
|
+
# @return [Boolean] true if the bucket exists in the Storage service.
|
1562
|
+
#
|
1504
1563
|
def exists?
|
1505
1564
|
# Always true if we have a grpc object
|
1506
1565
|
return true unless lazy?
|
@@ -1607,12 +1666,18 @@ module Google
|
|
1607
1666
|
|
1608
1667
|
##
|
1609
1668
|
# A hash of user-provided labels. Changes are allowed.
|
1669
|
+
#
|
1670
|
+
# @return [Hash(String => String)]
|
1671
|
+
#
|
1610
1672
|
def labels
|
1611
1673
|
@labels
|
1612
1674
|
end
|
1613
1675
|
|
1614
1676
|
##
|
1615
1677
|
# Updates the hash of user-provided labels.
|
1678
|
+
#
|
1679
|
+
# @param [Hash(String => String)] labels The user-provided labels.
|
1680
|
+
#
|
1616
1681
|
def labels= labels
|
1617
1682
|
@labels = labels
|
1618
1683
|
@gapi.labels = @labels
|
@@ -172,6 +172,8 @@ module Google
|
|
172
172
|
# * allUsers
|
173
173
|
# * allAuthenticatedUsers
|
174
174
|
#
|
175
|
+
# @return [String] The entity.
|
176
|
+
#
|
175
177
|
# @example Grant access to a user by prepending `"user-"` to an email:
|
176
178
|
# require "google/cloud/storage"
|
177
179
|
#
|
@@ -215,6 +217,8 @@ module Google
|
|
215
217
|
# * allUsers
|
216
218
|
# * allAuthenticatedUsers
|
217
219
|
#
|
220
|
+
# @return [String] The entity.
|
221
|
+
#
|
218
222
|
# @example Grant access to a user by prepending `"user-"` to an email:
|
219
223
|
# require "google/cloud/storage"
|
220
224
|
#
|
@@ -258,6 +262,8 @@ module Google
|
|
258
262
|
# * allUsers
|
259
263
|
# * allAuthenticatedUsers
|
260
264
|
#
|
265
|
+
# @return [String] The entity.
|
266
|
+
#
|
261
267
|
# @example Grant access to a user by prepending `"user-"` to an email:
|
262
268
|
# require "google/cloud/storage"
|
263
269
|
#
|
@@ -302,6 +308,8 @@ module Google
|
|
302
308
|
# * allUsers
|
303
309
|
# * allAuthenticatedUsers
|
304
310
|
#
|
311
|
+
# @return [Boolean]
|
312
|
+
#
|
305
313
|
# @example
|
306
314
|
# require "google/cloud/storage"
|
307
315
|
#
|
@@ -108,24 +108,36 @@ module Google
|
|
108
108
|
##
|
109
109
|
# The kind of item this is.
|
110
110
|
# For files, this is always storage#object.
|
111
|
+
#
|
112
|
+
# @return [String]
|
113
|
+
#
|
111
114
|
def kind
|
112
115
|
@gapi.kind
|
113
116
|
end
|
114
117
|
|
115
118
|
##
|
116
119
|
# The ID of the file.
|
120
|
+
#
|
121
|
+
# @return [String]
|
122
|
+
#
|
117
123
|
def id
|
118
124
|
@gapi.id
|
119
125
|
end
|
120
126
|
|
121
127
|
##
|
122
128
|
# The name of this file.
|
129
|
+
#
|
130
|
+
# @return [String]
|
131
|
+
#
|
123
132
|
def name
|
124
133
|
@gapi.name
|
125
134
|
end
|
126
135
|
|
127
136
|
##
|
128
137
|
# The name of the {Bucket} containing this file.
|
138
|
+
#
|
139
|
+
# @return [String]
|
140
|
+
#
|
129
141
|
def bucket
|
130
142
|
@gapi.bucket
|
131
143
|
end
|
@@ -133,6 +145,9 @@ module Google
|
|
133
145
|
##
|
134
146
|
# The content generation of this file.
|
135
147
|
# Used for object versioning.
|
148
|
+
#
|
149
|
+
# @return [Fixnum]
|
150
|
+
#
|
136
151
|
def generation
|
137
152
|
@gapi.generation
|
138
153
|
end
|
@@ -142,30 +157,45 @@ module Google
|
|
142
157
|
# Used for preconditions and for detecting changes in metadata.
|
143
158
|
# A metageneration number is only meaningful in the context of a
|
144
159
|
# particular generation of a particular file.
|
160
|
+
#
|
161
|
+
# @return [Fixnum]
|
162
|
+
#
|
145
163
|
def metageneration
|
146
164
|
@gapi.metageneration
|
147
165
|
end
|
148
166
|
|
149
167
|
##
|
150
168
|
# A URL that can be used to access the file using the REST API.
|
169
|
+
#
|
170
|
+
# @return [String]
|
171
|
+
#
|
151
172
|
def api_url
|
152
173
|
@gapi.self_link
|
153
174
|
end
|
154
175
|
|
155
176
|
##
|
156
177
|
# A URL that can be used to download the file using the REST API.
|
178
|
+
#
|
179
|
+
# @return [String]
|
180
|
+
#
|
157
181
|
def media_url
|
158
182
|
@gapi.media_link
|
159
183
|
end
|
160
184
|
|
161
185
|
##
|
162
186
|
# Content-Length of the data in bytes.
|
187
|
+
#
|
188
|
+
# @return [Integer]
|
189
|
+
#
|
163
190
|
def size
|
164
191
|
@gapi.size.to_i if @gapi.size
|
165
192
|
end
|
166
193
|
|
167
194
|
##
|
168
195
|
# Creation time of the file.
|
196
|
+
#
|
197
|
+
# @return [DateTime]
|
198
|
+
#
|
169
199
|
def created_at
|
170
200
|
@gapi.time_created
|
171
201
|
end
|
@@ -174,12 +204,18 @@ module Google
|
|
174
204
|
# The creation or modification time of the file.
|
175
205
|
# For buckets with versioning enabled, changing an object's
|
176
206
|
# metadata does not change this property.
|
207
|
+
#
|
208
|
+
# @return [DateTime]
|
209
|
+
#
|
177
210
|
def updated_at
|
178
211
|
@gapi.updated
|
179
212
|
end
|
180
213
|
|
181
214
|
##
|
182
215
|
# MD5 hash of the data; encoded using base64.
|
216
|
+
#
|
217
|
+
# @return [String]
|
218
|
+
#
|
183
219
|
def md5
|
184
220
|
@gapi.md5_hash
|
185
221
|
end
|
@@ -188,19 +224,29 @@ module Google
|
|
188
224
|
# The CRC32c checksum of the data, as described in
|
189
225
|
# [RFC 4960, Appendix B](http://tools.ietf.org/html/rfc4960#appendix-B).
|
190
226
|
# Encoded using base64 in big-endian byte order.
|
227
|
+
#
|
228
|
+
# @return [String]
|
229
|
+
#
|
191
230
|
def crc32c
|
192
231
|
@gapi.crc32c
|
193
232
|
end
|
194
233
|
|
195
234
|
##
|
196
235
|
# HTTP 1.1 Entity tag for the file.
|
236
|
+
#
|
237
|
+
# @return [String]
|
238
|
+
#
|
197
239
|
def etag
|
198
240
|
@gapi.etag
|
199
241
|
end
|
200
242
|
|
201
243
|
##
|
202
244
|
# The [Cache-Control](https://tools.ietf.org/html/rfc7234#section-5.2)
|
203
|
-
# directive for the file data.
|
245
|
+
# directive for the file data. If omitted, and the file is accessible
|
246
|
+
# to all anonymous users, the default will be `public, max-age=3600`.
|
247
|
+
#
|
248
|
+
# @return [String]
|
249
|
+
#
|
204
250
|
def cache_control
|
205
251
|
@gapi.cache_control
|
206
252
|
end
|
@@ -208,7 +254,11 @@ module Google
|
|
208
254
|
##
|
209
255
|
# Updates the
|
210
256
|
# [Cache-Control](https://tools.ietf.org/html/rfc7234#section-5.2)
|
211
|
-
# directive for the file data.
|
257
|
+
# directive for the file data. If omitted, and the file is accessible
|
258
|
+
# to all anonymous users, the default will be `public, max-age=3600`.
|
259
|
+
#
|
260
|
+
# @param [String] cache_control The Cache-Control directive.
|
261
|
+
#
|
212
262
|
def cache_control= cache_control
|
213
263
|
@gapi.cache_control = cache_control
|
214
264
|
update_gapi! :cache_control
|
@@ -217,6 +267,9 @@ module Google
|
|
217
267
|
##
|
218
268
|
# The [Content-Disposition](https://tools.ietf.org/html/rfc6266) of the
|
219
269
|
# file data.
|
270
|
+
#
|
271
|
+
# @return [String]
|
272
|
+
#
|
220
273
|
def content_disposition
|
221
274
|
@gapi.content_disposition
|
222
275
|
end
|
@@ -224,6 +277,10 @@ module Google
|
|
224
277
|
##
|
225
278
|
# Updates the [Content-Disposition](https://tools.ietf.org/html/rfc6266)
|
226
279
|
# of the file data.
|
280
|
+
#
|
281
|
+
# @param [String] content_disposition The Content-Disposition of the
|
282
|
+
# file.
|
283
|
+
#
|
227
284
|
def content_disposition= content_disposition
|
228
285
|
@gapi.content_disposition = content_disposition
|
229
286
|
update_gapi! :content_disposition
|
@@ -233,6 +290,9 @@ module Google
|
|
233
290
|
# The [Content-Encoding
|
234
291
|
# ](https://tools.ietf.org/html/rfc7231#section-3.1.2.2) of the file
|
235
292
|
# data.
|
293
|
+
#
|
294
|
+
# @return [String]
|
295
|
+
#
|
236
296
|
def content_encoding
|
237
297
|
@gapi.content_encoding
|
238
298
|
end
|
@@ -241,6 +301,9 @@ module Google
|
|
241
301
|
# Updates the [Content-Encoding
|
242
302
|
# ](https://tools.ietf.org/html/rfc7231#section-3.1.2.2) of the file
|
243
303
|
# data.
|
304
|
+
#
|
305
|
+
# @param [String] content_encoding The Content-Encoding of the file.
|
306
|
+
#
|
244
307
|
def content_encoding= content_encoding
|
245
308
|
@gapi.content_encoding = content_encoding
|
246
309
|
update_gapi! :content_encoding
|
@@ -249,6 +312,9 @@ module Google
|
|
249
312
|
##
|
250
313
|
# The [Content-Language](http://tools.ietf.org/html/bcp47) of the file
|
251
314
|
# data.
|
315
|
+
#
|
316
|
+
# @return [String]
|
317
|
+
#
|
252
318
|
def content_language
|
253
319
|
@gapi.content_language
|
254
320
|
end
|
@@ -256,6 +322,9 @@ module Google
|
|
256
322
|
##
|
257
323
|
# Updates the [Content-Language](http://tools.ietf.org/html/bcp47) of
|
258
324
|
# the file data.
|
325
|
+
#
|
326
|
+
# @param [String] content_language The Content-Language of the file.
|
327
|
+
#
|
259
328
|
def content_language= content_language
|
260
329
|
@gapi.content_language = content_language
|
261
330
|
update_gapi! :content_language
|
@@ -264,6 +333,9 @@ module Google
|
|
264
333
|
##
|
265
334
|
# The [Content-Type](https://tools.ietf.org/html/rfc2616#section-14.17)
|
266
335
|
# of the file data.
|
336
|
+
#
|
337
|
+
# @return [String]
|
338
|
+
#
|
267
339
|
def content_type
|
268
340
|
@gapi.content_type
|
269
341
|
end
|
@@ -272,6 +344,9 @@ module Google
|
|
272
344
|
# Updates the
|
273
345
|
# [Content-Type](https://tools.ietf.org/html/rfc2616#section-14.17) of
|
274
346
|
# the file data.
|
347
|
+
#
|
348
|
+
# @param [String] content_type The Content-Type of the file.
|
349
|
+
#
|
275
350
|
def content_type= content_type
|
276
351
|
@gapi.content_type = content_type
|
277
352
|
update_gapi! :content_type
|
@@ -281,6 +356,9 @@ module Google
|
|
281
356
|
# A hash of custom, user-provided web-safe keys and arbitrary string
|
282
357
|
# values that will returned with requests for the file as "x-goog-meta-"
|
283
358
|
# response headers.
|
359
|
+
#
|
360
|
+
# @return [Hash(String => String)]
|
361
|
+
#
|
284
362
|
def metadata
|
285
363
|
m = @gapi.metadata
|
286
364
|
m = m.to_h if m.respond_to? :to_h
|
@@ -291,6 +369,10 @@ module Google
|
|
291
369
|
# Updates the hash of custom, user-provided web-safe keys and arbitrary
|
292
370
|
# string values that will returned with requests for the file as
|
293
371
|
# "x-goog-meta-" response headers.
|
372
|
+
#
|
373
|
+
# @param [Hash(String => String)] metadata The user-provided metadata,
|
374
|
+
# in key/value pairs.
|
375
|
+
#
|
294
376
|
def metadata= metadata
|
295
377
|
@gapi.metadata = metadata
|
296
378
|
update_gapi! :metadata
|
@@ -303,6 +385,9 @@ module Google
|
|
303
385
|
# key](https://cloud.google.com/storage/docs/encryption#customer-supplied).
|
304
386
|
# You can use this SHA256 hash to uniquely identify the AES-256
|
305
387
|
# encryption key required to decrypt this file.
|
388
|
+
#
|
389
|
+
# @return [String]
|
390
|
+
#
|
306
391
|
def encryption_key_sha256
|
307
392
|
return nil unless @gapi.customer_encryption
|
308
393
|
Base64.decode64 @gapi.customer_encryption.key_sha256
|
@@ -318,9 +403,6 @@ module Google
|
|
318
403
|
# @return [String, nil] A Cloud KMS encryption key, or `nil` if none has
|
319
404
|
# been configured.
|
320
405
|
#
|
321
|
-
# @see https://cloud.google.com/kms/docs/ Cloud Key Management Service
|
322
|
-
# Documentation
|
323
|
-
#
|
324
406
|
def kms_key
|
325
407
|
@gapi.kms_key_name
|
326
408
|
end
|
@@ -332,6 +414,9 @@ module Google
|
|
332
414
|
# Classes](https://cloud.google.com/storage/docs/storage-classes) and
|
333
415
|
# [Per-Object Storage
|
334
416
|
# Class](https://cloud.google.com/storage/docs/per-object-storage-class).
|
417
|
+
#
|
418
|
+
# @return [String]
|
419
|
+
#
|
335
420
|
def storage_class
|
336
421
|
@gapi.storage_class
|
337
422
|
end
|
@@ -352,7 +437,9 @@ module Google
|
|
352
437
|
# Class](https://cloud.google.com/storage/docs/per-object-storage-class).
|
353
438
|
# The default value is the default storage class for the bucket. See
|
354
439
|
# {Bucket#storage_class}.
|
440
|
+
#
|
355
441
|
# @param [Symbol, String] storage_class Storage class of the file.
|
442
|
+
#
|
356
443
|
def storage_class= storage_class
|
357
444
|
@gapi.storage_class = storage_class_for(storage_class)
|
358
445
|
update_gapi! :storage_class
|
@@ -366,7 +453,7 @@ module Google
|
|
366
453
|
# version. You can turn versioning on or off for a bucket at any time
|
367
454
|
# with {Bucket#versioning=}. Turning versioning off leaves existing file
|
368
455
|
# versions in place and causes the bucket to stop accumulating new
|
369
|
-
# archived object versions. (See {Bucket#versioning} and
|
456
|
+
# archived object versions. (See {Bucket#versioning?} and
|
370
457
|
# {File#generation})
|
371
458
|
#
|
372
459
|
# @see https://cloud.google.com/storage/docs/object-versioning Object
|
@@ -952,12 +1039,12 @@ module Google
|
|
952
1039
|
##
|
953
1040
|
# Permanently deletes the file.
|
954
1041
|
#
|
955
|
-
# @return [Boolean] Returns `true` if the file was deleted.
|
956
1042
|
# @param [Boolean, Integer] generation Specify a version of the file to
|
957
1043
|
# delete. When `true`, it will delete the version returned by
|
958
1044
|
# {#generation}. The default behavior is to delete the latest version
|
959
1045
|
# of the file (regardless of the version to which the file is set,
|
960
1046
|
# which is the version returned by {#generation}.)
|
1047
|
+
# @return [Boolean] Returns `true` if the file was deleted.
|
961
1048
|
#
|
962
1049
|
# @example
|
963
1050
|
# require "google/cloud/storage"
|
@@ -1009,6 +1096,8 @@ module Google
|
|
1009
1096
|
# @param [String] protocol The protocol to use for the URL. Default is
|
1010
1097
|
# `HTTPS`.
|
1011
1098
|
#
|
1099
|
+
# @return [String]
|
1100
|
+
#
|
1012
1101
|
# @example
|
1013
1102
|
# require "google/cloud/storage"
|
1014
1103
|
#
|
@@ -1081,6 +1170,8 @@ module Google
|
|
1081
1170
|
# corresponding values. (These values can be permanently set using
|
1082
1171
|
# {#content_disposition=} and {#content_type=}.)
|
1083
1172
|
#
|
1173
|
+
# @return [String]
|
1174
|
+
#
|
1084
1175
|
# @example
|
1085
1176
|
# require "google/cloud/storage"
|
1086
1177
|
#
|
@@ -1149,6 +1240,8 @@ module Google
|
|
1149
1240
|
# @see https://cloud.google.com/storage/docs/access-control Access
|
1150
1241
|
# Control guide
|
1151
1242
|
#
|
1243
|
+
# @return [File::Acl]
|
1244
|
+
#
|
1152
1245
|
# @example Grant access to a user by prepending `"user-"` to an email:
|
1153
1246
|
# require "google/cloud/storage"
|
1154
1247
|
#
|
@@ -1423,6 +1516,9 @@ module Google
|
|
1423
1516
|
# A hash of custom, user-provided web-safe keys and arbitrary string
|
1424
1517
|
# values that will returned with requests for the file as
|
1425
1518
|
# "x-goog-meta-" response headers.
|
1519
|
+
#
|
1520
|
+
# @return [Hash(String => String)]
|
1521
|
+
#
|
1426
1522
|
def metadata
|
1427
1523
|
@metadata
|
1428
1524
|
end
|
@@ -1431,6 +1527,10 @@ module Google
|
|
1431
1527
|
# Updates the hash of custom, user-provided web-safe keys and
|
1432
1528
|
# arbitrary string values that will returned with requests for the
|
1433
1529
|
# file as "x-goog-meta-" response headers.
|
1530
|
+
#
|
1531
|
+
# @param [Hash(String => String)] metadata The user-provided metadata,
|
1532
|
+
# in key/value pairs.
|
1533
|
+
#
|
1434
1534
|
def metadata= metadata
|
1435
1535
|
@metadata = metadata
|
1436
1536
|
@gapi.metadata = @metadata
|
@@ -161,6 +161,8 @@ module Google
|
|
161
161
|
# @param [Integer] generation When present, selects a specific
|
162
162
|
# revision of this object. Default is the latest version.
|
163
163
|
#
|
164
|
+
# @return [String] The entity.
|
165
|
+
#
|
164
166
|
# @example Grant access to a user by prepending `"user-"` to an email:
|
165
167
|
# require "google/cloud/storage"
|
166
168
|
#
|
@@ -210,6 +212,8 @@ module Google
|
|
210
212
|
# @param [Integer] generation When present, selects a specific
|
211
213
|
# revision of this object. Default is the latest version.
|
212
214
|
#
|
215
|
+
# @return [String] The entity.
|
216
|
+
#
|
213
217
|
# @example Grant access to a user by prepending `"user-"` to an email:
|
214
218
|
# require "google/cloud/storage"
|
215
219
|
#
|
@@ -259,6 +263,9 @@ module Google
|
|
259
263
|
# @param [Integer] generation When present, selects a specific
|
260
264
|
# revision of this object. Default is the latest version.
|
261
265
|
#
|
266
|
+
# @return [Boolean] true if the delete operation did not raise an
|
267
|
+
# error
|
268
|
+
#
|
262
269
|
# @example
|
263
270
|
# require "google/cloud/storage"
|
264
271
|
#
|
@@ -78,18 +78,27 @@ module Google
|
|
78
78
|
##
|
79
79
|
# The kind of item this is.
|
80
80
|
# For notifications, this is always storage#notification.
|
81
|
+
#
|
82
|
+
# @return [String]
|
83
|
+
#
|
81
84
|
def kind
|
82
85
|
@gapi.kind
|
83
86
|
end
|
84
87
|
|
85
88
|
##
|
86
89
|
# The ID of the notification.
|
90
|
+
#
|
91
|
+
# @return [String]
|
92
|
+
#
|
87
93
|
def id
|
88
94
|
@gapi.id
|
89
95
|
end
|
90
96
|
|
91
97
|
##
|
92
98
|
# A URL that can be used to access the notification using the REST API.
|
99
|
+
#
|
100
|
+
# @return [String]
|
101
|
+
#
|
93
102
|
def api_url
|
94
103
|
@gapi.self_link
|
95
104
|
end
|
@@ -98,6 +107,9 @@ module Google
|
|
98
107
|
# The custom attributes of this notification. An optional list of
|
99
108
|
# additional attributes to attach to each Cloud Pub/Sub message
|
100
109
|
# published for this notification subscription.
|
110
|
+
#
|
111
|
+
# @return [Hash(String => String)]
|
112
|
+
#
|
101
113
|
def custom_attrs
|
102
114
|
@gapi.custom_attributes
|
103
115
|
end
|
@@ -133,6 +145,8 @@ module Google
|
|
133
145
|
# explicitly specify in their notification configuration which event
|
134
146
|
# types they are prepared to accept.
|
135
147
|
#
|
148
|
+
# @return [Array<String>]
|
149
|
+
#
|
136
150
|
def event_types
|
137
151
|
@gapi.event_types
|
138
152
|
end
|
@@ -142,6 +156,8 @@ module Google
|
|
142
156
|
# this notification configuration to file names that begin with this
|
143
157
|
# prefix.
|
144
158
|
#
|
159
|
+
# @return [String]
|
160
|
+
#
|
145
161
|
def prefix
|
146
162
|
@gapi.object_name_prefix
|
147
163
|
end
|
@@ -156,6 +172,8 @@ module Google
|
|
156
172
|
# of the file's metadata.
|
157
173
|
# * `NONE` - No payload is included with the notification.
|
158
174
|
#
|
175
|
+
# @return [String]
|
176
|
+
#
|
159
177
|
def payload
|
160
178
|
@gapi.payload_format
|
161
179
|
end
|
@@ -164,6 +182,9 @@ module Google
|
|
164
182
|
# The Cloud Pub/Sub topic to which this subscription publishes.
|
165
183
|
# Formatted as:
|
166
184
|
# `//pubsub.googleapis.com/projects/{project-id}/topics/{my-topic}`
|
185
|
+
#
|
186
|
+
# @return [String]
|
187
|
+
#
|
167
188
|
def topic
|
168
189
|
@gapi.topic
|
169
190
|
end
|
@@ -61,6 +61,8 @@ module Google
|
|
61
61
|
##
|
62
62
|
# The Storage project connected to.
|
63
63
|
#
|
64
|
+
# @return [String]
|
65
|
+
#
|
64
66
|
# @example
|
65
67
|
# require "google/cloud/storage"
|
66
68
|
#
|
@@ -76,6 +78,18 @@ module Google
|
|
76
78
|
end
|
77
79
|
alias project project_id
|
78
80
|
|
81
|
+
##
|
82
|
+
# The Google Cloud Storage managed service account created for the
|
83
|
+
# project used to initialize the client library. (See also
|
84
|
+
# {#project_id}.)
|
85
|
+
#
|
86
|
+
# @return [String] The service account email address.
|
87
|
+
#
|
88
|
+
def service_account_email
|
89
|
+
@service_account_email ||= \
|
90
|
+
service.project_service_account.email_address
|
91
|
+
end
|
92
|
+
|
79
93
|
##
|
80
94
|
# Retrieves a list of buckets for the given project.
|
81
95
|
#
|
@@ -411,6 +425,8 @@ module Google
|
|
411
425
|
# corresponding values. (These values can be permanently set using
|
412
426
|
# {File#content_disposition=} and {File#content_type=}.)
|
413
427
|
#
|
428
|
+
# @return [String]
|
429
|
+
#
|
414
430
|
# @example
|
415
431
|
# require "google/cloud/storage"
|
416
432
|
#
|
@@ -63,6 +63,10 @@ module Google
|
|
63
63
|
end
|
64
64
|
attr_accessor :mocked_service
|
65
65
|
|
66
|
+
def project_service_account
|
67
|
+
service.get_project_service_account project
|
68
|
+
end
|
69
|
+
|
66
70
|
##
|
67
71
|
# Retrieves a list of buckets for the given project.
|
68
72
|
def list_buckets prefix: nil, token: nil, max: nil, user_project: nil
|
@@ -558,6 +562,8 @@ module Google
|
|
558
562
|
|
559
563
|
# rubocop:disable all
|
560
564
|
|
565
|
+
# @private
|
566
|
+
#
|
561
567
|
# IMPORTANT: These monkey-patches of Apis::StorageV1::StorageService and
|
562
568
|
# Apis::Core::DownloadCommand must be verified and updated (if needed) for
|
563
569
|
# every upgrade of google-api-client.
|
@@ -569,7 +575,9 @@ module Google
|
|
569
575
|
# solution instead.
|
570
576
|
#
|
571
577
|
module Apis
|
578
|
+
# @private
|
572
579
|
module StorageV1
|
580
|
+
# @private
|
573
581
|
class StorageService
|
574
582
|
# Returns a two-element array containing:
|
575
583
|
# * The `result` that is the usual return type of #get_object.
|
@@ -613,7 +621,9 @@ module Google
|
|
613
621
|
end
|
614
622
|
end
|
615
623
|
end
|
624
|
+
# @private
|
616
625
|
module Core
|
626
|
+
# @private
|
617
627
|
# Streaming/resumable media download support
|
618
628
|
class DownloadCommand < ApiCommand
|
619
629
|
# Returns a two-element array containing:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.13.
|
4
|
+
version: 1.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-08-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -137,6 +137,20 @@ dependencies:
|
|
137
137
|
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '1.1'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: redcarpet
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '3.0'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '3.0'
|
140
154
|
- !ruby/object:Gem::Dependency
|
141
155
|
name: rubocop
|
142
156
|
requirement: !ruby/object:Gem::Requirement
|