Module: PuppetRestClient::DB::Connection::Nodes

Included in:
PuppetRestClient::DB::Connection
Defined in:
lib/puppet-rest/db/connection/nodes.rb

Instance Method Summary collapse

Instance Method Details

#node(name) ⇒ Object



12
13
14
15
16
17
# File 'lib/puppet-rest/db/connection/nodes.rb', line 12

def node(name)
  attributes = get(api_path("nodes/#{name}"))
  n = PuppetRestClient::DB::Node.get_or_new(attributes)
  n.connection = self
  n
end

#node_facts(name) ⇒ Object



19
20
21
22
23
# File 'lib/puppet-rest/db/connection/nodes.rb', line 19

def node_facts(name)
  get(api_path("nodes/#{name}/facts")).map {|fact|
    PuppetRestClient::DB::Fact.get_or_new(fact)
  }
end

#node_resources(name) ⇒ Object



25
26
27
28
29
# File 'lib/puppet-rest/db/connection/nodes.rb', line 25

def node_resources(name)
  get(api_path("nodes/#{name}/resources")).map {|resource|
    PuppetRestClient::DB::Resource.get_or_new(resource)
  }
end

#nodes(options = Mash.new) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/puppet-rest/db/connection/nodes.rb', line 4

def nodes(options=Mash.new)
  get(api_path('nodes')).map {|node|
    n = PuppetRestClient::DB::Node.get_or_new(node)
    n.connection = self
    n
  }
end