google-cloud-storage 1.14.2 → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a103ede9c229058fc56896c55d3d9526ee4efa20cb4769afdbc74e8f6fce547
4
- data.tar.gz: adfc02f59247159986db4745fd5eed1a5d41659cbb02b18f55dec1ff1e1ed992
3
+ metadata.gz: e598fdd23bab0f17c14744298b77e1519458f52a7e0b0e9d66c3986ca3da10cc
4
+ data.tar.gz: 7c1d3ec1f9a93e032f8f40a81eb4adfa725fc90970293f1dce573ded20bc0f49
5
5
  SHA512:
6
- metadata.gz: d74bef538ff7377a38951093ead007cbfcda6ffae8f0ba7d993a2c8530dac055e5ed397857ccb18df9e0d325ac7102d31eb4a85caeb1c890b6cfd7e27f8ea72e
7
- data.tar.gz: f4aa4ae66d1cd255ddf8268735ecaea24a790d03884ba621a5b39f689f7e06c61756772eb29a24a9a16207720d6c0b3377b30957925184d56cbaa66fa7f96c2f
6
+ metadata.gz: c47223d54f4bbac666083252a49b3a1853afeca995640e8ee54bf8b1f53e36231efb67e3ed57ea06a7da63328df829161b3eade1913bf7c374117f99400108c0
7
+ data.tar.gz: a68d2d5325c0414c5e0c4d9179ff1321b03f970d72c36544541a33e9458bf4c659e3d2be0c2f1eeb181a76001196f5cb76c132065dbbf64308a6035c53431ff6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Release History
2
2
 
3
+ ### 1.15.0 / 2018-10-03
4
+
5
+ * Add Bucket retention policy
6
+ * Add retention_policy fields and default_event_based_hold to Bucket.
7
+ * Add retention_policy and hold fields to File.
8
+ * Add Bucket#lock_retention_policy!
9
+ * Add Bucket#metageneration.
10
+ * Add Bucket#retention_policy_locked?
11
+ * Add File#(set|release)_temporary_hold!
12
+ * Add File#(set|release)_event_based_hold!
13
+
3
14
  ### 1.14.2 / 2018-09-20
4
15
 
5
16
  * Update documentation.
@@ -132,6 +132,15 @@ module Google
132
132
  @gapi.time_created
133
133
  end
134
134
 
135
+ ##
136
+ # The metadata generation of the bucket.
137
+ #
138
+ # @return [Integer] The metageneration.
139
+ #
140
+ def metageneration
141
+ @gapi.metageneration
142
+ end
143
+
135
144
  ##
136
145
  # Returns the current CORS configuration for a static website served
137
146
  # from the bucket.
@@ -545,6 +554,209 @@ module Google
545
554
  patch_gapi! :encryption
546
555
  end
547
556
 
