Class: AWS::Glacier::Vault
- Defined in:
- lib/aws/glacier/vault.rb
Instance Attribute Summary collapse
-
#arn ⇒ String
readonly
The current value of arn.
-
#creation_date ⇒ Time
readonly
The current value of creation_date.
-
#last_inventory_date ⇒ Time
readonly
The current value of last_inventory_date.
- #name ⇒ String readonly
-
#number_of_archives ⇒ Integer
readonly
The current value of number_of_archives.
-
#size_in_bytes ⇒ Integer
readonly
The current value of size_in_bytes.
Attributes inherited from Resource
Instance Method Summary collapse
- #archives ⇒ ArchiveCollection
- #configure_notifications(topic, events) ⇒ VaultNotificationConfiguration
-
#delete ⇒ nil
Deletes the current vault.
-
#exists? ⇒ Boolean
Returns
true
if the vault exists. -
#initialize(name, options = {}) ⇒ Vault
constructor
A new instance of Vault.
- #notification_configuration ⇒ VaultNotificationConfiguration?
-
#notification_configuration=(cfg) ⇒ Object
Sets the notification configuration for this vault.
Constructor Details
#initialize(name, options = {}) ⇒ Vault
Returns a new instance of Vault.
33 34 35 36 |
# File 'lib/aws/glacier/vault.rb', line 33 def initialize name, = {} @name = name super end |
Instance Attribute Details
#arn ⇒ String (readonly)
Returns the current value of arn.
28 29 30 |
# File 'lib/aws/glacier/vault.rb', line 28 def arn @arn end |
#creation_date ⇒ Time (readonly)
Returns 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_date ⇒ Time (readonly)
Returns 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 |
#name ⇒ String (readonly)
39 40 41 |
# File 'lib/aws/glacier/vault.rb', line 39 def name @name end |
#number_of_archives ⇒ Integer (readonly)
Returns 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_bytes ⇒ Integer (readonly)
Returns 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
#archives ⇒ ArchiveCollection
71 72 73 |
# File 'lib/aws/glacier/vault.rb', line 71 def archives ArchiveCollection.new(self) end |
#configure_notifications(topic, events) ⇒ VaultNotificationConfiguration
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 |
#delete ⇒ nil
Deletes the current vault. You can only delete an empty vault.
125 126 127 128 |
# File 'lib/aws/glacier/vault.rb', line 125 def delete client.delete_vault() nil end |
#exists? ⇒ 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 => account_id) true rescue Errors::ResourceNotFoundException false end |
#notification_configuration ⇒ VaultNotificationConfiguration?
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() 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
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!() 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() end end |