Class: Fog::Network::OpenStack::Port
- Defined in:
- lib/fog/openstack/models/network/port.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Port
constructor
A new instance of Port.
- #save ⇒ Object
- #update ⇒ Object
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
#initialize(attributes) ⇒ Port
Returns a new instance of Port.
19 20 21 22 |
# File 'lib/fog/openstack/models/network/port.rb', line 19 def initialize(attributes) @connection = attributes[:connection] super end |
Instance Method Details
#create ⇒ Object
29 30 31 32 33 34 |
# File 'lib/fog/openstack/models/network/port.rb', line 29 def create requires :network_id merge_attributes(connection.create_port(self.network_id, self.attributes).body['port']) self end |
#destroy ⇒ Object
43 44 45 46 47 |
# File 'lib/fog/openstack/models/network/port.rb', line 43 def destroy requires :id connection.delete_port(self.id) true end |
#save ⇒ Object
24 25 26 27 |
# File 'lib/fog/openstack/models/network/port.rb', line 24 def save requires :network_id identity ? update : create end |
#update ⇒ Object
36 37 38 39 40 41 |
# File 'lib/fog/openstack/models/network/port.rb', line 36 def update requires :id, :network_id merge_attributes(connection.update_port(self.id, self.attributes).body['port']) self end |