class AWS::Glacier::Vault
@attr_reader [String] arn
@attr_reader [Integer] size_in_bytes
@attr_reader [Integer] number_of_archives
@attr_reader [Time] creation_date
@attr_reader [Time] last_inventory_date
Attributes
@return [String]
Public Class Methods
@param [String] name @param [Hash] options @option options [String] :account_id
AWS::Glacier::Resource::new
# File lib/aws/glacier/vault.rb, line 33 def initialize name, options = {} @name = name super end
Public Instance Methods
@return [ArchiveCollection]
# File lib/aws/glacier/vault.rb, line 71 def archives ArchiveCollection.new(self) end
@param [String,SNS::Topic] topic The SNS
topic ARN string or an
SNS::Topic object to send event notifications to.
@param [Array<String>] events An array of one or more events for
which you want Amazon Glacier to send notifications. Valid values include: * 'ArchiveRetrievalCompleted' * 'InventoryRetrievalCompleted'
@return [VaultNotificationConfiguration]
# 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
Deletes the current vault. You can only delete an empty vault. @return [nil]
# File lib/aws/glacier/vault.rb, line 125 def delete client.delete_vault(resource_options) nil end
@return [Boolean] Returns true
if the vault exists.
# 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
@return [VaultNotificationConfiguration,nil]
# 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
Sets the notification configuration for this vault. If you pass a nil
value, the notification configuration will be deleted @param [VaultNotificationConfiguration] cfg
# 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
Protected Instance Methods
# File lib/aws/glacier/vault.rb, line 132 def get_resource attr = nil client.describe_vault(resource_options) end
# File lib/aws/glacier/vault.rb, line 136 def resource_identifiers [ [:vault_name, name], [:account_id, account_id], ] end