Sha256: 91ad1ad227f15c82c206818bfb7544c11d1bd94e0a2354daba63bfa9207a63cb

Contents?: true

Size: 653 Bytes

Versions: 16

Compression:

Stored size: 653 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

16 entries across 16 versions & 1 rubygems

Version Path
yao-0.10.1 lib/yao/resources/image.rb
yao-0.10.0 lib/yao/resources/image.rb
yao-0.9.1 lib/yao/resources/image.rb
yao-0.9.0 lib/yao/resources/image.rb
yao-0.8.0 lib/yao/resources/image.rb
yao-0.7.0 lib/yao/resources/image.rb
yao-0.6.3 lib/yao/resources/image.rb
yao-0.6.2 lib/yao/resources/image.rb
yao-0.6.1 lib/yao/resources/image.rb
yao-0.6.0 lib/yao/resources/image.rb
yao-0.5.0 lib/yao/resources/image.rb
yao-0.4.3 lib/yao/resources/image.rb
yao-0.4.2 lib/yao/resources/image.rb
yao-0.4.1 lib/yao/resources/image.rb
yao-0.4.0 lib/yao/resources/image.rb
yao-0.3.8 lib/yao/resources/image.rb