Sha256: 5e3baff856704ee718e9a16e27be4f88d942832bf077fdd276b105e985961ec3

Contents?: true

Size: 1.23 KB

Versions: 39

Compression:

Stored size: 1.23 KB

Contents

require 'fog/openstack/models/collection'
require 'fog/baremetal/openstack/models/chassis'

module Fog
  module Baremetal
    class OpenStack
      class ChassisCollection < Fog::OpenStack::Collection
        model Fog::Baremetal::OpenStack::Chassis

        def all(options = {})
          load_response(service.list_chassis_detailed(options), 'chassis')
        end

        def summary(options = {})
          load_response(service.list_chassis(options), 'chassis')
        end

        def details(options = {})
          Fog::Logger.deprecation("Calling OpenStack[:baremetal].chassis_collection.details will be removed, "\
                                  " call .chassis_collection.all for detailed list.")
          all(options)
        end

        def find_by_uuid(uuid)
          new(service.get_chassis(uuid).body)
        end
        alias get find_by_uuid

        def destroy(uuid)
          chassis = find_by_id(uuid)
          chassis.destroy
        end

        def method_missing(method_sym, *arguments, &block)
          if method_sym.to_s =~ /^find_by_(.*)$/
            load(service.list_chassis_detailed($1 => arguments.first).body['chassis'])
          else
            super
          end
        end
      end
    end
  end
end

Version data entries

39 entries across 37 versions & 3 rubygems

Version Path
fog-openstack-0.1.31 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.3.10 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.1.30 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.1.29 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.3.9 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.1.28 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.3.8 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.3.7 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.3.6 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.3.5 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.3.4 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.3.3 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.3.2 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.3.0 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.2.4 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.2.3 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.2.2 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.2.1 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-openstack-0.2.0 lib/fog/baremetal/openstack/models/chassis_collection.rb
fog-zj-0.1.28 lib/fog/baremetal/openstack/models/chassis_collection.rb