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



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

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



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

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

#saveObject

create a new network



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

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