Class: Fog::OpenStack::Network::Network

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

Instance Attribute Summary

Attributes inherited from Model

#project

Instance Method Summary collapse

Methods inherited from Model

#initialize, #save

Constructor Details

This class inherits a constructor from Fog::OpenStack::Model

Instance Method Details

#createObject



23
24
25
26
# File 'lib/fog/openstack/network/models/network.rb', line 23

def create
  merge_attributes(service.create_network(attributes).body['network'])
  self
end

#destroyObject



34
35
36
37
38
# File 'lib/fog/openstack/network/models/network.rb', line 34

def destroy
  requires :id
  service.delete_network(id)
  true
end

#subnetsObject



19
20
21
# File 'lib/fog/openstack/network/models/network.rb', line 19

def subnets
  service.subnets.select { |s| s.network_id == id }
end

#updateObject



28
29
30
31
32
# File 'lib/fog/openstack/network/models/network.rb', line 28

def update
  requires :id
  merge_attributes(service.update_network(id, attributes).body['network'])
  self
end