Sha256: 527b66322481c98a8fae9bbf7d7f9d055ffbc5c91b0b688c1d5f385a194db54b

Contents?: true

Size: 660 Bytes

Versions: 30

Compression:

Stored size: 660 Bytes

Contents

require 'yao/resources/metadata_available'
module Yao::Resources
  class Image < Base
    friendly_attributes :name, :status, :progress, :metadata
    map_attribute_to_attribute :minDisk => :min_disk
    map_attribute_to_attribute :minRam  => :min_ram

    def size(unit=nil)
      size = self["OS-EXT-IMG-SIZE:size"]
      case unit
      when 'K'
        size / 1024.0
      when 'M'
        size / 1024.0 / 1024.0
      when 'G'
        size / 1024.0 / 1024.0 / 1024.0
      else
        size
      end
    end

    self.service        = "compute"
    self.resource_name  = "image"
    self.resources_name = "images"

    extend MetadataAvailable
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
yao-0.3.7 lib/yao/resources/image.rb
yao-0.3.6 lib/yao/resources/image.rb
yao-0.3.5 lib/yao/resources/image.rb
yao-0.3.4 lib/yao/resources/image.rb
yao-0.3.3 lib/yao/resources/image.rb
yao-0.3.2 lib/yao/resources/image.rb
yao-0.3.1 lib/yao/resources/image.rb
yao-0.3.0 lib/yao/resources/image.rb
yao-0.2.13 lib/yao/resources/image.rb
yao-0.2.12 lib/yao/resources/image.rb
yao-0.2.11 lib/yao/resources/image.rb
yao-0.2.10 lib/yao/resources/image.rb
yao-0.2.9 lib/yao/resources/image.rb
yao-0.2.8 lib/yao/resources/image.rb
yao-0.2.7 lib/yao/resources/image.rb
yao-0.2.6 lib/yao/resources/image.rb
yao-0.2.5 lib/yao/resources/image.rb
yao-0.2.4 lib/yao/resources/image.rb
yao-0.2.2 lib/yao/resources/image.rb
yao-0.2.1 lib/yao/resources/image.rb