Class: Yao::Resources::Hypervisor

Inherits:
Base
  • Object
show all
Defined in:
lib/yao/resources/hypervisor.rb

Defined Under Namespace

Classes: Statistics, Uptime

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, #created, friendly_attributes, #id, #initialize, map_attribute_to_attribute, map_attribute_to_resource, map_attribute_to_resources, #to_hash, #updated

Methods included from RestfullyAccessible

#admin=, #api_version, #api_version=, #as_member, #client, #create, #destroy, extended, #find_by_name, #get, #get!, #list, #resources_path, #resources_path=, #return_single_on_querying, #return_single_on_querying=, #update

Constructor Details

This class inherits a constructor from Yao::Resources::Base

Class Method Details

.statisticsYao::Resources::Hypervisor::Statistics



41
42
43
44
# File 'lib/yao/resources/hypervisor.rb', line 41

def statistics
  json = GET([resources_path, "statistics"].join("/")).body
  Yao::Resources::Hypervisor::Statistics.new(json["hypervisor_statistics"])
end

.uptime(id) ⇒ Yao::Resources::Hypervisor::Uptime

Parameters:

  • id (String)

Returns:



48
49
50
51
# File 'lib/yao/resources/hypervisor.rb', line 48

def uptime(id)
  json = GET([resources_path, id, "uptime"].join("/")).body
  Yao::Resources::Hypervisor::Uptime.new(json["hypervisor"])
end

Instance Method Details

#cpu_infoHash

Returns:

  • (Hash)


11
12
13
# File 'lib/yao/resources/hypervisor.rb', line 11

def cpu_info
  JSON.parse self["cpu_info"]
end

#disabled?Bool

Returns:

  • (Bool)


21
22
23
# File 'lib/yao/resources/hypervisor.rb', line 21

def disabled?
  self['status'] == 'disabled'
end

#enabled?Bool

Returns:

  • (Bool)


16
17
18
# File 'lib/yao/resources/hypervisor.rb', line 16

def enabled?
  self['status'] == 'enabled'
end

#serviceYao::ComputeServices

Returns:

  • (Yao::ComputeServices)


26
27
28
# File 'lib/yao/resources/hypervisor.rb', line 26

def service
  Yao::ComputeServices.new(self['service'])
end