Class: Fog::Network::OpenStack::Subnet
- Inherits:
-
Model
- Object
- Model
- Fog::Network::OpenStack::Subnet
- Defined in:
- lib/fog/openstack/models/network/subnet.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Subnet
constructor
A new instance of Subnet.
- #save ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Subnet
Returns a new instance of Subnet.
20 21 22 23 24 |
# File 'lib/fog/openstack/models/network/subnet.rb', line 20 def initialize(attributes) # Old 'connection' is renamed as service and should be used instead prepare_service_value(attributes) super end |
Instance Method Details
#create ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/fog/openstack/models/network/subnet.rb', line 31 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 |
#destroy ⇒ Object
47 48 49 50 51 |
# File 'lib/fog/openstack/models/network/subnet.rb', line 47 def destroy requires :id service.delete_subnet(self.id) true end |
#save ⇒ Object
26 27 28 29 |
# File 'lib/fog/openstack/models/network/subnet.rb', line 26 def save requires :network_id, :cidr, :ip_version identity ? update : create end |
#update ⇒ Object
40 41 42 43 44 45 |
# File 'lib/fog/openstack/models/network/subnet.rb', line 40 def update requires :id, :network_id, :cidr, :ip_version merge_attributes(service.update_subnet(self.id, self.attributes).body['subnet']) self end |