Sha256: f92aac6a2df1367ffc15443b74a4dce366a06b2d703745f8f5bd470b2fa81f72

Contents?: true

Size: 731 Bytes

Versions: 5

Compression:

Stored size: 731 Bytes

Contents

module Yao::Resources
  class Flavor < Base
    friendly_attributes :name, :vcpus, :disk, :swap
    map_attribute_to_attribute "os-flavor-access:is_public" => :public?
    map_attribute_to_attribute "OS-FLV-DISABLED:disabled"   => :disabled?

    def ram(unit='M')
      case unit
      when 'M'
        self["ram"]
      when 'G'
        self["ram"] / 1024.0
      end
    end
    alias memory ram

    self.service        = "compute"
    self.resource_name  = "flavor"
    self.resources_name = "flavors"

    class << self
      def list_detail(query={})
        return_resources(
          resources_from_json(
            GET([resources_path, "detail"].join("/"), query).body
          )
        )
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yao-0.7.0 lib/yao/resources/flavor.rb
yao-0.6.3 lib/yao/resources/flavor.rb
yao-0.6.2 lib/yao/resources/flavor.rb
yao-0.6.1 lib/yao/resources/flavor.rb
yao-0.6.0 lib/yao/resources/flavor.rb