557
+ ##
558
+ # The period of time (in seconds) that files in the bucket must be
559
+ # retained, and cannot be deleted, overwritten, or archived.
560
+ # The value must be between 0 and 100 years (in seconds.)
561
+ #
562
+ # See also: {#retention_period=}, {#retention_effective_at}, and
563
+ # {#retention_policy_locked?}.
564
+ #
565
+ # @return [Integer, nil] The retention period defined in seconds, if a
566
+ # retention policy exists for the bucket.
567
+ #
568
+ def retention_period
569
+ @gapi.retention_policy && @gapi.retention_policy.retention_period
570
+ end
571
+
572
+ ##
573
+ # The period of time (in seconds) that files in the bucket must be
574
+ # retained, and cannot be deleted, overwritten, or archived. Passing a
575
+ # valid Integer value will add a new retention policy to the bucket
576
+ # if none exists. Passing `nil` will remove the retention policy from
577
+ # the bucket if it exists, unless the policy is locked.
578
+ #
579
+ # Locked policies can be extended in duration by using this method
580
+ # to set a higher value. Such an extension is permanent, and it cannot
581
+ # later be reduced. The extended duration will apply retroactively to
582
+ # all files currently in the bucket.
583
+ #
584
+ # See also: {#lock_retention_policy!}, {#retention_period},
585
+ # {#retention_effective_at}, and {#retention_policy_locked?}.
586
+ #
587
+ # @param [Integer, nil] new_retention_period The retention period
588
+ # defined in seconds. The value must be between 0 and 100 years (in
589
+ # seconds), or `nil`.
590
+ #
591
+ # @example
592
+ # require "google/cloud/storage"
593
+ #
594
+ # storage = Google::Cloud::Storage.new
595
+ #
596
+ # bucket = storage.bucket "my-bucket"
597
+ #
598
+ # bucket.retention_period = 2592000 # 30 days in seconds
599
+ #
600
+ # file = bucket.create_file "path/to/local.file.ext"
601
+ # file.delete # raises Google::Cloud::PermissionDeniedError
602
+ #
603
+ def retention_period= new_retention_period
604
+ if new_retention_period.nil?
605
+ @gapi.retention_policy = nil
606
+ else
607
+ @gapi.retention_policy ||= \
608
+ Google::Apis::StorageV1::Bucket::RetentionPolicy.new
609
+ @gapi.retention_policy.retention_period = new_retention_period
610
+ end
611
+
612
+ patch_gapi! :retention_policy
613
+ end
614
+
615
+ ##
616
+ # The time from which the retention policy was effective. Whenever a
617
+ # retention policy is created or extended, GCS updates the effective
618
+ # date of the policy. The effective date signals the date starting from
619
+ # which objects were guaranteed to be retained for the full duration of
620
+ # the policy.
621
+ #
622
+ # This field is updated when the retention policy is created or
623
+ # modified, including extension of a locked policy.
624
+ #
625
+ # @return [DateTime, nil] The effective date of the bucket's retention
626
+ # policy, if a policy exists.
627
+ #
628
+ def retention_effective_at
629
+ @gapi.retention_policy && @gapi.retention_policy.effective_time
630
+ end
631
+
632
+ ##
633
+ # Whether the bucket's file retention policy is locked and its retention
634
+ # period cannot be reduced. See {#retention_period=} and
635
+ # {#lock_retention_policy!}.
636
+ #
637
+ # This value can only be set to `true` by calling
638
+ # {Bucket#lock_retention_policy!}.
639
+ #
640
+ # @return [Boolean] Returns `false` if there is no retention policy or
641
+ # if the retention policy is unlocked and the retention period can be
642
+ # reduced. Returns `true` if the retention policy is locked and the
643
+ # retention period cannot be reduced.
644
+ #
645
+ # @example
646
+ # require "google/cloud/storage"
647
+ #
648
+ # storage = Google::Cloud::Storage.new
649
+ #
650
+ # bucket = storage.bucket "my-bucket"
651
+ #
652
+ # bucket.retention_period = 2592000 # 30 days in seconds
653
+ # bucket.lock_retention_policy!
654
+ # bucket.retention_policy_locked? # true
655
+ #
656
+ # file = bucket.create_file "path/to/local.file.ext"
657
+ # file.delete # raises Google::Cloud::PermissionDeniedError
658
+ #
659
+ def retention_policy_locked?
660
+ return false unless @gapi.retention_policy
661
+ !@gapi.retention_policy.is_locked.nil? &&
662
+ @gapi.retention_policy.is_locked
663
+ end
664
+
665
+ ##
666
+ # Whether the `event_based_hold` field for newly-created files in the
667
+ # bucket will be initially set to `true`. See
668
+ # {#default_event_based_hold=}, {File#event_based_hold?} and
669
+ # {File#set_event_based_hold!}.
670
+ #
671
+ # @return [Boolean] Returns `true` if the `event_based_hold` field for
672
+ # newly-created files in the bucket will be initially set to `true`,
673
+ # otherwise `false`.
674
+ #
675
+ def default_event_based_hold?
676
+ !@gapi.default_event_based_hold.nil? && @gapi.default_event_based_hold
677
+ end
678
+
679
+ ##
680
+ # Updates the default event-based hold field for the bucket. This field
681
+ # controls the initial state of the `event_based_hold` field for
682
+ # newly-created files in the bucket.
683
+ #
684
+ # See {File#event_based_hold?} and {File#set_event_based_hold!}.
685
+ #
686
+ # @param [Boolean] new_default_event_based_hold The default event-based
687
+ # hold field for the bucket.
688
+ #
689
+ # @example
690
+ # require "google/cloud/storage"
691
+ #
692
+ # storage = Google::Cloud::Storage.new
693
+ #
694
+ # bucket = storage.bucket "my-bucket"
695
+ #
696
+ # bucket.update do |b|
697
+ # b.retention_period = 2592000 # 30 days in seconds
698
+ # b.default_event_based_hold = true
699
+ # end
700
+ #
701
+ # file = bucket.create_file "path/to/local.file.ext"
702
+ # file.event_based_hold? # true
703
+ # file.delete # raises Google::Cloud::PermissionDeniedError
704
+ # file.release_event_based_hold!
705
+ #
706
+ # # The end of the retention period is calculated from the time that
707
+ # # the event-based hold was released.
708
+ # file.retention_expires_at
709
+ #
710
+ def default_event_based_hold= new_default_event_based_hold
711
+ @gapi.default_event_based_hold = new_default_event_based_hold
712
+ patch_gapi! :default_event_based_hold
713
+ end
714
+
715
+ ##
716
+ # PERMANENTLY locks the retention policy (see {#retention_period=}) on
717
+ # the bucket if one exists. The policy is transitioned to a locked state
718
+ # in which its duration cannot be reduced.
719
+ #
720
+ # Locked policies can be extended in duration by setting
721
+ # {#retention_period=} to a higher value. Such an extension is
722
+ # permanent, and it cannot later be reduced. The extended duration will
723
+ # apply retroactively to all files currently in the bucket.
724
+ #
725
+ # This method also [creates a
726
+ # lien](https://cloud.google.com/resource-manager/reference/rest/v1/liens/create)
727
+ # on the `resourcemanager.projects.delete` permission for the project
728
+ # containing the bucket.
729
+ #
730
+ # The bucket's metageneration value is required for the lock policy API
731
+ # call. Attempting to call this method on a bucket that was loaded with
732
+ # the `skip_lookup: true` option will result in an error.
733
+ #
734
+ # @return [Boolean] Returns `true` if the lock operation is successful.
735
+ #
736
+ # @example
737
+ # require "google/cloud/storage"
738
+ #
739
+ # storage = Google::Cloud::Storage.new
740
+ #
741
+ # bucket = storage.bucket "my-bucket"
742
+ #
743
+ # bucket.retention_period = 2592000 # 30 days in seconds
744
+ # bucket.lock_retention_policy!
745
+ # bucket.retention_policy_locked? # true
746
+ #
747
+ # file = bucket.create_file "path/to/local.file.ext"
748
+ # file.delete # raises Google::Cloud::PermissionDeniedError
749
+ #
750
+ # # Locked policies can be extended in duration
751
+ # bucket.retention_period = 7776000 # 90 days in seconds
752
+ #
753
+ def lock_retention_policy!
754
+ ensure_service!
755
+ @gapi = service.lock_bucket_retention_policy \
756
+ name, metageneration, user_project: user_project
757
+ true
758
+ end
759
+
548
760
  ##
