Class: VCenterDriver::HostFolder

Inherits:
Object
  • Object
show all
Defined in:
lib/host.rb

Overview

Class HostFolder

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#itemObject

Returns the value of attribute item.



30
31
32
# File 'lib/host.rb', line 30

def item
  @item
end

#itemsObject

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