class Builderator::Model::Cleaner::Volumes

EC2 Volume Resources

Constants

PROPERTIES

Public Instance Methods

fetch() click to toggle source
# File lib/builderator/model/cleaner/volumes.rb, line 18
def fetch
  @resources = {}.tap do |v|
    Util.ec2.describe_volumes.each do |page|
      page.volumes.each do |vol|
        properties = Util.from_tags(vol.tags)
        properties['creation_date'] = vol.create_time.to_datetime
        PROPERTIES.each { |pp| properties[pp] = vol[pp.to_sym] }

        v[vol.volume_id] = {
          :id => vol.volume_id,
          :properties => properties,
          :snapshot => vol.snapshot_id
        }
      end
    end
  end
end
in_use() click to toggle source
# File lib/builderator/model/cleaner/volumes.rb, line 40
def in_use
  {}.tap do |used|
    used.merge!(select(Cleaner.instances.volumes))
  end
end
snapshots() click to toggle source
# File lib/builderator/model/cleaner/volumes.rb, line 36
def snapshots
  resources.values.map { |v| v[:snapshot] }
end