Class: Fog::Compute::Cloudstack::Network

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

Instance Method Summary collapse

Instance Method Details

#destroy(options = {}) ⇒ Object

delete given network - will return a job



64
65
66
67
# File 'lib/fog/cloudstack/models/compute/network.rb', line 64

def destroy(options={})
  response = service.delete_network(options.merge({'id'=> self.id}))
  service.jobs.new(response["deletenetworkresponse"])
end

#restart(options = {}) ⇒ Object

restart network - will return a job



43
44
45
46
# File 'lib/fog/cloudstack/models/compute/network.rb', line 43

def restart(options={})
    response = service.restart_network( options.merge({'id'=> self.id}))
    service.jobs.new(response['restartnetworkresponse'])
end

#saveObject

create a new network



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/fog/cloudstack/models/compute/network.rb', line 49

def save
  requires :display_text, :name, :network_offering_id, :zone_id

  options = {
    'displaytext'           => display_text,
    'name'                  => name,
    'zoneid'                => zone_id,
    'networkofferingid'     => network_offering_id
  }

  response = service.create_network(options)
  merge_attributes(response['createnetworkresponse']['network'])
end