Sha256: d34921dcf90a68b5b61203e2ef4cdf7cb381d4b79b08122bf02437db061dd293

Contents?: true

Size: 1.17 KB

Versions: 30

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

30 entries across 30 versions & 5 rubygems

Version Path
fog-libvirt-0.5.0 lib/fog/libvirt/models/compute/nic.rb
fog-libvirt-0.4.2 lib/fog/libvirt/models/compute/nic.rb
fog-libvirt-0.4.1 lib/fog/libvirt/models/compute/nic.rb
fog-libvirt-0.4.0 lib/fog/libvirt/models/compute/nic.rb
fog-libvirt-0.3.0 lib/fog/libvirt/models/compute/nic.rb
fog-libvirt-0.2.0 lib/fog/libvirt/models/compute/nic.rb
fog-libvirt-0.1.0 lib/fog/libvirt/models/compute/nic.rb
fog-libvirt-0.0.4 lib/fog/libvirt/models/compute/nic.rb
fog-libvirt-0.0.3 lib/fog/libvirt/models/compute/nic.rb
fog-libvirt-0.0.2 lib/fog/libvirt/models/compute/nic.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/libvirt/models/compute/nic.rb
fog-libvirt-0.0.1 lib/fog/libvirt/models/compute/nic.rb
fog-1.29.0 lib/fog/libvirt/models/compute/nic.rb
fog-1.28.0 lib/fog/libvirt/models/compute/nic.rb
fog-1.27.0 lib/fog/libvirt/models/compute/nic.rb
fog-1.26.0 lib/fog/libvirt/models/compute/nic.rb
fog-1.25.0 lib/fog/libvirt/models/compute/nic.rb
nsidc-fog-1.24.1 lib/fog/libvirt/models/compute/nic.rb
fog-1.24.0 lib/fog/libvirt/models/compute/nic.rb
ns-fog-1.22.11 lib/fog/libvirt/models/compute/nic.rb