Class: PuppetdbClient::V4

Inherits:
Base
  • Object
show all
Defined in:
app/services/puppetdb_client/v4.rb

Instance Attribute Summary

Attributes inherited from Base

#ssl_ca_file, #ssl_certificate_file, #ssl_private_key_file, #uri

Instance Method Summary collapse

Methods inherited from Base

#deactivate_node, #facts, #initialize, #resources

Constructor Details

This class inherits a constructor from PuppetdbClient::Base

Instance Method Details

#command_urlObject



19
20
21
# File 'app/services/puppetdb_client/v4.rb', line 19

def command_url
  '/pdb/cmd/v1'
end

#deactivate_node_payload(nodename) ⇒ Object

The payload is formatted as a JSON map. certname: The name of the node for which the catalog was compiled. producer_timestamp: The time of command submission.



8
9
10
11
12
13
14
15
16
17
# File 'app/services/puppetdb_client/v4.rb', line 8

def deactivate_node_payload(nodename)
  {
    'command' => 'deactivate node',
    'version' => 3,
    'payload' => {
      'certname' => nodename,
      'producer_timestamp' => producer_timestamp,
    },
  }.to_json
end

#facts_urlObject



27
28
29
# File 'app/services/puppetdb_client/v4.rb', line 27

def facts_url
  '/pdb/query/v4/facts'
end

#nodes_urlObject



23
24
25
# File 'app/services/puppetdb_client/v4.rb', line 23

def nodes_url
  '/pdb/query/v4/nodes'
end

#query_nodesObject



35
36
37
# File 'app/services/puppetdb_client/v4.rb', line 35

def query_nodes
  super.map { |node| node['certname'] }
end

#resources_urlObject



31
32
33
# File 'app/services/puppetdb_client/v4.rb', line 31

def resources_url
  '/pdb/query/v4/resources'
end