Class: Fog::OpenStack::Baremetal::Port

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/openstack/baremetal/models/port.rb

Instance Attribute Summary

Attributes inherited from Model

#project

Instance Method Summary collapse

Methods inherited from Model

#initialize, #save

Constructor Details

This class inherits a constructor from Fog::OpenStack::Model

Instance Method Details

#createObject



18
19
20
21
22
# File 'lib/fog/openstack/baremetal/models/port.rb', line 18

def create
  requires :address, :node_uuid
  merge_attributes(service.create_port(attributes).body)
  self
end

#destroyObject



37
38
39
40
41
# File 'lib/fog/openstack/baremetal/models/port.rb', line 37

def destroy
  requires :uuid
  service.delete_port(uuid)
  true
end

#metadataObject



43
44
45
46
# File 'lib/fog/openstack/baremetal/models/port.rb', line 43

def 
  requires :uuid
  service.get_port(uuid).headers
end

#update(patch = nil) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fog/openstack/baremetal/models/port.rb', line 24

def update(patch = nil)
  requires :uuid, :address, :node_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