549
761
  # Updates the bucket with changes made in the given block in a single
550
762
  # PATCH request. The following attributes may be set: {#cors},
@@ -909,7 +1121,8 @@ module Google
909
1121
  content_disposition: nil, content_encoding: nil,
910
1122
  content_language: nil, content_type: nil,
911
1123
  crc32c: nil, md5: nil, metadata: nil,
912
- storage_class: nil, encryption_key: nil, kms_key: nil
1124
+ storage_class: nil, encryption_key: nil, kms_key: nil,
1125
+ temporary_hold: nil, event_based_hold: nil
913
1126
  ensure_service!
914
1127
  options = { acl: File::Acl.predefined_rule_for(acl), md5: md5,
915
1128
  cache_control: cache_control, content_type: content_type,
@@ -918,6 +1131,8 @@ module Google
918
1131
  content_language: content_language, key: encryption_key,
919
1132
  kms_key: kms_key,
920
1133
  storage_class: storage_class_for(storage_class),
1134
+ temporary_hold: temporary_hold,
1135
+ event_based_hold: event_based_hold,
921
1136
  user_project: user_project }
922
1137
  ensure_io_or_file_exists! file
923
1138
  path ||= file.path if file.respond_to? :path
@@ -447,6 +447,261 @@ module Google
447
447
  update_gapi! :storage_class
448
448
  end
449
449
 
