Liking cljdoc? Tell your friends :D

puppetlabs.puppetdb.http


acceptable-content-typeclj

(acceptable-content-type candidate header)

Returns a boolean indicating whether the candidate mime type matches any of those listed in header, an Accept header.

Returns a boolean indicating whether the `candidate` mime type
matches any of those listed in `header`, an Accept header.
sourceraw docstring

add-headersclj

(add-headers response query-result)

Given a Ring response and a PuppetDB query result map, returns an updated Ring response with the headers added.

Given a Ring response and a PuppetDB query result map, returns
an updated Ring response with the headers added.
sourceraw docstring

bad-request-responseclj

(bad-request-response message)

Produce a json 400 response with an :error key holding message.

Produce a json 400 response with an :error key holding message.
sourceraw docstring

default-bodycljmultimethod

Provides a response body based on the status code of the resopnse. The default body is based on a direct mapping between HTTP code (for instance: 406) and a descriptive message for that status (for instance: Not Acceptable), as given in RFC 2616 section 10.

Provides a response body based on the status code of the resopnse.  The
default body is based on a direct mapping between HTTP code (for instance:
406) and a descriptive message for that status (for instance: Not
Acceptable), as given in RFC 2616 section 10.
sourceraw docstring

denied-responseclj

(denied-response msg status)
source

deprecated-appclj

(deprecated-app app msg request)

Add an X-Deprecation warning for deprecated endpoints

Add an X-Deprecation warning for deprecated endpoints
sourceraw docstring

error-ctype?clj

(error-ctype? header-value)
source

error-responseclj

(error-response error)
(error-response error code)

Returns a Ring response object with the status code specified by code. If error is a Throwable, its message is used as the body of the response. Otherwise, error itself is used. If unspecified, code will default to HttpURLConnection/HTTP_BAD_REQUEST.

Returns a Ring response object with the status code specified by `code`.
 If `error` is a Throwable, its message is used as the body of the
response.  Otherwise, `error` itself is used.  If unspecified,
`code` will default to `HttpURLConnection/HTTP_BAD_REQUEST`.
sourceraw docstring

error-response-content-typeclj

source

experimental-warningclj

(experimental-warning app msg)

Add a Warning: header for experimental endpoints

Add a Warning: header for experimental endpoints
sourceraw docstring

header-for-keyclj

(header-for-key k)

Given a key from a PuppetDB query response, returns the HTTP header that should be used in the HTTP response.

Given a key from a PuppetDB query response, returns the HTTP header that
should be used in the HTTP response.
sourceraw docstring

header-mapclj

Maps the legal keys from a puppetdb query response object to the corresponding HTTP header names.

Maps the legal keys from a puppetdb query response object to the
corresponding HTTP header names.
sourceraw docstring

json-responseclj

(json-response body)
(json-response body code)

Returns a Ring response object with the supplied body and response code, and a JSON content type. If unspecified, code will default to 200.

Returns a Ring response object with the supplied `body` and response `code`,
and a JSON content type. If unspecified, `code` will default to 200.
sourceraw docstring

json-response*clj

(json-response* body)
(json-response* body code)

Returns a Ring response object with the supplied body, response code, and a JSON content type and charset. body is assumed to alredy be JSON-ified. To auto-serialize body to JSON, look at json-response.

Returns a Ring response object with the supplied `body`, response
`code`, and a JSON content type and charset. `body` is assumed to
alredy be JSON-ified. To auto-serialize body to JSON, look at
`json-response`.
sourceraw docstring

json-utf8-ctype?clj

(json-utf8-ctype? header-value)
source

leading-urisclj

(leading-uris uri)
(leading-uris uri delimiter)

Given a URI, return a sequence of all the leading components of that URI.

Example: (leading-uris "/foo/bar/baz") => ["/foo", "/foo/bar", "/foo/bar/baz"]

(leading-uris "/foo/bar/baz" "|") => ["|foo", "|foo|bar", "|foo|bar|baz"]

Given a URI, return a sequence of all the leading components of
that URI.

Example:
(leading-uris "/foo/bar/baz")
=> ["/foo", "/foo/bar", "/foo/bar/baz"]

(leading-uris "/foo/bar/baz" "|")
=> ["|foo", "|foo|bar", "|foo|bar|baz"]
sourceraw docstring

must-accept-typeclj

(must-accept-type f content-type)

Ring middleware that ensures that only requests with a given 'Accept' header are let through. If no matching header is found, we return an HTTP 406.

Ring middleware that ensures that only requests with a given
'Accept' header are let through. If no matching header is found,
we return an HTTP 406.
sourceraw docstring

parse-boolean-query-paramclj

(parse-boolean-query-param params k)

Utility method for parsing a query parameter whose value is expected to be a boolean. In the case where the HTTP request contains the query parameter but not a value for it (e.g. http://foo.com?mybool), assumes the user intended to use the parameter as a flag, and thus return true. If the key doesn't exist in the params map, return false. In all other cases, attempt to parse the value of the param as a Boolean, and return the result.

Utility method for parsing a query parameter whose value is expected to be
a boolean.  In the case where the HTTP request contains the query parameter but
not a value for it (e.g. `http://foo.com?mybool`), assumes the user intended
to use the parameter as a flag, and thus return `true`.  If the key doesn't
exist in the params map, return `false`.  In all other cases, attempt
to parse the value of the param as a Boolean, and return the result.
sourceraw docstring

query-result-responseclj

(query-result-response query-result)

Given a PuppetDB query result map (as returned by query/execute-query), returns a Ring HTTP response object.

Given a PuppetDB query result map (as returned by `query/execute-query`),
returns a Ring HTTP response object.
sourceraw docstring

simple-utf8-ctype?clj

(simple-utf8-ctype? type header-value)
source

status-not-found-responseclj

(status-not-found-response type id)

Produces a json response for when an entity (catalog/nodes/environment/...) is not found.

Produces a json response for when an entity (catalog/nodes/environment/...) is not found.
sourceraw docstring

stream-jsonclj

(stream-json coll buffer pretty-print)

Serializes the supplied sequence to buffer, which is a Writer object.

Serializes the supplied sequence to `buffer`, which is a `Writer`
object.
sourceraw docstring

streamed-tar-responseclj

(streamed-tar-response producer filename)
source

tar-responseclj

(tar-response body filename)
source

upload-file!clj

(upload-file! dir {:keys [tempfile filename]})

Copies an octet-stream filetype upload to the local dir.

Copies an octet-stream filetype upload to the local dir.
sourceraw docstring

uri-segmentsclj

(uri-segments uri)

Converts the given URI into a seq of path segments. Empty segments (from a //, for example) are elided from the result

Converts the given URI into a seq of path segments. Empty segments
(from a `//`, for example) are elided from the result
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