Sha256: 39a939f2bbc71b7cff1234ae783187d8f5cd3e44b1e56b26c25f1db119cfa4ec
Contents?: true
Size: 1.3 KB
Versions: 12
Compression:
Stored size: 1.3 KB
Contents
module OpenStack module Compute class Flavor attr_reader :id attr_reader :name attr_reader :ram attr_reader :disk # This class provides an object for the "Flavor" of a server. The Flavor can generally be taken as the server specification, # providing information on things like memory and disk space. # # The disk attribute is an integer representing the disk space in GB. The memory attribute is an integer representing the RAM in MB. # # This is called from the get_flavor method on a OpenStack::Compute::Connection object, returns a OpenStack::Compute::Flavor object, and will likely not be called directly. # # >> flavor = cs.get_flavor(1) # => #<OpenStack::Compute::Flavor:0x1014f8bc8 @name="256 server", @disk=10, @id=1, @ram=256> # >> flavor.name # => "256 server" def initialize(connection,id) response = connection.csreq("GET",connection.svrmgmthost,"#{connection.svrmgmtpath}/flavors/#{URI.escape(id.to_s)}",connection.svrmgmtport,connection.svrmgmtscheme) OpenStack::Compute::Exception.raise_exception(response) unless response.code.match(/^20.$/) data = JSON.parse(response.body)['flavor'] @id = data['id'] @name = data['name'] @ram = data['ram'] @disk = data['disk'] end end end end
Version data entries
12 entries across 12 versions & 1 rubygems