Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultUserAgent = "go-jerakia/1.0.0"
DefaultUserAgent is the default User-Agent string set in the request handler.
View Source
const LookupURL = "lookup"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a Jerakia REST client.
func NewClient ¶
func NewClient(httpClient *http.Client, c ClientConfig) Client
NewClient will create and return a Client.
type ClientConfig ¶
type ClientConfig struct { // URL is the URL to the Jerakia server. URL string // Token is the authentication token. Token string // UserAgent is a custom User-Agent. UserAgent UserAgent }
ClientConfig represents options used for creating a Jerakia client.
type LookupOpts ¶
type LookupOpts struct { // Namespace is the namespace to use for the request. // Nested namespaces should be delimited with /. Namespace string // Policy optionally override the policy used for the request. Policy string // LookupType optionally overrides the type of lookup (first, cascade). LookupType string // Merge optionally override the merge strategy to use (array, // deep_hash, hash). Merge string // Scope optionally provides an alternative scope handler to use // for the request (eg: puppetdb). Scope string // ScopeOptions are sent as parameters for the Scope. ScopeOptions map[string]string // Metadata specifies metadata for the request. Metadata map[string]string }
LookupOpts represents options for a lookup.
func (LookupOpts) ToLookupQuery ¶
func (opts LookupOpts) ToLookupQuery() (string, error)
ToLookupQuery converts LookupOpts to a query string.
type LookupResult ¶
type LookupResult struct { // Status is the result of the request. Status string `json:"status"` // Found is if a value was found or not. Found bool `json:"found"` // Payload is the data returned from the lookup. Payload interface{} `json:"payload"` // Message provides details of the error if status is "failed". Message string `json:"message"` }
LookupResult represents a lookup result.
func Lookup ¶
func Lookup(client *Client, key string, opts *LookupOpts) (*LookupResult, error)
Lookup performs a lookup.
type RequestOpts ¶
type RequestOpts struct { // JSONResponse, if provided, will be populated with the contents of the // response body parsed as JSON. JSONResponse interface{} }
RequestOpts represents options used on a per-request basis.
Click to show internal directories.
Click to hide internal directories.