Class: Fog::Network::OpenStack::Subnet
- Inherits:
-
Model
- Object
- Model
- Fog::Network::OpenStack::Subnet
show all
- Defined in:
- lib/fog/openstack/models/network/subnet.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
#initialize(attributes) ⇒ Subnet
20
21
22
23
|
# File 'lib/fog/openstack/models/network/subnet.rb', line 20
def initialize(attributes)
@connection = attributes[:connection]
super
end
|
Instance Method Details
#create ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/fog/openstack/models/network/subnet.rb', line 30
def create
requires :network_id, :cidr, :ip_version
merge_attributes(connection.create_subnet(self.network_id,
self.cidr,
self.ip_version,
self.attributes).body['subnet'])
self
end
|
#destroy ⇒ Object
46
47
48
49
50
|
# File 'lib/fog/openstack/models/network/subnet.rb', line 46
def destroy
requires :id
connection.delete_subnet(self.id)
true
end
|
#save ⇒ Object
25
26
27
28
|
# File 'lib/fog/openstack/models/network/subnet.rb', line 25
def save
requires :network_id, :cidr, :ip_version
identity ? update : create
end
|
#update ⇒ Object
39
40
41
42
43
44
|
# File 'lib/fog/openstack/models/network/subnet.rb', line 39
def update
requires :id, :network_id, :cidr, :ip_version
merge_attributes(connection.update_subnet(self.id,
self.attributes).body['subnet'])
self
end
|