Class: Fog::Compute::Libvirt::Nic
- Defined in:
- lib/rackspace-fog/libvirt/models/compute/nic.rb
Constant Summary collapse
- TYPES =
["network", "bridge", "user"]
Instance Attribute Summary collapse
-
#server ⇒ Object
Returns the value of attribute server.
Attributes inherited from Model
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Nic
constructor
A new instance of Nic.
- #new? ⇒ Boolean
- #save ⇒ Object
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.
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
#server ⇒ Object
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
#destroy ⇒ Object
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
19 20 21 |
# File 'lib/rackspace-fog/libvirt/models/compute/nic.rb', line 19 def new? mac.nil? end |