Class: ArchivedRemoteObject::AwsS3::ArchivedObject
- Inherits:
-
Object
- Object
- ArchivedRemoteObject::AwsS3::ArchivedObject
- Defined in:
- lib/archived_remote_object/aws_s3/archived_object.rb
Constant Summary collapse
- RestoreResponseChangedError =
Class.new(StandardError)
Instance Method Summary collapse
- #archived? ⇒ Boolean
- #debug_state ⇒ Object
-
#initialize(key:, remote_object: AwsS3::RemoteObject.new(key: key)) ⇒ ArchivedObject
constructor
A new instance of ArchivedObject.
- #restore ⇒ Object
- #restore_in_progress? ⇒ Boolean
- #restored? ⇒ Boolean
- #stop_archiving_on_duration ⇒ Object
- #sync ⇒ Object
Constructor Details
#initialize(key:, remote_object: AwsS3::RemoteObject.new(key: key)) ⇒ ArchivedObject
Returns a new instance of ArchivedObject.
8 9 10 11 12 13 14 |
# File 'lib/archived_remote_object/aws_s3/archived_object.rb', line 8 def initialize( key:, remote_object: AwsS3::RemoteObject.new(key: key) ) self.key = key self.remote_object = remote_object end |
Instance Method Details
#archived? ⇒ Boolean
16 17 18 |
# File 'lib/archived_remote_object/aws_s3/archived_object.rb', line 16 def archived? remote_object.attributes.storage_class == "DEEP_ARCHIVE" end |
#debug_state ⇒ Object
45 46 47 |
# File 'lib/archived_remote_object/aws_s3/archived_object.rb', line 45 def debug_state remote_object.debug_state end |
#restore ⇒ Object
33 34 35 |
# File 'lib/archived_remote_object/aws_s3/archived_object.rb', line 33 def restore remote_object.restore(key: key, duration: restore_duration_days) end |
#restore_in_progress? ⇒ Boolean
20 21 22 23 24 25 |
# File 'lib/archived_remote_object/aws_s3/archived_object.rb', line 20 def restore_in_progress? restore_in_progress = parse_restore_status[0] return false unless restore_in_progress restore_in_progress.to_s.downcase == "true" end |
#restored? ⇒ Boolean
27 28 29 30 31 |
# File 'lib/archived_remote_object/aws_s3/archived_object.rb', line 27 def restored? return false unless expiry_date Time.parse(expiry_date) > Time.now end |
#stop_archiving_on_duration ⇒ Object
37 38 39 |
# File 'lib/archived_remote_object/aws_s3/archived_object.rb', line 37 def stop_archiving_on_duration remote_object.storage_class = 'STANDARD' end |
#sync ⇒ Object
41 42 43 |
# File 'lib/archived_remote_object/aws_s3/archived_object.rb', line 41 def sync tap { remote_object.sync } end |