Class: Fog::Compute::XenServer::Network

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

Instance Method Summary collapse

Instance Method Details

#destroyBoolean

Destroys a network

service = Fog::Compute[:xenserver]

# find network 'foonet' and destroy it
net = service.networks.find { |net| net.name == 'foonet' }
net.destroy

Returns:

  • (Boolean)


82
83
84
85
86
# File 'lib/fog/xenserver/models/compute/network.rb', line 82

def destroy
  requires :reference
  service.destroy_network reference
  true
end

#pifsObject

Return the list of network related PIFs



35
36
37
38
39
40
41
# File 'lib/fog/xenserver/models/compute/network.rb', line 35

def pifs
  p = []
  __pifs.each do |pif|
    p << service.pifs.get(pif)
  end
  p
end

#refreshObject



26
27
28
29
30
# File 'lib/fog/xenserver/models/compute/network.rb', line 26

def refresh
  data = service.get_record( reference, 'network' )
  merge_attributes( data )
  true
end

#saveBoolean

Creates a new network

service = Fog::Compute[:xenserver]

# create network 'foonet'
net = service.networks.create :name => 'foonet',
                              :description => 'test network'

Returns:

  • (Boolean)


64
65
66
67
68
69
70
# File 'lib/fog/xenserver/models/compute/network.rb', line 64

def save
  requires :name
  ref = service.create_network name, attributes
  data = service.get_record ref, 'network'
  merge_attributes data
  true
end

#vifsObject

Return the list of network related VIFs



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

def vifs
  v = []
  __vifs.each do |vif|
    v << service.vifs.get(vif)
  end
  v
end