Sha256: 9b6bf6bfa34b1ea2c5d31340aa8761deb7427933ef3325490cbaf30b045e03ab

Contents?: true

Size: 1.17 KB

Versions: 53

Compression:

Stored size: 1.17 KB

Contents

require 'fog/core/model'

module Fog
  module Compute
    class Libvirt

      class Nic < Fog::Model

        identity :mac
        attribute :id
        attribute :type
        attribute :network
        attribute :bridge
        attribute :model

        attr_accessor :server

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

        def new?
          mac.nil?
        end

        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

        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

        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

        private
        def defaults
          {
            :type  => "bridge",
            :model => "virtio"
          }
        end

      end

    end
  end

end

Version data entries

53 entries across 53 versions & 3 rubygems

Version Path
fog-1.22.0 lib/fog/libvirt/models/compute/nic.rb
fog-1.21.0 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/libvirt/models/compute/nic.rb
fog-1.20.0 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/libvirt/models/compute/nic.rb
fog-1.19.0 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/libvirt/models/compute/nic.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/libvirt/models/compute/nic.rb