You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: AWS::Glacier::Vault

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

Instance Attribute Summary collapse

Attributes inherited from Resource

#account_id

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Vault

Returns a new instance of Vault

Parameters:

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

Options Hash (options):

  • :account_id (String)


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

def initialize name, options = {}
  @name = name
  super
end

Instance Attribute Details

#arnString (readonly)

Returns the current value of arn

Returns:

  • (String)

    the current value of arn



28
29
30
# File 'lib/aws/glacier/vault.rb', line 28

def arn
  @arn
end

#creation_dateTime (readonly)

Returns the current value of creation_date

Returns:

  • (Time)

    the current value of creation_date



28
29
30
# File 'lib/aws/glacier/vault.rb', line 28

def creation_date
  @creation_date
end

#last_inventory_dateTime (readonly)

Returns the current value of last_inventory_date

Returns:

  • (Time)

    the current value of last_inventory_date



28
29
30
# File 'lib/aws/glacier/vault.rb', line 28

def last_inventory_date
  @last_inventory_date
end

#nameString (readonly)

Returns:

  • (String)


39
40
41
# File 'lib/aws/glacier/vault.rb', line 39

def name
  @name
end

#number_of_archivesInteger (readonly)

Returns the current value of number_of_archives

Returns:

  • (Integer)

    the current value of number_of_archives



28
29
30
# File 'lib/aws/glacier/vault.rb', line 28

def number_of_archives
  @number_of_archives
end

#size_in_bytesInteger (readonly)

Returns the current value of size_in_bytes

Returns:

  • (Integer)

    the current value of size_in_bytes



28
29
30
# File 'lib/aws/glacier/vault.rb', line 28

def size_in_bytes
  @size_in_bytes
end

Instance Method Details

#archivesArchiveCollection

Returns:



71
72
73
# File 'lib/aws/glacier/vault.rb', line 71

def archives
  ArchiveCollection.new(self, :account_id => )
end

#configure_notifications(topic, events) ⇒ VaultNotificationConfiguration

Parameters:

  • topic (String, SNS::Topic)

    The SNS topic ARN string or an SNS::Topic object to send event notifications to.

  • events (Array<String>)

    An array of one or more events for which you want Amazon Glacier to send notifications. Valid values include: * 'ArchiveRetrievalCompleted' * 'InventoryRetrievalCompleted'

Returns:



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/aws/glacier/vault.rb', line 83

def configure_notifications topic, events

  topic_arn = topic.is_a?(String) ? topic : topic.arn

  cfg = VaultNotificationConfiguration.new
  cfg.sns_topic = SNS::Topic.new(topic_arn, :config => config)
  cfg.events = events
  cfg

  self.notification_configuration = cfg

end

#deletenil

Deletes the current vault. You can only delete an empty vault.

Returns:

  • (nil)


125
126
127
128
# File 'lib/aws/glacier/vault.rb', line 125

def delete
  client.delete_vault(resource_options)
  nil
end

#exists?Boolean

Returns true if the vault exists.

Returns:

  • (Boolean)

    Returns true if the vault exists.



63
64
65
66
67
68
# File 'lib/aws/glacier/vault.rb', line 63

def exists?
  client.describe_vault(:vault_name => name, :account_id => )
  true
rescue Errors::ResourceNotFoundException
  false
end

#notification_configurationVaultNotificationConfiguration?



97
98
99
100
101
102
103
104
105
# File 'lib/aws/glacier/vault.rb', line 97

def notification_configuration
  resp = client.get_vault_notifications(resource_options)
  cfg = VaultNotificationConfiguration.new
  cfg.sns_topic = SNS::Topic.new(resp[:sns_topic], :config => config)
  cfg.events = resp[:events]
  cfg
rescue Errors::ResourceNotFoundException
  nil
end

#notification_configuration=(cfg) ⇒ Object

Sets the notification configuration for this vault. If you pass a nil value, the notification configuration will be deleted

Parameters:



110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/aws/glacier/vault.rb', line 110

def notification_configuration= cfg
  if cfg
    opts = {}
    opts.merge!(resource_options)
    opts[:vault_notification_config] = {}
    opts[:vault_notification_config][:sns_topic] = cfg.sns_topic.arn
    opts[:vault_notification_config][:events] = cfg.events
    client.set_vault_notifications(opts)
  else
    client.delete_vault_notifications(resource_options)
  end
end