Class: Yao::Resources::Hypervisor

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

Defined Under Namespace

Classes: Statistics, Uptime

Instance Attribute Summary

Attributes included from RestfullyAccessible

#service

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, #updated

Methods included from RestfullyAccessible

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

Constructor Details

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

Class Method Details

.list_detail(query = {}) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/yao/resources/hypervisor.rb', line 27

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

.statisticsObject



35
36
37
38
# File 'lib/yao/resources/hypervisor.rb', line 35

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

.uptime(id) ⇒ Object



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

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

Instance Method Details

#cpu_infoObject



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

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

#enabled?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/yao/resources/hypervisor.rb', line 14

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