google-cloud-storage 1.27.0 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: c1c5fde2ed35606723e05c787ff96fd6ec31d7e06015e09bcac8dc0bc4b9ae05
4
- data.tar.gz: bf1391389ff711934df5302f65cdf6136bad14b0a00865728da8fe3b549b3cbe
2
+ SHA1:
3
+ metadata.gz: 5141d81168421311ea103c5d466e2f0a1e6a6b6d
4
+ data.tar.gz: 352c5ac1297c6919c8a71d80bd61a24697692bd2
5
5
  SHA512:
6
- metadata.gz: 1e7d9a97562357737322928a56f093ed42bc8f8015a06723c5e403c402367a89f56604eeefb2bbbf289a7dce5b84ee055f76f3d6ef6df6d987f7f05ed5eed5fe
7
- data.tar.gz: 67046c8397a7e7fabf7b0a4d4e6501417ba815b55267e641a0ab51cdb233641e699348629a021763724aaca623e25a901395d77453b78fbc90ae67d4efca17b1
6
+ metadata.gz: 7bec28a4b4eebf986b43b9d06115955cc44ed03430f657b5f5eb9a2aff1ba26e77adcbbac9f2a57536f1734fda1c795664e65532f3476dcd085703aa8dc167b8
7
+ data.tar.gz: 894e70a45cf36a63158e07059a84a13e3a668d4730dab612a8acca3fdf532fa97e74e20a06bb86c037343e54c468a53fa16e2eaefbbe25e1cb9c0c198d007e82
@@ -1,5 +1,14 @@
1
1
  # Release History
2
2
 
3
+ ### 1.28.0 / 2020-08-26
4
+
5
+ * Add Object Lifecycle Management fields
6
+ * Add custom_time_before to Lifecycle::Rule
7
+ * Add days_since_custom_time to Lifecycle::Rule
8
+ * Add days_since_noncurrent_time to Lifecycle::Rule
9
+ * Add noncurrent_time_before to Lifecycle::Rule
10
+ * Add File#custom_time and #custom_time=
11
+
3
12
  ### 1.27.0 / 2020-07-29
4
13
 
5
14
  #### Features
@@ -1128,6 +1128,11 @@ module Google
1128
1128
  # @param [String] content_type The
1129
1129
  # [Content-Type](https://tools.ietf.org/html/rfc2616#section-14.17)
1130
1130
  # response header to be returned when the file is downloaded.
1131
+ # @param [DateTime] custom_time A custom time specified by the user for
1132
+ # the file. Once set, custom_time can't be unset, and it can only be
1133
+ # changed to a time in the future. If custom_time must be unset, you
1134
+ # must either perform a rewrite operation, or upload the data again
1135
+ # and create a new file.
1131
1136
  # @param [String] crc32c The CRC32c checksum of the file data, as
1132
1137
  # described in [RFC 4960, Appendix
1133
1138
  # B](http://tools.ietf.org/html/rfc4960#appendix-B).
@@ -1249,7 +1254,7 @@ module Google
1249
1254
  #
1250
1255
  def create_file file, path = nil, acl: nil, cache_control: nil,
1251
1256
  content_disposition: nil, content_encoding: nil,
1252
- content_language: nil, content_type: nil,
1257
+ content_language: nil, content_type: nil, custom_time: nil,
1253
1258
  crc32c: nil, md5: nil, metadata: nil,
1254
1259
  storage_class: nil, encryption_key: nil, kms_key: nil,
1255
1260
  temporary_hold: nil, event_based_hold: nil
@@ -1264,6 +1269,7 @@ module Google
1264
1269
  md5: md5,
1265
1270
  cache_control: cache_control,
1266
1271
  content_type: content_type,
1272
+ custom_time: custom_time,
1267
1273
  content_disposition: content_disposition,
1268
1274
  crc32c: crc32c,
1269
1275
  content_encoding: content_encoding,
@@ -105,6 +105,21 @@ module Google
105
105
  # only the date part (for instance, "2013-01-15"). This condition is
106
106
  # satisfied when a file is created before midnight of the specified
107
107
  # date in UTC.
