classifier

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PostRequest

func PostRequest(client *Client, uri string) ([]byte, error)

PostRequest posts a request to the specified uri

Types

type Class added in v1.11.0

type Class struct {
	Name        string
	Environment string
	Parameters  map[string]interface{}
}

Class represents a group returned by the classes endpoint. See https://www.puppet.com/docs/pe/2019.8/classes_endpoint#get_v1_classes

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for the Orchestrator API

func NewClient

func NewClient(hostURL, token string, tlsConfig *tls.Config) *Client

NewClient access the orchestrator API via TLS

func (*Client) Classes added in v1.11.0

func (c *Client) Classes(pagination *Pagination) ([]Class, error)

func (*Client) Group

func (c *Client) Group(id string) (Group, error)

Group will return the group matching the given id.

func (*Client) GroupRules added in v1.1.0

func (c *Client) GroupRules(groupID string) (GroupRules, error)

GroupRules will return the rules for the specified group.

func (*Client) Groups

func (c *Client) Groups(pagination *Pagination) ([]Group, error)

Groups will return all groups.

func (*Client) Node

func (c *Client) Node(certname string) (Node, error)

Node will return the Node matching the given id. certname is the hostname of the node to query.

func (*Client) SetTransport

func (c *Client) SetTransport(tripper http.RoundTripper)

SetTransport lets the caller overwrite the default transport used by the client. This is useful when injecting mock transports for testing purposes.

func (*Client) TranslateRules

func (c *Client) TranslateRules(rule string) (string, error)

TranslateRules converts a group's rule condition into PuppetDB query syntax.

type Group

type Group struct {
	ID                string
	Name              string
	Description       string
	Environment       string
	EnvironmentTrumps bool `json:"environment_trumps"`
	Parent            string
	Rule              interface{}
	Classes           map[string]interface{}
	ConfigData        map[string]interface{} `json:"config_data"`
	Deleted           map[string]interface{}
	Variables         map[string]interface{}
	LastEdited        time.Time `json:"last_edited"`
	SerialNumber      int       `json:"serial_number"`
}

Group represents a group returned by the groups endpoint. See https://puppet.com/docs/pe/2018.1/groups_endpoint.html#get_v1_groups__response_format

type GroupRules added in v1.1.0

type GroupRules struct {
	Rule              interface{}
	RuleWithInherited interface{} `json:"rule_with_inherited"`
	Translated        struct {
		NodesQueryFormat     interface{} `json:"nodes_query_format"`
		InventoryQueryFormat interface{} `json:"inventory_query_format"`
	}
}

GroupRules stores the response from the group rules endpoint.

type Node

type Node struct {
	Name        string `json:"name"`
	Environment string `json:"environment"`
	Groups      []struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"groups"`
	Classes    struct{} `json:"classes"`
	Parameters struct{} `json:"parameters"`
	ConfigData struct{} `json:"config_data"`
}

Node represents the response to the classifier nodes v2 endpoint.

type Pagination

type Pagination struct {
	Limit  int
	Offset int
}

Pagination is a filter to be used when paginating

type Rule

type Rule struct {
	Query interface{}
}

Rule ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL