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

Inherits:
OpenStack::Model show all
Defined in:
lib/fog/openstack/models/network/subnet.rb

Instance Attribute Summary

Attributes inherited from OpenStack::Model

#project

Instance Method Summary collapse

Methods inherited from OpenStack::Model

#initialize, #save

Constructor Details

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

Instance Method Details

#createObject



20
21
22
23
24
25
26
27
# File 'lib/fog/openstack/models/network/subnet.rb', line 20

def create
  requires :network_id, :cidr, :ip_version
  merge_attributes(service.create_subnet(self.network_id,
                                            self.cidr,
                                            self.ip_version,
                                            self.attributes).body['subnet'])
  self
end

#destroyObject



36
37
38
39
40
# File 'lib/fog/openstack/models/network/subnet.rb', line 36

def destroy
  requires :id
  service.delete_subnet(self.id)
  true
end

#updateObject



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

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