Class: ArchivedRemoteObject::AwsS3::RemoteObject
- Inherits:
-
Object
- Object
- ArchivedRemoteObject::AwsS3::RemoteObject
- Defined in:
- lib/archived_remote_object/aws_s3/remote_object.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#remote_client ⇒ Object
Returns the value of attribute remote_client.
Instance Method Summary collapse
- #assign_tag(key:, value:) ⇒ Object
- #attributes ⇒ Object
- #debug_state ⇒ Object
- #delete ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(key:, remote_client: AwsS3::Client.new) ⇒ RemoteObject
constructor
A new instance of RemoteObject.
- #restore(**args) ⇒ Object
- #storage_class=(storage_class) ⇒ Object
- #sync ⇒ Object
Constructor Details
#initialize(key:, remote_client: AwsS3::Client.new) ⇒ RemoteObject
Returns a new instance of RemoteObject.
8 9 10 11 12 13 14 |
# 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 |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
6 7 8 |
# File 'lib/archived_remote_object/aws_s3/remote_object.rb', line 6 def key @key end |
#remote_client ⇒ Object
Returns the value of attribute remote_client.
6 7 8 |
# File 'lib/archived_remote_object/aws_s3/remote_object.rb', line 6 def remote_client @remote_client end |
Instance Method Details
#assign_tag(key:, value:) ⇒ Object
26 27 28 |
# 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 ⇒ Object
16 17 18 19 20 |
# File 'lib/archived_remote_object/aws_s3/remote_object.rb', line 16 def attributes return @attributes if @attributes fetch_attributes end |
#debug_state ⇒ Object
47 48 49 50 51 52 |
# 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 ⇒ Object
35 36 37 |
# File 'lib/archived_remote_object/aws_s3/remote_object.rb', line 35 def delete remote_client.delete(key: key) end |
#exists? ⇒ Boolean
39 40 41 |
# File 'lib/archived_remote_object/aws_s3/remote_object.rb', line 39 def exists? remote_client.exists?(key: key) end |
#restore(**args) ⇒ Object
22 23 24 |
# File 'lib/archived_remote_object/aws_s3/remote_object.rb', line 22 def restore(**args) remote_client.restore(**args) end |
#storage_class=(storage_class) ⇒ Object
30 31 32 33 |
# 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 ⇒ Object
43 44 45 |
# File 'lib/archived_remote_object/aws_s3/remote_object.rb', line 43 def sync tap { fetch_attributes } end |