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

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Nic

Returns a new instance of Nic.

Raises:

  • (Fog::Errors::Error)


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

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.



14
15
16
# File 'lib/fog/libvirt/models/compute/nic.rb', line 14

def server
  @server
end

Instance Method Details

#destroyObject

Raises:

  • (Fog::Errors::Error)


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

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)


18
19
20
# File 'lib/fog/libvirt/models/compute/nic.rb', line 18

def new?
  mac.nil?
end

#saveObject

Raises:

  • (Fog::Errors::Error)


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

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