108
+ # @param [String,Date] custom_time_before A date in RFC 3339 format with
109
+ # only the date part (for instance, "2013-01-15"). This condition is
110
+ # satisfied when the custom time on an object is before this date in UTC.
111
+ # @param [Integer] days_since_custom_time Represents the number of
112
+ # days elapsed since the user-specified timestamp set on an object.
113
+ # The condition is satisfied if the days elapsed is at least this
114
+ # number. If no custom timestamp is specified on an object, the
115
+ # condition does not apply.
116
+ # @param [Integer] days_since_noncurrent_time Represents the number of
117
+ # days elapsed since the noncurrent timestamp of an object. The
118
+ # condition is satisfied if the days elapsed is at least this number.
119
+ # The value of the field must be a nonnegative integer. If it's zero,
120
+ # the object version will become eligible for Lifecycle action as
121
+ # soon as it becomes noncurrent. Relevant only for versioning-enabled
122
+ # buckets. (See {Bucket#versioning?})
108
123
  # @param [Boolean] is_live Relevant only for versioned files. If the
109
124
  # value is `true`, this condition matches live files; if the value
110
125
  # is `false`, it matches archived files.
@@ -115,6 +130,10 @@ module Google
115
130
  # `DURABLE_REDUCED_AVAILABILITY` are supported as legacy storage
116
131
  # classes. Arguments will be converted from symbols and lower-case
117
132
  # to upper-case strings.
133
+ # @param [String,Date] noncurrent_time_before A date in RFC 3339 format
134
+ # with only the date part (for instance, "2013-01-15"). This condition
135
+ # is satisfied when the noncurrent time on an object is before this
136
+ # date in UTC. This condition is relevant only for versioned objects.
118
137
  # @param [Integer] num_newer_versions Relevant only for versioned
119
138
  # files. If the value is N, this condition is satisfied when there
120
139
  # are at least N versions (including the live version) newer than
@@ -129,16 +148,29 @@ module Google
129
148
  # b.lifecycle.add_set_storage_class_rule "COLDLINE", age: 10
130
149
  # end
131
150
  #
132
- def add_set_storage_class_rule storage_class, age: nil,
133
- created_before: nil, is_live: nil,
151
+ def add_set_storage_class_rule storage_class,
152
+ age: nil,
153
+ created_before: nil,
154
+ custom_time_before: nil,
155
+ days_since_custom_time: nil,
156
+ days_since_noncurrent_time: nil,
157
+ is_live: nil,
134
158
  matches_storage_class: nil,
159
+ noncurrent_time_before: nil,
135
160
  num_newer_versions: nil
136
- push Rule.new \
161
+ push Rule.new(
137
162
  "SetStorageClass",
138
163
  storage_class: storage_class_for(storage_class),
139
- age: age, created_before: created_before, is_live: is_live,
164
+ age: age,
165
+ created_before: created_before,
166
+ custom_time_before: custom_time_before,
167
+ days_since_custom_time: days_since_custom_time,
168
+ days_since_noncurrent_time: days_since_noncurrent_time,
169
+ is_live: is_live,
140
170
  matches_storage_class: storage_class_for(matches_storage_class),
171
+ noncurrent_time_before: noncurrent_time_before,
141
172
  num_newer_versions: num_newer_versions
173
+ )
142
174
  end
143
175
 
144
176
  ##
@@ -156,6 +188,21 @@ module Google
156
188
  # only the date part (for instance, "2013-01-15"). This condition is
157
189
  # satisfied when a file is created before midnight of the specified
158
190
  # date in UTC.
191
+ # @param [String,Date] custom_time_before A date in RFC 3339 format with
192
+ # only the date part (for instance, "2013-01-15"). This condition is
193
+ # satisfied when the custom time on an object is before this date in UTC.
194
+ # @param [Integer] days_since_custom_time Represents the number of
195
+ # days elapsed since the user-specified timestamp set on an object.
196
+ # The condition is satisfied if the days elapsed is at least this
197
+ # number. If no custom timestamp is specified on an object, the
198
+ # condition does not apply.
199
+ # @param [Integer] days_since_noncurrent_time Represents the number of
200
+ # days elapsed since the noncurrent timestamp of an object. The
201
+ # condition is satisfied if the days elapsed is at least this number.
202
+ # The value of the field must be a nonnegative integer. If it's zero,
203
+ # the object version will become eligible for Lifecycle action as
204
+ # soon as it becomes noncurrent. Relevant only for versioning-enabled
205
+ # buckets. (See {Bucket#versioning?})
159
206
  # @param [Boolean] is_live Relevant only for versioned files. If the
160
207
  # value is `true`, this condition matches live files; if the value
161
208
  # is `false`, it matches archived files.
@@ -166,6 +213,10 @@ module Google
166
213
  # `DURABLE_REDUCED_AVAILABILITY` are supported as legacy storage
