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
- #set_node_maintenance(parameters = nil) ⇒ Object
- #set_power_state(power_state) ⇒ Object
- #set_provision_state(provision_state) ⇒ Object
- #unset_node_maintenance(parameters = nil) ⇒ 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
90 91 92 93 |
# File 'lib/fog/openstack/models/baremetal/node.rb', line 90 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 |
#set_node_maintenance(parameters = nil) ⇒ Object
78 79 80 81 82 |
# File 'lib/fog/openstack/models/baremetal/node.rb', line 78 def set_node_maintenance(parameters=nil) requires :uuid service.set_node_maintenance(uuid, parameters) true end |
#set_power_state(power_state) ⇒ Object
95 96 97 98 |
# File 'lib/fog/openstack/models/baremetal/node.rb', line 95 def set_power_state(power_state) requires :uuid service.set_node_power_state(self.uuid, power_state) end |
#set_provision_state(provision_state) ⇒ Object
100 101 102 103 |
# File 'lib/fog/openstack/models/baremetal/node.rb', line 100 def set_provision_state(provision_state) requires :uuid service.set_node_provision_state(self.uuid, provision_state) end |
#unset_node_maintenance(parameters = nil) ⇒ Object
84 85 86 87 88 |
# File 'lib/fog/openstack/models/baremetal/node.rb', line 84 def unset_node_maintenance(parameters=nil) requires :uuid service.unset_node_maintenance(uuid, parameters) true 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 |