class ArchivedRemoteObject::AwsS3::RemoteObject

Attributes

key[RW]
remote_client[RW]

Public Class Methods

new( key:, remote_client: AwsS3::Client.new ) click to toggle source
# File lib/archived_remote_object/aws_s3/remote_object.rb, line 8
def initialize(
  key:,
  remote_client: AwsS3::Client.new
)
  self.key = key
  self.remote_client = remote_client
end

Public Instance Methods

assign_tag(key:, value:) click to toggle source
# File lib/archived_remote_object/aws_s3/remote_object.rb, line 26
def assign_tag(key:, value:)
  remote_client.assign_tag(key: self.key, set: [key, value])
end
attributes() click to toggle source
# File lib/archived_remote_object/aws_s3/remote_object.rb, line 16
def attributes
  return @attributes if @attributes

  fetch_attributes
end
debug_state() click to toggle source
# File lib/archived_remote_object/aws_s3/remote_object.rb, line 47
def debug_state
  {
    restore: attributes.restore,
    storage_class: attributes.storage_class
  }
end
delete() click to toggle source
# File lib/archived_remote_object/aws_s3/remote_object.rb, line 35
def delete
  remote_client.delete(key: key)
end
exists?() click to toggle source
# File lib/archived_remote_object/aws_s3/remote_object.rb, line 39
def exists?
  remote_client.exists?(key: key)
end
restore(**args) click to toggle source
# File lib/archived_remote_object/aws_s3/remote_object.rb, line 22
def restore(**args)
  remote_client.restore(**args)
end
storage_class=(storage_class) click to toggle source
# File lib/archived_remote_object/aws_s3/remote_object.rb, line 30
def storage_class=(storage_class)
  # accepts STANDARD, STANDARD_IA, ONEZONE_IA, GLACIER, INTELLIGENT_TIERING, DEEP_ARCHIVE
  remote_client.assign_storage_class(key: key, storage_class: storage_class)
end
sync() click to toggle source
# File lib/archived_remote_object/aws_s3/remote_object.rb, line 43
def sync
  tap { fetch_attributes }
end

Private Instance Methods

fetch_attributes() click to toggle source
# File lib/archived_remote_object/aws_s3/remote_object.rb, line 56
def fetch_attributes
  @attributes = remote_client.fetch_object_data(key: key)
end