Class: Fog::Compute::XenServer::VIF

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/xenserver/models/compute/vif.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



34
35
36
# File 'lib/fog/xenserver/models/compute/vif.rb', line 34

def destroy
  service.destroy_vif reference
end

#networkObject



38
39
40
# File 'lib/fog/xenserver/models/compute/vif.rb', line 38

def network
  service.networks.get __network
end

#saveObject

Raises:

  • (ArgumentError)


46
47
48
49
50
51
52
# File 'lib/fog/xenserver/models/compute/vif.rb', line 46

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

#serverObject



42
43
44
# File 'lib/fog/xenserver/models/compute/vif.rb', line 42

def server
  service.servers.get __vm
end