Class: Fog::Compute::Libvirt::Nic

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/libvirt/models/compute/nic.rb

Constant Summary collapse

TYPES =
["network", "bridge", "user"]

Instance Attribute Summary collapse

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

#initialize(attributes) ⇒ Nic

Returns a new instance of Nic.

Raises:



24
25
26
27
# File 'lib/fog/libvirt/models/compute/nic.rb', line 24

def initialize attributes
  super defaults.merge(attributes)
  raise Fog::Errors::Error.new("#{type} is not a supported nic type") if new? && !TYPES.include?(type)
end

Instance Attribute Details

#serverObject

Returns the value of attribute server.



16
17
18
# File 'lib/fog/libvirt/models/compute/nic.rb', line 16

def server
  @server
end

Instance Method Details

#destroyObject

Raises:



35
36
37
38
39
40
# File 'lib/fog/libvirt/models/compute/nic.rb', line 35

def destroy
  raise Fog::Errors::Error.new('Destroying an interface is not yet implemented. Contributions welcome!')
  #requires :server
  ##detach the nic
  #service.detach_nic(domain, mac)
end

#new?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/fog/libvirt/models/compute/nic.rb', line 20

def new?
  mac.nil?
end

#saveObject

Raises:



29
30
31
32
33
# File 'lib/fog/libvirt/models/compute/nic.rb', line 29

def save
  raise Fog::Errors::Error.new('Creating a new nic is not yet implemented. Contributions welcome!')
  #requires :server
  #service.attach_nic(domain , self)
end