450
+ ##
451
+ # Whether there is a temporary hold on the file. A temporary hold will
452
+ # be enforced on the file as long as this property is `true`, even if
453
+ # the bucket-level retention policy would normally allow deletion. When
454
+ # the temporary hold is removed, the normal bucket-level policy rules
455
+ # once again apply. The default value is `false`.
456
+ #
457
+ # @return [Boolean] Returns `true` if there is a temporary hold on the
458
+ # file, otherwise `false`.
459
+ #
460
+ # @example
461
+ # require "google/cloud/storage"
462
+ #
463
+ # storage = Google::Cloud::Storage.new
464
+ #
465
+ # bucket = storage.bucket "my-bucket"
466
+ # file = bucket.file "path/to/my-file.ext"
467
+ #
468
+ # file.temporary_hold? #=> false
469
+ # file.set_temporary_hold!
470
+ # file.delete # raises Google::Cloud::PermissionDeniedError
471
+ #
472
+ def temporary_hold?
473
+ !@gapi.temporary_hold.nil? && @gapi.temporary_hold
474
+ end
475
+
476
+ ##
477
+ # Sets the temporary hold property of the file to `true`. This property
478
+ # is used to enforce a temporary hold on a file. While it is set to
479
+ # `true`, the file is protected against deletion and overwrites. Once
480
+ # removed, the file's `retention_expires_at` date is not changed. The
481
+ # default value is `false`.
482
+ #
483
+ # See {#retention_expires_at}.
484
+ #
485
+ # @example
486
+ # require "google/cloud/storage"
487
+ #
488
+ # storage = Google::Cloud::Storage.new
489
+ #
490
+ # bucket = storage.bucket "my-bucket"
491
+ # file = bucket.file "path/to/my-file.ext"
492
+ #
493
+ # file.temporary_hold? #=> false
494
+ # file.set_temporary_hold!
495
+ # file.delete # raises Google::Cloud::PermissionDeniedError
496
+ #
497
+ def set_temporary_hold!
498
+ @gapi.temporary_hold = true
499
+ update_gapi! :temporary_hold
500
+ end
501
+
502
+ ##
503
+ # Sets the temporary hold property of the file to `false`. This property
504
+ # is used to enforce a temporary hold on a file. While it is set to
505
+ # `true`, the file is protected against deletion and overwrites. Once
506
+ # removed, the file's `retention_expires_at` date is not changed. The
507
+ # default value is `false`.
508
+ #
509
+ # See {#retention_expires_at}.
510
+ #
511
+ # @example
512
+ # require "google/cloud/storage"
513
+ #
514
+ # storage = Google::Cloud::Storage.new
515
+ #
516
+ # bucket = storage.bucket "my-bucket"
517
+ # file = bucket.file "path/to/my-file.ext"
518
+ #
519
+ # file.temporary_hold? #=> false
520
+ # file.set_temporary_hold!
521
+ # file.delete # raises Google::Cloud::PermissionDeniedError
522
+ #
523
+ # file.release_temporary_hold!
524
+ # file.delete
525
+ #
526
+ def release_temporary_hold!
527
+ @gapi.temporary_hold = false
528
+ update_gapi! :temporary_hold
529
+ end
530
+
531
+ ##
532
+ # Whether there is an event-based hold on the file. An event-based
533
+ # hold will be enforced on the file as long as this property is `true`,
534
+ # even if the bucket-level retention policy would normally allow
535
+ # deletion. Removing the event-based hold extends the retention duration
536
+ # of the file to the current date plus the bucket-level policy duration.
537
+ # Removing the event-based hold represents that a retention-related
538
+ # event has occurred, and thus the retention clock ticks from the moment
539
+ # of the event as opposed to the creation date of the object. The
540
+ # default value is configured at the bucket level (which defaults to
541
+ # `false`), and is assigned to newly-created objects.
542
+ #
543
+ # See {#set_event_based_hold!}, {#release_event_based_hold!},
544
+ # {Bucket#default_event_based_hold?} and
545
+ # {Bucket#default_event_based_hold=}.
546
+ #
547
+ # If a bucket's retention policy duration is modified after the
548
+ # event-based hold flag is unset, the updated retention duration applies
549
+ # retroactively to objects that previously had event-based holds. For
550
+ # example:
551
+ #
552
+ # * If the bucket's [unlocked] retention policy is removed, objects with
553
+ # event-based holds may be deleted immediately after the hold is
554
+ # removed (the duration of a nonexistent policy for the purpose of
555
+ # event-based holds is considered to be zero).
556
+ # * If the bucket's [unlocked] policy is reduced, objects with
557
+ # previously released event-based holds will be have their retention
558
+ # expiration dates reduced accordingly.
559
+ # * If the bucket's policy is extended, objects with previously released
560
+ # event-based holds will have their retention expiration dates
561
+ # extended accordingly. However, note that objects with event-based
562
+ # holds released prior to the effective date of the new policy may
563
+ # have already been deleted by the user.
564
+ #
565
+ # @return [Boolean] Returns `true` if there is an event-based hold on
566
+ # the file, otherwise `false`.
567
+ #
568
+ # @example
569
+ # require "google/cloud/storage"
570
+ #
571
+ # storage = Google::Cloud::Storage.new
572
+ #
573
+ # bucket = storage.bucket "my-bucket"
574
+ # bucket.retention_period = 2592000 # 30 days in seconds
575
+ #
576
+ # file = bucket.file "path/to/my-file.ext"
577
+ #
578
+ # file.event_based_hold? #=> false
579
+ # file.set_event_based_hold!
580
+ # file.delete # raises Google::Cloud::PermissionDeniedError
581
+ # file.release_event_based_hold!
582
+ #
583
+ # # The end of the retention period is calculated from the time that
584
+ # # the event-based hold was released.
585
+ # file.retention_expires_at
586
+ #
587
+ def event_based_hold?
588
+ !@gapi.event_based_hold.nil? && @gapi.event_based_hold
589
+ end
590
+
591
+ ##
592
+ # Sets the event-based hold property of the file to `true`. This
593
+ # property enforces an event-based hold on the file as long as this
594
+ # property is `true`, even if the bucket-level retention policy would
595
+ # normally allow deletion. The default value is configured at the
596
+ # bucket level (which defaults to `false`), and is assigned to
597
+ # newly-created objects.
598
+ #
599
+ # See {#event_based_hold?}, {#release_event_based_hold!},
600
+ # {Bucket#default_event_based_hold?} and
601
+ # {Bucket#default_event_based_hold=}.
602
+ #
603
+ # If a bucket's retention policy duration is modified after the
604
+ # event-based hold is removed, the updated retention duration applies
605
+ # retroactively to objects that previously had event-based holds. For
606
+ # example:
607
+ #
608
+ # * If the bucket's [unlocked] retention policy is removed, objects with
609
+ # event-based holds may be deleted immediately after the hold is
610
+ # removed (the duration of a nonexistent policy for the purpose of
611
+ # event-based holds is considered to be zero).
612
+ # * If the bucket's [unlocked] policy is reduced, objects with
613
+ # previously released event-based holds will be have their retention
614
+ # expiration dates reduced accordingly.
615
+ # * If the bucket's policy is extended, objects with previously released
616
+ # event-based holds will have their retention expiration dates
617
+ # extended accordingly. However, note that objects with event-based
618
+ # holds released prior to the effective date of the new policy may
619
+ # have already been deleted by the user.
620
+ #
621
+ # @example
622
+ # require "google/cloud/storage"
623
+ #
624
+ # storage = Google::Cloud::Storage.new
625
+ #
626
+ # bucket = storage.bucket "my-bucket"
627
+ # bucket.retention_period = 2592000 # 30 days in seconds
628
+ #
629
+ # file = bucket.file "path/to/my-file.ext"
630
+ #
631
+ # file.event_based_hold? #=> false
632
+ # file.set_event_based_hold!
633
+ # file.delete # raises Google::Cloud::PermissionDeniedError
634
+ # file.release_event_based_hold!
635
+ #
636
+ # # The end of the retention period is calculated from the time that
637
+ # # the event-based hold was released.
638
+ # file.retention_expires_at
639
+ #
640
+ def set_event_based_hold!
641
+ @gapi.event_based_hold = true
642
+ update_gapi! :event_based_hold
643
+ end
644
+
645
+ ##
646
+ # Sets the event-based hold property of the file to `false`. Removing
647
+ # the event-based hold extends the retention duration of the file to the
648
+ # current date plus the bucket-level policy duration. Removing the
649
+ # event-based hold represents that a retention-related event has
650
+ # occurred, and thus the retention clock ticks from the moment of the
651
+ # event as opposed to the creation date of the object. The default value
652
+ # is configured at the bucket level (which defaults to `false`), and is
653
+ # assigned to newly-created objects.
654
+ #
655
+ # See {#event_based_hold?}, {#set_event_based_hold!},
656
+ # {Bucket#default_event_based_hold?} and
657
+ # {Bucket#default_event_based_hold=}.
658
+ #
659
+ # @example
660
+ # require "google/cloud/storage"
661
+ #
662
+ # storage = Google::Cloud::Storage.new
663
+ #
664
+ # bucket = storage.bucket "my-bucket"
665
+ # bucket.retention_period = 2592000 # 30 days in seconds
666
+ #
667
+ # file = bucket.file "path/to/my-file.ext"
668
+ #
669
+ # file.event_based_hold? #=> false
670
+ # file.set_event_based_hold!
671
+ # file.delete # raises Google::Cloud::PermissionDeniedError
672
+ # file.release_event_based_hold!
673
+ #
674
+ # # The end of the retention period is calculated from the time that
675
+ # # the event-based hold was released.
676
+ # file.retention_expires_at
677
+ #
678
+ def release_event_based_hold!
679
+ @gapi.event_based_hold = false
680
+ update_gapi! :event_based_hold
681
+ end
682
+
683
+ ##
684
+ # The retention expiration time of the file. This field is indirectly
685
+ # mutable when the retention policy applicable to the object changes.
686
+ # The date represents the earliest time that the object could be
687
+ # deleted, assuming no temporary hold is set. (See {#temporary_hold?}.)
688
+ # It is provided when both of the following are true:
689
+ #
690
+ # * There is a retention policy on the bucket.
691
+ # * The eventBasedHold flag is unset on the object.
692
+ #
693
+ # Note that it can be provided even when {#temporary_hold?} is `true`
694
+ # (so that the user can reason about policy without having to first
695
+ # unset the temporary hold).
696
+ #
697
+ # @return [DateTime, nil] A DateTime representing the earliest time at
698
+ # which the object can be deleted, or `nil` if there are no
699
+ # restrictions on deleting the object.
700
+ #
701
+ def retention_expires_at
702
+ @gapi.retention_expiration_time
703
+ end
704
+
450
705
  ##
