Class: PEClient::Resource::PuppetDB::QueryV4::Catalogs
- Defined in:
- lib/pe_client/resources/puppet_db/query.v4/catalogs.rb
Overview
You can query catalogs by making an HTTP request to the catalogs endpoint.
Constant Summary collapse
- BASE_PATH =
The base path for PuppetDB Query v4 Catalogs endpoints.
"#{QueryV4::BASE_PATH}/catalogs".freeze
Instance Method Summary collapse
-
#edges(node:, **kwargs) ⇒ Hash+
This will return all edges for a particular catalog, designated by a node certname.
-
#get(node: nil, query: nil, **kwargs) ⇒ Hash+
This will return a JSON array containing the most recent catalog for each node or for a given node in your infrastructure.
-
#resources(node:, **kwargs) ⇒ Hash+
This will return all resources for a particular catalog, designated by a node certname.
Methods inherited from Base
Constructor Details
This class inherits a constructor from PEClient::Resource::Base
Instance Method Details
#edges(node:, **kwargs) ⇒ Hash+
This will return all edges for a particular catalog, designated by a node certname. This is a shortcut to the PEClient::Resource::PuppetDB::QueryV4#edges endpoint. It behaves the same as a call to PEClient::Resource::PuppetDB::QueryV4#edges with ‘query: [“=”, “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.
55 56 57 |
# File 'lib/pe_client/resources/puppet_db/query.v4/catalogs.rb', line 55 def edges(node:, **kwargs) @client.get "#{BASE_PATH}/#{node}/edges", params: QueryV4.query_paging(**kwargs).compact end |
#get(node: nil, query: nil, **kwargs) ⇒ Hash+
This will return a JSON array containing the most recent catalog for each node or for a given node in your infrastructure.
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.
40 41 42 43 |
# File 'lib/pe_client/resources/puppet_db/query.v4/catalogs.rb', line 40 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 |
#resources(node:, **kwargs) ⇒ Hash+
This will return all resources for a particular catalog, designated by a node certname. This is a shortcut to the PEClient::Resource::PuppetDB::QueryV4#resources endpoint. It behaves the same as a call to PEClient::Resource::PuppetDB::QueryV4#resources with ‘query: [“=”, “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.
69 70 71 |
# File 'lib/pe_client/resources/puppet_db/query.v4/catalogs.rb', line 69 def resources(node:, **kwargs) @client.get "#{BASE_PATH}/#{node}/resources", params: QueryV4.query_paging(**kwargs).compact end |