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

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

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Chassis

Returns a new instance of Chassis.



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

def initialize(attributes)
  # Old 'connection' is renamed as service and should be used instead
  prepare_service_value(attributes)
  super
end

Instance Method Details

#createObject



28
29
30
31
32
# File 'lib/fog/openstack/models/baremetal/chassis.rb', line 28

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

#destroyObject



47
48
49
50
51
# File 'lib/fog/openstack/models/baremetal/chassis.rb', line 47

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

#metadataObject



53
54
55
56
# File 'lib/fog/openstack/models/baremetal/chassis.rb', line 53

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

#saveObject



23
24
25
26
# File 'lib/fog/openstack/models/baremetal/chassis.rb', line 23

def save
  requires :description
  identity ? update : create
end

#update(patch = nil) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fog/openstack/models/baremetal/chassis.rb', line 34

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