2012-11-14 15:31:02 +02:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Vsphere
|
|
|
|
|
|
|
|
class Interface < Fog::Model
|
|
|
|
|
|
|
|
identity :mac
|
2013-04-23 10:52:52 +02:00
|
|
|
alias :id :mac
|
2012-11-14 15:31:02 +02:00
|
|
|
|
|
|
|
attribute :network
|
|
|
|
attribute :name
|
|
|
|
attribute :status
|
|
|
|
attribute :summary
|
|
|
|
attribute :type
|
2013-04-23 10:52:52 +02:00
|
|
|
attribute :key
|
2013-09-27 09:54:29 +02:00
|
|
|
attribute :virtualswitch
|
2012-11-14 15:31:02 +02:00
|
|
|
|
|
|
|
def initialize(attributes={} )
|
2013-09-27 11:48:31 +02:00
|
|
|
if attributes.has_key? :type and attributes[:type].is_a? String then
|
|
|
|
attributes[:type]=Fog.class_from_string(attributes[:type], "RbVmomi::VIM")
|
|
|
|
end
|
2012-11-14 15:31:02 +02:00
|
|
|
super defaults.merge(attributes)
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_s
|
|
|
|
name
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def defaults
|
2013-09-27 11:48:31 +02:00
|
|
|
default_type=Fog.credentials[:default_nic_type] || RbVmomi::VIM::VirtualE1000
|
2012-11-14 15:31:02 +02:00
|
|
|
{
|
|
|
|
:name=>"Network adapter",
|
|
|
|
:network=>"VM Network",
|
|
|
|
:summary=>"VM Network",
|
2013-09-27 11:48:31 +02:00
|
|
|
:type=> Fog.class_from_string(default_type, "RbVmomi::VIM"),
|
2012-11-14 15:31:02 +02:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|