Class: Google::Apis::StorageV1::Bucket::RetentionPolicy

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/storage_v1/classes.rb,
lib/google/apis/storage_v1/representations.rb,
lib/google/apis/storage_v1/representations.rb

Overview

The bucket's retention policy. The retention policy enforces a minimum retention time for all objects contained in the bucket, based on their creation time. Any attempt to overwrite or delete objects younger than the retention period will result in a PERMISSION_DENIED error. An unlocked retention policy can be modified or removed from the bucket via a storage. buckets.update operation. A locked retention policy cannot be removed or shortened in duration for the lifetime of the bucket. Attempting to remove or decrease period of a locked retention policy will result in a PERMISSION_DENIED error.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ RetentionPolicy

Returns a new instance of RetentionPolicy.



1025
1026
1027
# File 'lib/google/apis/storage_v1/classes.rb', line 1025

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#effective_timeDateTime

Server-determined value that indicates the time from which policy was enforced and effective. This value is in RFC 3339 format. Corresponds to the JSON property effectiveTime

Returns:

  • (DateTime)


1009
1010
1011
# File 'lib/google/apis/storage_v1/classes.rb', line 1009

def effective_time
  @effective_time
end

#is_lockedBoolean Also known as: is_locked?

Once locked, an object retention policy cannot be modified. Corresponds to the JSON property isLocked

Returns:

  • (Boolean)


1014
1015
1016
# File 'lib/google/apis/storage_v1/classes.rb', line 1014

def is_locked
  @is_locked
end

#retention_periodFixnum

The duration in seconds that objects need to be retained. Retention duration must be greater than zero and less than 100 years. Note that enforcement of retention periods less than a day is not guaranteed. Such periods should only be used for testing purposes. Corresponds to the JSON property retentionPeriod

Returns:

  • (Fixnum)


1023
1024
1025
# File 'lib/google/apis/storage_v1/classes.rb', line 1023

def retention_period
  @retention_period
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



1030
1031
1032
1033
1034
# File 'lib/google/apis/storage_v1/classes.rb', line 1030

def update!(**args)
  @effective_time = args[:effective_time] if args.key?(:effective_time)
  @is_locked = args[:is_locked] if args.key?(:is_locked)
  @retention_period = args[:retention_period] if args.key?(:retention_period)
end