Sha256: 2a8debfd6629eb248765c60a48c79de373a23126f0e905472c6479b974e3982f

Contents?: true

Size: 1.21 KB

Versions: 17

Compression:

Stored size: 1.21 KB

Contents

require 'fog/openstack/models/model'

module Fog
  module Baremetal
    class OpenStack
      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(self.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(self.uuid)
          true
        end

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

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
fog-openstack-0.1.10 lib/fog/openstack/models/baremetal/chassis.rb
fog-openstack-0.1.9 lib/fog/openstack/models/baremetal/chassis.rb
fog-openstack-0.1.8 lib/fog/openstack/models/baremetal/chassis.rb
fog-openstack-0.1.7 lib/fog/openstack/models/baremetal/chassis.rb
fog-openstack-0.1.6 lib/fog/openstack/models/baremetal/chassis.rb
fog-openstack-0.1.5 lib/fog/openstack/models/baremetal/chassis.rb
fog-openstack-0.1.4 lib/fog/openstack/models/baremetal/chassis.rb
fog-openstack-0.1.3 lib/fog/openstack/models/baremetal/chassis.rb
fog-openstack-0.1.2 lib/fog/openstack/models/baremetal/chassis.rb
fog-openstack-0.1.1 lib/fog/openstack/models/baremetal/chassis.rb
fog-openstack-0.1.0 lib/fog/openstack/models/baremetal/chassis.rb
fog-1.37.0 lib/fog/openstack/models/baremetal/chassis.rb
fog-1.36.0 lib/fog/openstack/models/baremetal/chassis.rb
fog-1.35.0 lib/fog/openstack/models/baremetal/chassis.rb
fog-2.0.0.pre.0 lib/fog/openstack/models/baremetal/chassis.rb
fog-1.34.0 lib/fog/openstack/models/baremetal/chassis.rb
fog-1.33.0 lib/fog/openstack/models/baremetal/chassis.rb