167
214
  # classes. Arguments will be converted from symbols and lower-case
168
215
  # to upper-case strings.
216
+ # @param [String,Date] noncurrent_time_before A date in RFC 3339 format
217
+ # with only the date part (for instance, "2013-01-15"). This condition
218
+ # is satisfied when the noncurrent time on an object is before this
219
+ # date in UTC. This condition is relevant only for versioned objects.
169
220
  # @param [Integer] num_newer_versions Relevant only for versioned
170
221
  # files. If the value is N, this condition is satisfied when there
171
222
  # are at least N versions (including the live version) newer than
@@ -180,14 +231,27 @@ module Google
180
231
  # b.lifecycle.add_delete_rule age: 30, is_live: false
181
232
  # end
182
233
  #
183
- def add_delete_rule age: nil, created_before: nil, is_live: nil,
234
+ def add_delete_rule age: nil,
235
+ created_before: nil,
236
+ custom_time_before: nil,
237
+ days_since_custom_time: nil,
238
+ days_since_noncurrent_time: nil,
239
+ is_live: nil,
184
240
  matches_storage_class: nil,
241
+ noncurrent_time_before: nil,
185
242
  num_newer_versions: nil
186
- push Rule.new \
243
+ push Rule.new(
187
244
  "Delete",
188
- age: age, created_before: created_before, is_live: is_live,
245
+ age: age,
246
+ created_before: created_before,
247
+ custom_time_before: custom_time_before,
248
+ days_since_custom_time: days_since_custom_time,
249
+ days_since_noncurrent_time: days_since_noncurrent_time,
250
+ is_live: is_live,
189
251
  matches_storage_class: storage_class_for(matches_storage_class),
252
+ noncurrent_time_before: noncurrent_time_before,
190
253
  num_newer_versions: num_newer_versions
254
+ )
191
255
  end
192
256
 
193
257
  # @private
@@ -231,10 +295,26 @@ module Google
231
295
  # action. Required only if the action is `SetStorageClass`.
232
296
  # @attr [Integer] age The age of a file (in days). This condition is
233
297
  # satisfied when a file reaches the specified age.
234
- # @attr [String,Date] created_before A date in RFC 3339 format with
298
+ # @attr [String,Date,nil] created_before A date in RFC 3339 format with
235
299
  # only the date part (for instance, "2013-01-15"). This condition is
236
300
  # satisfied when a file is created before midnight of the specified
237
- # date in UTC.
301
+ # date in UTC. When returned by the service, a non-empty value will
302
+ # always be a Date object.
303
+ # @attr [String,Date,nil] custom_time_before A date in RFC 3339 format with
304
+ # only the date part (for instance, "2013-01-15"). This condition is
305
+ # satisfied when the custom time on an object is before this date in UTC.
306
+ # @attr [Integer,nil] days_since_custom_time Represents the number of
307
+ # days elapsed since the user-specified timestamp set on an object.
308
+ # The condition is satisfied if the days elapsed is at least this
309
+ # number. If no custom timestamp is specified on an object, the
310
+ # condition does not apply.
311
+ # @attr [Integer] days_since_noncurrent_time Represents the number of
312
+ # days elapsed since the noncurrent timestamp of an object. The
313
+ # condition is satisfied if the days elapsed is at least this number.
314
+ # The value of the field must be a nonnegative integer. If it's zero,
315
+ # the object version will become eligible for Lifecycle action as
316
+ # soon as it becomes noncurrent. Relevant only for versioning-enabled
317
+ # buckets. (See {Bucket#versioning?})
238
318
  # @attr [Boolean] is_live Relevant only for versioned files. If the
239
319
  # value is `true`, this condition matches live files; if the value
240
320
  # is `false`, it matches archived files.
@@ -243,6 +323,12 @@ module Google
243
323
  # Values include `STANDARD`, `NEARLINE`, `COLDLINE`, and `ARCHIVE`.
244
324
  # `REGIONAL`, `MULTI_REGIONAL`, and `DURABLE_REDUCED_AVAILABILITY`
245
325
  # are supported as legacy storage classes.
326
+ # @attr [String,Date,nil] noncurrent_time_before A date in RFC 3339 format
327
+ # with only the date part (for instance, "2013-01-15"). This condition
328
+ # is satisfied when the noncurrent time on an object is before this
329
+ # date in UTC. This condition is relevant only for versioned objects.
330
+ # When returned by the service, a non-empty value will always be a
331
+ # Date object.
246
332
  # @attr [Integer] num_newer_versions Relevant only for versioned
