class Aebus::EC2::Snapshot

Attributes

id[R]
start_time[R]
tags[R]
volume_id[R]

Public Class Methods

new(hash) click to toggle source
# File lib/ec2/snapshot.rb, line 16
def initialize(hash)

  raise(ArgumentError, 'hash cannot be nil') unless hash
  @keep
  @id = hash.snapshot_id
  @start_time = hash.start_time
  @volume_id = hash.volume_id
  @tags = Hash.new
  if hash.tags
    tag_array = hash.tags
    tag_array.each do |tag|
      @tags.store(tag.key,tag.value)
    end
  end
end

Public Instance Methods

aebus_removable_snapshot?() click to toggle source
# File lib/ec2/snapshot.rb, line 47
def aebus_removable_snapshot?
  return false unless aebus_snapshot?
  (aebus_tags & [AEBUS_MANUAL_TAG, AEBUS_KEEP_TAG]).count == 0
end
aebus_snapshot?() click to toggle source
# File lib/ec2/snapshot.rb, line 43
def aebus_snapshot?
  @tags.include?(AEBUS_TAG)
end
aebus_tags() click to toggle source
# File lib/ec2/snapshot.rb, line 52
def aebus_tags
  @tags[AEBUS_TAG].split(',')
end
aebus_tags_include?(label) click to toggle source
# File lib/ec2/snapshot.rb, line 36
def aebus_tags_include?(label)
  if aebus_snapshot?
    return aebus_tags.include? label
  end
  false
end
keep=(value) click to toggle source
# File lib/ec2/snapshot.rb, line 56
def keep= value
  @keep = value
end
keep?() click to toggle source
# File lib/ec2/snapshot.rb, line 60
def keep?
  @keep
end
to_s() click to toggle source
# File lib/ec2/snapshot.rb, line 32
def to_s
  "{snapshot_id => #{@id}, volume_id => #{@volume_id},  start_time => #{@start_time}, tags => #{@tags} "
end