Class: VCenterDriver::HostFolder
- Inherits:
-
Object
- Object
- VCenterDriver::HostFolder
- Defined in:
- lib/host.rb
Overview
Class HostFolder
Instance Attribute Summary collapse
-
#item ⇒ Object
Returns the value of attribute item.
-
#items ⇒ Object
Returns the value of attribute items.
Instance Method Summary collapse
- #fetch_clusters! ⇒ Object
- #get_cluster(ref) ⇒ Object
-
#initialize(item) ⇒ HostFolder
constructor
A new instance of HostFolder.
Constructor Details
#initialize(item) ⇒ HostFolder
Returns a new instance of HostFolder.
32 33 34 35 |
# File 'lib/host.rb', line 32 def initialize(item) @item = item @items = {} end |
Instance Attribute Details
#item ⇒ Object
Returns the value of attribute item.
30 31 32 |
# File 'lib/host.rb', line 30 def item @item end |
#items ⇒ Object
Returns the value of attribute items.
30 31 32 |
# File 'lib/host.rb', line 30 def items @items end |
Instance Method Details
#fetch_clusters! ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/host.rb', line 37 def fetch_clusters! VIClient .get_entities( @item, 'ClusterComputeResource' ).each do |item| item_name = item._ref @items[item_name.to_sym] = ClusterComputeResource.new(item) end end |
#get_cluster(ref) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/host.rb', line 48 def get_cluster(ref) if !@items[ref.to_sym] rbvmomi_dc = RbVmomi::VIM::ClusterComputeResource .new( @item._connection, ref ) @items[ref.to_sym] = ClusterComputeResource .new( rbvmomi_dc ) end @items[ref.to_sym] end |