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

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

Constant Summary collapse

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

Instance Attribute Summary collapse

Attributes inherited from Model

#collection, #connection

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 Attributes::InstanceMethods

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

Constructor Details

#initialize(attributes) ⇒ Nic

Returns a new instance of Nic.

Raises:



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

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.



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

def server
  @server
end

Instance Method Details

#destroyObject

Raises:



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

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

#new?Boolean

Returns:

  • (Boolean)


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

def new?
  mac.nil?
end

#saveObject

Raises:



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

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