Class: PEClient::Resource::PuppetDB::QueryV4::Factsets
- Defined in:
- lib/pe_client/resources/puppet_db/query.v4/factsets.rb
Overview
The factsets endpoint provides access to a representation of node factsets where each result includes the structured facts for a node broken down into a vector of top-level key/value pairs. Note that the inventory endpoint will often provide more flexible and efficient access to the same information.
Constant Summary collapse
- BASE_PATH =
The base path for PuppetDB Query v4 Factsets endpoints.
"#{QueryV4::BASE_PATH}/factsets".freeze
Instance Method Summary collapse
-
#facts(node:, **kwargs) ⇒ Hash+
This will return all facts for a particular factset, designated by a node certname.
-
#get(node: nil, query: nil, **kwargs) ⇒ Hash+
This will return all factsets matching the given query.
Methods inherited from Base
Constructor Details
This class inherits a constructor from PEClient::Resource::Base
Instance Method Details
#facts(node:, **kwargs) ⇒ Hash+
This will return all facts for a particular factset, designated by a node certname. This is a shortcut to the PEClient::Resource::PuppetDB::QueryV4#facts endpoint. It behaves the same as a call to PEClient::Resource::PuppetDB::QueryV4#facts with a query string of [“=”, “certname”, “<NODE>”], except results are returned even if the node is deactivated or expired.
Most of PuppetDB’s query endpoints support a general set of HTTP URL parameters that can be used for paging results. PuppetDB also supports paging via query operators, as described in the AST documentation.
58 59 60 |
# File 'lib/pe_client/resources/puppet_db/query.v4/factsets.rb', line 58 def facts(node:, **kwargs) @client.get "#{BASE_PATH}/#{node}/facts", params: QueryV4.query_paging(**kwargs).compact end |
#get(node: nil, query: nil, **kwargs) ⇒ Hash+
This will return all factsets matching the given query.
Most of PuppetDB’s query endpoints support a general set of HTTP URL parameters that can be used for paging results. PuppetDB also supports paging via query operators, as described in the AST documentation.
42 43 44 45 |
# File 'lib/pe_client/resources/puppet_db/query.v4/factsets.rb', line 42 def get(node: nil, query: nil, **kwargs) @client.get node ? "#{BASE_PATH}/#{node}" : BASE_PATH, params: {query: query&.to_json}.merge!(QueryV4.query_paging(**kwargs)).compact end |