Class: Fog::Baremetal::OpenStack::Port
- Inherits:
-
Model
- Object
- Model
- Fog::Baremetal::OpenStack::Port
- Defined in:
- lib/fog/openstack/models/baremetal/port.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Port
constructor
A new instance of Port.
- #metadata ⇒ Object
- #save ⇒ Object
- #update(patch = nil) ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Port
Returns a new instance of Port.
18 19 20 21 22 |
# File 'lib/fog/openstack/models/baremetal/port.rb', line 18 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
29 30 31 32 33 |
# File 'lib/fog/openstack/models/baremetal/port.rb', line 29 def create requires :address, :node_uuid merge_attributes(service.create_port(self.attributes).body) self end |
#destroy ⇒ Object
48 49 50 51 52 |
# File 'lib/fog/openstack/models/baremetal/port.rb', line 48 def destroy requires :uuid service.delete_port(self.uuid) true end |
#metadata ⇒ Object
54 55 56 57 |
# File 'lib/fog/openstack/models/baremetal/port.rb', line 54 def requires :uuid service.get_port(self.uuid).headers end |
#save ⇒ Object
24 25 26 27 |
# File 'lib/fog/openstack/models/baremetal/port.rb', line 24 def save requires :address, :node_uuid identity ? update : create end |
#update(patch = nil) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fog/openstack/models/baremetal/port.rb', line 35 def update(patch=nil) requires :uuid if patch merge_attributes(service.patch_port(uuid, patch).body) else # TODO implement update_node method using PUT method and self.attributes # once it is supported by Ironic raise ArgumentError, ('You need to provide patch attribute. Ironic does ' 'not support update by hash yet, only by jsonpatch.') end self end |