247
333
  # files. If the value is N, this condition is satisfied when there
248
334
  # are at least N versions (including the live version) newer than
@@ -285,28 +371,57 @@ module Google
285
371
  # end
286
372
  #
287
373
  class Rule
288
- attr_accessor :action, :storage_class, :age, :created_before,
289
- :is_live, :matches_storage_class, :num_newer_versions
374
+ attr_accessor :action,
375
+ :storage_class,
376
+ :age,
377
+ :created_before,
378
+ :custom_time_before,
379
+ :days_since_custom_time,
380
+ :days_since_noncurrent_time,
381
+ :is_live,
382
+ :matches_storage_class,
383
+ :noncurrent_time_before,
384
+ :num_newer_versions
290
385
 
291
386
  # @private
292
- def initialize action, storage_class: nil, age: nil,
293
- created_before: nil, is_live: nil,
294
- matches_storage_class: nil, num_newer_versions: nil
387
+ def initialize action,
388
+ storage_class: nil,
389
+ age: nil,
390
+ created_before: nil,
391
+ custom_time_before: nil,
392
+ days_since_custom_time: nil,
393
+ days_since_noncurrent_time: nil,
394
+ is_live: nil,
395
+ matches_storage_class: nil,
396
+ noncurrent_time_before: nil,
397
+ num_newer_versions: nil
295
398
  @action = action
296
399
  @storage_class = storage_class
297
400
  @age = age
298
401
  @created_before = created_before
402
+ @custom_time_before = custom_time_before
403
+ @days_since_custom_time = days_since_custom_time
404
+ @days_since_noncurrent_time = days_since_noncurrent_time
299
405
  @is_live = is_live
300
406
  @matches_storage_class = Array(matches_storage_class)
407
+ @noncurrent_time_before = noncurrent_time_before
301
408
  @num_newer_versions = num_newer_versions
302
409
  end
303
410
 
304
411
  # @private
305
412
  # @return [Google::Apis::StorageV1::Bucket::Lifecycle]
306
413
  def to_gapi
