Class: AWS::Glacier::ArchiveCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/glacier/archive_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(vault, options = {}) ⇒ ArchiveCollection

Returns a new instance of ArchiveCollection.

Parameters:

  • vault (Vault)
  • options (Hash) (defaults to: {})

Options Hash (options):

  • :account_id (String)


26
27
28
29
30
# File 'lib/aws/glacier/archive_collection.rb', line 26

def initialize vault, options = {}
  @vault = vault
  @account_id = options[:account_id] || '-'
  super
end

Instance Attribute Details

#account_idString (readonly)

Returns:

  • (String)


36
37
38
# File 'lib/aws/glacier/archive_collection.rb', line 36

def 
  @account_id
end

#vaultVault (readonly)

Returns:



33
34
35
# File 'lib/aws/glacier/archive_collection.rb', line 33

def vault
  @vault
end

Instance Method Details

#[](archive_id) ⇒ Archive

Parameters:

  • archive_id (String)

Returns:



68
69
70
# File 'lib/aws/glacier/archive_collection.rb', line 68

def [] archive_id
  Archive.new(vault, archive_id, :config => config, :account_id => )
end

#create(data, options = {}) ⇒ Archive

Creates an archive by uploading a file to a vault.

Parameters:

  • data (File, Pathname, IO, String)

    The data to upload. If data is a string, this is treated as a path to a file on disk.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • description (String)

Returns:



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, options = {}

  data = convert_to_io(data)

  hash, tree_hash = compute_checksums(data)

  upload_options = {}
  upload_options[:vault_name] = vault.name
  upload_options[:account_id] = 
  upload_options[:body] = data
  upload_options[:checksum] = tree_hash
  upload_options[:content_sha256] = hash
  upload_options[:archive_description] = options[:description] if
    options[:description]

  resp = client.upload_archive(upload_options)

  self[resp[:archive_id]]

end