Liking cljdoc? Tell your friends :D

puppetlabs.puppetdb.http.query

Query parameter manipulation

Functions that aid in the parsing, serialization, and manipulation of PuppetDB queries embedded in HTTP parameters.

Query parameter manipulation

Functions that aid in the parsing, serialization, and manipulation
of PuppetDB queries embedded in HTTP parameters.
raw docstring

add-criteriaclj

(add-criteria crit query)

Add a criteria to the given query, taking top-level 'extract' and 'from' forms into account.

Add a criteria to the given query, taking top-level 'extract' and 'from'
forms into account.
sourceraw docstring

coerce-to-booleanclj

(coerce-to-boolean b)

Parses b to a boolean unless it's already a boolean

Parses `b` to a boolean unless it's already a boolean
sourceraw docstring

convert-query-paramsclj

(convert-query-params full-query param-spec)

Inputs: [full-query param-spec] Returns: puppetdb-query-schema

This will update a query map to contain the parsed and validated query parameters

Inputs: [full-query param-spec]
Returns: puppetdb-query-schema

This will update a query map to contain the parsed and validated query parameters
sourceraw docstring

create-query-mapclj

(create-query-map req param-spec parse-fn)

Inputs: [req param-spec parse-fn] Returns: puppetdb-query-schema

Takes a ring request map and extracts the puppetdb query from the request. GET and POST are accepted, all other requests throw an exception

Inputs: [req param-spec parse-fn]
Returns: puppetdb-query-schema

Takes a ring request map and extracts the puppetdb query from the
request. GET and POST are accepted, all other requests throw an
exception
sourceraw docstring

find-active-node-restriction-criteriaclj

(find-active-node-restriction-criteria query)

Find the first criteria in the given query that explicitly deals with active/deactivated nodes. Return nil if the query has no such criteria.

Find the first criteria in the given query that explicitly deals with
active/deactivated nodes. Return nil if the query has no such criteria.
sourceraw docstring

get-req->queryclj

(get-req->query
  {:keys [params globals] query-uuid :puppetdb-query-uuid :as _req}
  parse-fn)

Converts parameters of a GET request to a pdb query map

Converts parameters of a GET request to a pdb query map
sourceraw docstring

is-active-node-criteria?clj

(is-active-node-criteria? criteria)
source

narrow-globalsclj

(narrow-globals globals)

Reduces the number of globals to limit their reach in the codebase

Reduces the number of globals to limit their reach in the codebase
sourceraw docstring

paging-clauses?clj

(paging-clauses? query-fragments)
source

param-spec-schemaclj

source

parse-json-or-pql-queryclj

(parse-json-or-pql-query query query-uuid log-queries?)

Parse a query string either as JSON or PQL to transform it to AST

Parse a query string either as JSON or PQL to transform it to AST
sourceraw docstring

parse-json-queryclj

(parse-json-query query query-uuid log-queries?)

Parse a query string as JSON. Multiple queries or any other data, after the query, will result in a bad-query-ex.

Parse a query string as JSON. Multiple queries or any other
data, after the query, will result in a bad-query-ex.
sourceraw docstring

parse-json-sequenceclj

(parse-json-sequence query)

Parse a query string as JSON. Parse errors will result in an bad-query-ex Should not be used as a parse-fn directly. Use parse-json-query instead

Parse a query string as JSON. Parse errors will result in an
bad-query-ex Should not be used as a parse-fn directly. Use
parse-json-query instead
sourceraw docstring

parse-timeoutclj

(parse-timeout x)
source

post-req->queryclj

(post-req->query {query-uuid :puppetdb-query-uuid :as req} parse-fn)

Takes a POST body and parses the JSON to create a pdb query map

Takes a POST body and parses the JSON to create a pdb query map
sourceraw docstring

puppetdb-query-schemaclj

This schema defines a PuppetDB query and its available parameters. In a GET request this is contained in various query parameters, for POST requests this should be contained in the body of the request

This schema defines a PuppetDB query and its available
parameters. In a GET request this is contained in various query
parameters, for POST requests this should be contained in the body
of the request
sourceraw docstring

query-criteriaclj

(query-criteria query)

Extract the 'criteria' (select) part of the given query

Extract the 'criteria' (select) part of the given query
sourceraw docstring

query-handlerclj

(query-handler version)
source

restrict-fact-query-to-nameclj

(restrict-fact-query-to-name req)

Restrict the query parameter of the supplied request so that it only returns facts with the given name

Restrict the query parameter of the supplied request so that it
only returns facts with the given name
sourceraw docstring

restrict-fact-query-to-valueclj

(restrict-fact-query-to-value req)