307
- condition = condition_gapi(age, created_before, is_live,
308
- matches_storage_class,
309
- num_newer_versions)
414
+ condition = condition_gapi(
415
+ age,
416
+ created_before,
417
+ custom_time_before,
418
+ days_since_custom_time,
419
+ days_since_noncurrent_time,
420
+ is_live,
421
+ matches_storage_class,
422
+ noncurrent_time_before,
423
+ num_newer_versions
424
+ )
310
425
  Google::Apis::StorageV1::Bucket::Lifecycle::Rule.new(
311
426
  action: action_gapi(action, storage_class),
312
427
  condition: condition
@@ -316,18 +431,30 @@ module Google
316
431
  # @private
317
432
  def action_gapi action, storage_class
318
433
  Google::Apis::StorageV1::Bucket::Lifecycle::Rule::Action.new(
319
- type: action, storage_class: storage_class
434
+ type: action,
435
+ storage_class: storage_class
320
436
  )
321
437
  end
322
438
 
323
439
  # @private
324
- def condition_gapi age, created_before, is_live,
325
- matches_storage_class, num_newer_versions
440
+ def condition_gapi age,
441
+ created_before,
442
+ custom_time_before,
443
+ days_since_custom_time,
444
+ days_since_noncurrent_time,
445
+ is_live,
446
+ matches_storage_class,
447
+ noncurrent_time_before,
448
+ num_newer_versions
326
449
  Google::Apis::StorageV1::Bucket::Lifecycle::Rule::Condition.new(
327
450
  age: age,
328
451
  created_before: created_before,
452
+ custom_time_before: custom_time_before,
453
+ days_since_custom_time: days_since_custom_time,
454
+ days_since_noncurrent_time: days_since_noncurrent_time,
329
455
  is_live: is_live,
330
456
  matches_storage_class: Array(matches_storage_class),
457
+ noncurrent_time_before: noncurrent_time_before,
331
458
  num_newer_versions: num_newer_versions
332
459
  )
333
460
  end
@@ -337,12 +464,19 @@ module Google
337
464
  def self.from_gapi gapi
338
465
  action = gapi.action
339
466
  c = gapi.condition
340
- new action.type, storage_class: action.storage_class,
341
- age: c.age,
342
- created_before: c.created_before,
343
- is_live: c.is_live,
344
- matches_storage_class: c.matches_storage_class,
345
- num_newer_versions: c.num_newer_versions
467
+ new(
468
+ action.type,
469
+ storage_class: action.storage_class,
470
+ age: c.age,
471
+ created_before: c.created_before,
472
+ custom_time_before: c.custom_time_before,
473
+ days_since_custom_time: c.days_since_custom_time,
474
+ days_since_noncurrent_time: c.days_since_noncurrent_time,
475
+ is_live: c.is_live,
476
+ matches_storage_class: c.matches_storage_class,
477
+ noncurrent_time_before: c.noncurrent_time_before,
478
+ num_newer_versions: c.num_newer_versions
479
+ )
346
480
  end
347
481
 
348
482
  # @private
@@ -355,6 +355,29 @@ module Google
355
355
  update_gapi! :content_type
356
356
  end
357
357
 
358
+ ##
359
+ # A custom time specified by the user for the file, or `nil`.
360
+ #
361
+ # @return [DateTime, nil]
362
+ #
363
+ def custom_time
364
+ @gapi.custom_time
365
+ end
366
+
367
+ ##
368
+ # Updates the custom time specified by the user for the file. Once set,
369
+ # custom_time can't be unset, and it can only be changed to a time in the
370
+ # future. If custom_time must be unset, you must either perform a rewrite
371
+ # operation, or upload the data again and create a new file.
372
+ #
373
+ # @param [DateTime] custom_time A custom time specified by the user
374
+ # for the file.
375
+ #
376
+ def custom_time= custom_time
377
+ @gapi.custom_time = custom_time
378
+ update_gapi! :custom_time
379
+ end
380
+
358
381
  ##
359
382
  # A hash of custom, user-provided web-safe keys and arbitrary string
360
383
  # values that will returned with requests for the file as "x-goog-meta-"
@@ -746,8 +769,9 @@ module Google
746
769
  # Updates the file with changes made in the given block in a single
747
770
  # PATCH request. The following attributes may be set: {#cache_control=},
748
771
  # {#content_disposition=}, {#content_encoding=}, {#content_language=},
749
- # {#content_type=}, and {#metadata=}. The {#metadata} hash accessible in
750
- # the block is completely mutable and will be included in the request.
772
+ # {#content_type=}, {#custom_time=} and {#metadata=}. The {#metadata} hash
773
+ # accessible in the block is completely mutable and will be included in the
774
+ # request.
751
775
  #
752
776
  # @yield [file] a block yielding a delegate object for updating the file
753
777
  #
@@ -766,6 +790,7 @@ module Google
766
790
  # f.content_encoding = "deflate"
767
791
  # f.content_language = "de"
768
792
  # f.content_type = "application/json"
793
+ # f.custom_time = DateTime.new 2025, 12, 31
769
794
  # f.metadata["player"] = "Bob"
770
795
  # f.metadata["score"] = "10"
771
796
  # end
@@ -292,12 +292,12 @@ module Google
292
292
  def insert_file bucket_name, source, path = nil, acl: nil,
293
293
  cache_control: nil, content_disposition: nil,
294
294
  content_encoding: nil, content_language: nil,
295
- content_type: nil, crc32c: nil, md5: nil, metadata: nil,
295
+ content_type: nil, custom_time: nil, crc32c: nil, md5: nil, metadata: nil,
296
296
  storage_class: nil, key: nil, kms_key: nil,
297
297
  temporary_hold: nil, event_based_hold: nil,
298
298
  user_project: nil
299
299
  params =
300
- { cache_control: cache_control, content_type: content_type,
300
+ { cache_control: cache_control, content_type: content_type, custom_time: custom_time,
301
301
  content_disposition: content_disposition, md5_hash: md5,
302
302
  content_encoding: content_encoding, crc32c: crc32c,
303
303
  content_language: content_language, metadata: metadata,
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Storage
19
- VERSION = "1.27.0".freeze
19
+ VERSION = "1.28.0".freeze
20
20
  end
21
21
  end
22
22
  end
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.27.0
4
+ version: 1.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-07-29 00:00:00.000000000 Z
12
+ date: 2020-08-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -298,7 +298,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
298
  - !ruby/object:Gem::Version
299
299
  version: '0'
300
300
  requirements: []
301
- rubygems_version: 3.1.3
301
+ rubyforge_project:
302
+ rubygems_version: 2.6.14.4
302
303
  signing_key:
303
304
  specification_version: 4
304
305
  summary: API Client library for Google Cloud Storage