Class: Fog::Baremetal::OpenStack::Node
- Inherits:
-
Model
- Object
- Model
- Fog::Baremetal::OpenStack::Node
- Defined in:
- lib/fog/openstack/models/baremetal/node.rb
Instance Method Summary collapse
- #chassis ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Node
constructor
A new instance of Node.
- #metadata ⇒ Object
- #ports ⇒ Object
- #save ⇒ Object
- #update(patch = nil) ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Node
Returns a new instance of Node.
32 33 34 35 36 |
# File 'lib/fog/openstack/models/baremetal/node.rb', line 32 def initialize(attributes) # Old 'connection' is renamed as service and should be used instead prepare_service_value(attributes) super end |
Instance Method Details
#chassis ⇒ Object
68 69 70 71 |
# File 'lib/fog/openstack/models/baremetal/node.rb', line 68 def chassis requires :uuid service.get_chassis(self.chassis_uuid).body end |
#create ⇒ Object
43 44 45 46 47 |
# File 'lib/fog/openstack/models/baremetal/node.rb', line 43 def create requires :driver merge_attributes(service.create_node(self.attributes).body) self end |
#destroy ⇒ Object
62 63 64 65 66 |
# File 'lib/fog/openstack/models/baremetal/node.rb', line 62 def destroy requires :uuid service.delete_node(self.uuid) true end |
#metadata ⇒ Object
78 79 80 81 |
# File 'lib/fog/openstack/models/baremetal/node.rb', line 78 def requires :uuid service.get_node(self.uuid).headers end |
#ports ⇒ Object
73 74 75 76 |
# File 'lib/fog/openstack/models/baremetal/node.rb', line 73 def ports requires :uuid service.list_ports_detailed({:node_uuid => self.uuid}).body['ports'] end |
#save ⇒ Object
38 39 40 41 |
# File 'lib/fog/openstack/models/baremetal/node.rb', line 38 def save requires :driver identity ? update : create end |
#update(patch = nil) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/fog/openstack/models/baremetal/node.rb', line 49 def update(patch=nil) requires :uuid if patch merge_attributes(service.patch_node(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 |