Sha256: 972d27e620667ce9c952410e94ee41cc9559989960cb5002d384cfe388f38689

Contents?: true

Size: 1.33 KB

Versions: 13

Compression:

Stored size: 1.33 KB

Contents

require 'fog/core/model'

module Fog
  module Compute
    class XenServer
    
      class VIF < Fog::Model
        # API Reference here:
        # http://docs.vmd.citrix.com/XenServer/5.6.0/1.0/en_gb/api/?c=VIF
        
        identity :reference
        
        attribute :mac,                :aliases => :MAC
        attribute :uuid
        attribute :allowed_operations
        attribute :currently_attached
        attribute :device
        attribute :mac_autogenerated,  :aliases => :MAC_autogenerated
        attribute :metrics
        attribute :mtu,                :aliases => :MTU
        attribute :__network,          :aliases => :network
        attribute :status_code
        attribute :status_detail
        attribute :__vm,               :aliases => :VM
        

        def destroy
          connection.destroy_vif reference
        end

        def network
          connection.networks.get __network
        end

        def server
          connection.servers.get __vm
        end

        def save
          requires :server
          raise ArgumentError.new('network is required for this operation') \
            unless attributes[:__network]
          ref = connection.create_vif attributes[:server], attributes[:__network]
          merge_attributes connection.vifs.get(ref).attributes
        end

      end
      
    end
  end
end

Version data entries

13 entries across 13 versions & 7 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/xenserver/models/compute/vif.rb
fog-nirvanix-1.8.1 lib/fog/xenserver/models/compute/vif.rb
fog-parser-fix-1.6.1 lib/fog/xenserver/models/compute/vif.rb
fog-test-again-1.6.0 lib/fog/xenserver/models/compute/vif.rb
fog-parser-fix-1.6.0 lib/fog/xenserver/models/compute/vif.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/xenserver/models/compute/vif.rb
fog-sgonyea-1.8.1 lib/fog/xenserver/models/compute/vif.rb
fog-1.8.0 lib/fog/xenserver/models/compute/vif.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/xenserver/models/compute/vif.rb
fog-1.7.0 lib/fog/xenserver/models/compute/vif.rb
fog-1.6.0 lib/fog/xenserver/models/compute/vif.rb
fog-1.5.0 lib/fog/xenserver/models/compute/vif.rb
fog-1.4.0 lib/fog/xenserver/models/compute/vif.rb