Class: AWS::Glacier::ArchiveCollection
- Inherits:
-
Object
- Object
- AWS::Glacier::ArchiveCollection
- Defined in:
- lib/aws/glacier/archive_collection.rb
Instance Attribute Summary collapse
- #account_id ⇒ String readonly
- #vault ⇒ Vault readonly
Instance Method Summary collapse
- #[](archive_id) ⇒ Archive
-
#create(data, options = {}) ⇒ Archive
Creates an archive by uploading a file to a vault.
-
#initialize(vault, options = {}) ⇒ ArchiveCollection
constructor
A new instance of ArchiveCollection.
Constructor Details
#initialize(vault, options = {}) ⇒ ArchiveCollection
Returns a new instance of ArchiveCollection.
26 27 28 29 30 |
# File 'lib/aws/glacier/archive_collection.rb', line 26 def initialize vault, = {} @vault = vault @account_id = [:account_id] || '-' super end |
Instance Attribute Details
#account_id ⇒ String (readonly)
36 37 38 |
# File 'lib/aws/glacier/archive_collection.rb', line 36 def account_id @account_id end |
#vault ⇒ Vault (readonly)
33 34 35 |
# File 'lib/aws/glacier/archive_collection.rb', line 33 def vault @vault end |
Instance Method Details
#[](archive_id) ⇒ Archive
68 69 70 |
# File 'lib/aws/glacier/archive_collection.rb', line 68 def [] archive_id Archive.new(vault, archive_id, :config => config, :account_id => account_id) end |
#create(data, options = {}) ⇒ Archive
Creates an archive by uploading a file to a vault.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/aws/glacier/archive_collection.rb', line 45 def create data, = {} data = convert_to_io(data) hash, tree_hash = compute_checksums(data) = {} [:vault_name] = vault.name [:account_id] = account_id [:body] = data [:checksum] = tree_hash [:content_sha256] = hash [:archive_description] = [:description] if [:description] resp = client.upload_archive() self[resp[:archive_id]] end |