Class: Fog::Baremetal::OpenStack::Chassis

Inherits:
OpenStack::Model show all
Defined in:
lib/fog/baremetal/openstack/models/chassis.rb

Instance Attribute Summary

Attributes inherited from OpenStack::Model

#project

Instance Method Summary collapse

Methods inherited from OpenStack::Model

#initialize, #save

Constructor Details

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

Instance Method Details

#createObject



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

def create
  requires :description
  merge_attributes(service.create_chassis(attributes).body)
  self
end

#destroyObject



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

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

#metadataObject



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

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

#update(patch = nil) ⇒ Object



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

def update(patch = nil)
  requires :uuid, :description
  if patch
    merge_attributes(service.patch_chassis(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