451
706
  # Retrieves a list of versioned files for the current object.
452
707
  #
@@ -1041,6 +1296,11 @@ module Google
1041
1296
  ##
1042
1297
  # Permanently deletes the file.
1043
1298
  #
1299
+ # Raises PermissionDeniedError if the object is subject to an active
1300
+ # retention policy or hold. (See {#retention_expires_at},
1301
+ # {Bucket#retention_period}, {#temporary_hold?} and
1302
+ # {#event_based_hold?}.)
1303
+ #
1044
1304
  # @param [Boolean, Integer] generation Specify a version of the file to
1045
1305
  # delete. When `true`, it will delete the version returned by
1046
1306
  # {#generation}. The default behavior is to delete the latest version
@@ -127,6 +127,17 @@ module Google
127
127
  end
128
128
  end
129
129
 
130
+ ##
131
+ # Locks retention policy on a bucket.
132
+ def lock_bucket_retention_policy bucket_name, metageneration,
133
+ user_project: nil
134
+ execute do
135
+ service.lock_bucket_retention_policy \
136
+ bucket_name, metageneration,
137
+ user_project: user_project(user_project)
138
+ end
139
+ end
140
+
130
141
  ##
131
142
  # Retrieves a list of ACLs for the given bucket.
132
143
  def list_bucket_acls bucket_name, user_project: nil
@@ -283,13 +294,15 @@ module Google
283
294
  content_encoding: nil, content_language: nil,
284
295
  content_type: nil, crc32c: nil, md5: nil, metadata: nil,
285
296
  storage_class: nil, key: nil, kms_key: nil,
297
+ temporary_hold: nil, event_based_hold: nil,
286
298
  user_project: nil
287
299
  file_obj = Google::Apis::StorageV1::Object.new(
288
300
  { cache_control: cache_control, content_type: content_type,
289
301
  content_disposition: content_disposition, md5_hash: md5,
290
302
  content_encoding: content_encoding, crc32c: crc32c,
291
303
  content_language: content_language, metadata: metadata,
292
- storage_class: storage_class }.delete_if { |_k, v| v.nil? }
304
+ storage_class: storage_class, temporary_hold: temporary_hold,
305
+ event_based_hold: event_based_hold }.delete_if { |_k, v| v.nil? }
293
306
  )
294
307
  content_type ||= mime_type_for(path || Pathname(source).to_path)
295
308
 
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Storage
19
- VERSION = "1.14.2".freeze
19
+ VERSION = "1.15.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.14.2
4
+ version: 1.15.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: 2018-09-21 00:00:00.000000000 Z
12
+ date: 2018-10-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core