Class: Fog::Network::OpenStack::Port
- Inherits:
-
Model
- Object
- Model
- Fog::Network::OpenStack::Port
- Defined in:
- lib/fog/openstack/models/network/port.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Port
constructor
A new instance of Port.
- #save ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Port
Returns a new instance of Port.
20 21 22 23 24 |
# File 'lib/fog/openstack/models/network/port.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 |
# File 'lib/fog/openstack/models/network/port.rb', line 31 def create requires :network_id merge_attributes(service.create_port(self.network_id, self.attributes).body['port']) self end |
#destroy ⇒ Object
45 46 47 48 49 |
# File 'lib/fog/openstack/models/network/port.rb', line 45 def destroy requires :id service.delete_port(self.id) true end |
#save ⇒ Object
26 27 28 29 |
# File 'lib/fog/openstack/models/network/port.rb', line 26 def save requires :network_id identity ? update : create end |
#update ⇒ Object
38 39 40 41 42 43 |
# File 'lib/fog/openstack/models/network/port.rb', line 38 def update requires :id, :network_id merge_attributes(service.update_port(self.id, self.attributes).body['port']) self end |