Restrict the query parameter of the supplied request so that it only returns facts with the given name

Restrict the query parameter of the supplied request so that it
only returns facts with the given name
sourceraw docstring

restrict-queryclj

(restrict-query restriction req)

Given a criteria that will restrict a query, modify the supplied request so that its query parameter is now restricted according to restriction

Given a criteria that will restrict a query, modify the supplied
request so that its query parameter is now restricted according to
`restriction`
sourceraw docstring

restrict-query-to-active-nodesclj

(restrict-query-to-active-nodes req)

Restrict the query parameter of the supplied request so that it only returns results for the supplied node, unless a node-active criteria is already explicitly specified.

Restrict the query parameter of the supplied request so that it only returns
results for the supplied node, unless a node-active criteria is already
explicitly specified.
sourceraw docstring

restrict-query-to-entityclj

(restrict-query-to-entity entity)

Inputs: [entity :- String]

Restrict the query to a particular entity, by wrapping the query in a from.

Inputs: [entity :- String]

Restrict the query to a particular entity, by wrapping the query in a from.
sourceraw docstring

restrict-query-to-environmentclj

(restrict-query-to-environment req)

Restrict the query parameter of the supplied request so that it only returns results for the supplied environment

Restrict the query parameter of the supplied request so that it
only returns results for the supplied environment
sourceraw docstring

restrict-query-to-nodeclj

(restrict-query-to-node req)

Restrict the query parameter of the supplied request so that it only returns results for the supplied node

Restrict the query parameter of the supplied request so that it
only returns results for the supplied node
sourceraw docstring

restrict-query-to-producerclj

(restrict-query-to-producer req)

Restrict the query parameter of the supplied request so that it only returns results for the supplied producer

Restrict the query parameter of the supplied request so that it
only returns results for the supplied producer
sourceraw docstring

restrict-query-to-reportclj

(restrict-query-to-report req)

Restrict the query parameter of the supplied request so that it only returns results for the supplied active node

Restrict the query parameter of the supplied request so that it
only returns results for the supplied active node
sourceraw docstring

restrict-resource-query-to-titleclj

(restrict-resource-query-to-title req)

Restrict the query parameter of the supplied request so that it only returns resources with the given title

Restrict the query parameter of the supplied request so that it
only returns resources with the given title
sourceraw docstring

restrict-resource-query-to-typeclj

(restrict-resource-query-to-type req)

Restrict the query parameter of the supplied request so that it only returns resources with the given type

Restrict the query parameter of the supplied request so that it
only returns resources with the given type
sourceraw docstring

time-and-parse-pqlclj

(time-and-parse-pql query query-uuid log-queries?)

Time how long it takes to transform a PQL query to AST, if the time is greater than 1s, a warning is logged. Returns the transformed query.

Time how long it takes to transform a PQL query to AST, if the time
is greater than 1s, a warning is logged. Returns the transformed
query.
sourceraw docstring

valid-query?clj

(valid-query? scf-read-db version query-map query-options)
source

validate-distinct-options!clj

(validate-distinct-options!
  {:keys [distinct_start_time distinct_end_time distinct_resources] :as params})

Validate the HTTP query params related to a distinct_resources query. Return a map containing the validated distinct_resources options, parsed to the correct data types. Throws bad-query-ex if any arguments are missing or invalid.

Validate the HTTP query params related to a `distinct_resources` query.  Return a
map containing the validated `distinct_resources` options, parsed to the correct
data types.  Throws `bad-query-ex` if any arguments are missing
or invalid.
sourceraw docstring

validate-query-paramsclj

(validate-query-params params param-spec)

Inputs: [params param-spec :- param-spec-schema]

Given a set of params and a param spec, throw an error if required params are missing or unsupported params are present, otherwise return the params.

Inputs: [params param-spec :- param-spec-schema]

Given a set of params and a param spec, throw an error if required params
 are missing or unsupported params are present, otherwise return the params.
sourceraw docstring

wrap-typical-queryclj

(wrap-typical-query handler param-spec)
(wrap-typical-query handler param-spec parse-fn)

Wrap a query endpoint request handler with the normal behaviors. Augment the query handler with code to extract the query from the incoming GET or POST and include it in the request as a pdb query map, and handle query timeouts.

Wrap a query endpoint request handler with the normal behaviors.
Augment the query handler with code to extract the query from the
incoming GET or POST and include it in the request as a pdb query
map, and handle query timeouts.
sourceraw docstring

wrap-with-fromclj

(wrap-with-from entity query)

Wrap a query in a from, using the entity and any provided query

Wrap a query in a from, using the entity and any provided query
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close