1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/vsphere/models/compute/interface.rb
Marc Grimme ddf44fabcc Merge pull request #2185 from grimme-atix-de/interface_dswitch
[vSphere] Support passing of a distributed switch for each interface.
2013-10-07 09:19:32 -07:00

45 lines
1,010 B
Ruby

module Fog
module Compute
class Vsphere
class Interface < Fog::Model
identity :mac
alias :id :mac
attribute :network
attribute :name
attribute :status
attribute :summary
attribute :type
attribute :key
attribute :virtualswitch
def initialize(attributes={} )
if attributes.has_key? :type and attributes[:type].is_a? String then
attributes[:type]=Fog.class_from_string(attributes[:type], "RbVmomi::VIM")
end
super defaults.merge(attributes)
end
def to_s
name
end
private
def defaults
default_type=Fog.credentials[:default_nic_type] || RbVmomi::VIM::VirtualE1000
{
:name=>"Network adapter",
:network=>"VM Network",
:summary=>"VM Network",
:type=> Fog.class_from_string(default_type, "RbVmomi::VIM"),
}
end
end
end
end
end