class VCenterDriver::NetworkFolder
Class NetworkFolder
Attributes
item[RW]
items[RW]
Public Class Methods
new(item)
click to toggle source
# File lib/network.rb, line 31 def initialize(item) @item = item @items = {} end
Public Instance Methods
fetch!()
click to toggle source
Builds a hash with Network-Ref / Network to be used as a cache @return [Hash] in the form
{ ds_ref [Symbol] => Network object }
# File lib/network.rb, line 41 def fetch! VIClient.get_entities(@item, 'Network').each do |item| item_name = item._ref @items[item_name.to_sym] = PortGroup.new(item) end VIClient .get_entities( @item, 'DistributedVirtualPortgroup' ).each do |item| item_name = item._ref @items[item_name.to_sym] = DistributedPortGroup.new(item) end VIClient .get_entities( @item, 'VmwareDistributedVirtualSwitch' ).each do |item| item_name = item._ref @items[item_name.to_sym] = DistributedVirtualSwitch.new(item) end VIClient.get_entities(@item, 'OpaqueNetwork').each do |item| item_name = item._ref @items[item_name.to_sym] = OpaqueNetwork.new(item) end end
get(ref)
click to toggle source
Returns a Network. Uses the cache if available. @param ref [Symbol] the vcenter ref @return Network
# File lib/network.rb, line 76 def get(ref) if !@items[ref.to_sym] rbvmomi_net = RbVmomi::VIM::Network.new(@item._connection, ref) @items[ref.to_sym] = Network.new(rbvmomi_net) end @items[ref.to_sym] end