Sha256: a4b63d93d20ef4a96a14c0fbcbcb999287ae50ab3a5f909d52382e4a6424c8a5

Contents?: true

Size: 1.21 KB

Versions: 39

Compression:

Stored size: 1.21 KB

Contents

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

module Fog
  module Baremetal
    class OpenStack
      class Nodes < Fog::OpenStack::Collection
        model Fog::Baremetal::OpenStack::Node

        def all(options = {})
          load_response(service.list_nodes_detailed(options), 'nodes')
        end

        def summary(options = {})
          load_response(service.list_nodes(options), 'nodes')
        end

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

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

        def destroy(uuid)
          node = find_by_uuid(uuid)
          node.destroy
        end

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

Version data entries

39 entries across 37 versions & 3 rubygems

Version Path
fog-openstack-0.1.27 lib/fog/baremetal/openstack/models/nodes.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-openstack-0.1.26/lib/fog/baremetal/openstack/models/nodes.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-openstack-0.1.26/lib/fog/baremetal/openstack/models/nodes.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-openstack-0.1.26/lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.26 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.25 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.24 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.23 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.22 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.21 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.20 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.19 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.18 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.17 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.15 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.14 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.13 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.12 lib/fog/baremetal/openstack/models/nodes.rb
fog-openstack-0.1.11 lib/fog/baremetal/openstack/models/nodes.rb