1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
require 'fog/openstack/models/model'
module Fog
module OpenStack
class Baremetal
class Chassis < Fog::OpenStack::Model
identity :uuid
attribute :description
attribute :uuid
# detailed
attribute :created_at
attribute :updated_at
attribute :extra
def create
requires :description
merge_attributes(service.create_chassis(attributes).body)
self
end
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
def destroy
requires :uuid
service.delete_chassis(uuid)
true
end
def metadata
requires :uuid
service.get_chassis(uuid).headers
end
end
end
end
end
|