node

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package node implements nodes. They do chef-client runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count added in v0.10.4

func Count() int64

Count returns a count of all nodes on this server.

func GetList

func GetList() []string

GetList gets a list of the nodes on this server.

func ImportStatus added in v0.8.0

func ImportStatus(nodeJSON map[string]interface{}) error

ImportStatus is used by the import function to import node statuses from the exported JSON dump.

Types

type Node

type Node struct {
	Name            string                 `json:"name"`
	ChefEnvironment string                 `json:"chef_environment"`
	RunList         []string               `json:"run_list"`
	JSONClass       string                 `json:"json_class"`
	ChefType        string                 `json:"chef_type"`
	Automatic       map[string]interface{} `json:"automatic"`
	Normal          map[string]interface{} `json:"normal"`
	Default         map[string]interface{} `json:"default"`
	Override        map[string]interface{} `json:"override"`
	// contains filtered or unexported fields
}

Node is a basic Chef node, holding the run list and attributes of the node.

func AllNodes added in v0.5.2

func AllNodes() []*Node

AllNodes returns all the nodes on the server

func Get

func Get(nodeName string) (*Node, util.Gerror)

Get a node.

func GetFromEnv added in v0.5.0

func GetFromEnv(envName string) ([]*Node, error)

GetFromEnv returns all nodes that belong to the given environment.

func GetMulti added in v0.10.0

func GetMulti(nodeNames []string) ([]*Node, util.Gerror)

GetMulti gets multiple nodes from a given slice of node names.

func GetNodesByStatus added in v0.8.0

func GetNodesByStatus(nodeNames []string, status string) ([]*Node, error)

GetNodesByStatus returns the nodes that currently have the given status.

func New

func New(name string) (*Node, util.Gerror)

New makes a new node.

func NewFromJSON added in v0.6.0

func NewFromJSON(jsonNode map[string]interface{}) (*Node, util.Gerror)

NewFromJSON creates a new node from the uploaded JSON.

func UnseenNodes added in v0.8.0

func UnseenNodes() ([]*Node, error)

UnseenNodes returns all nodes that have not sent status reports for a while.

func (*Node) AllStatuses added in v0.8.0

func (n *Node) AllStatuses() ([]*NodeStatus, error)

AllStatuses returns all of the node's status reports to date.

func (*Node) Delete

func (n *Node) Delete() error

Delete the node.

func (*Node) DocID added in v0.6.0

func (n *Node) DocID() string

DocID returns the node's name.

func (*Node) Flatten

func (n *Node) Flatten() map[string]interface{}

Flatten a node for indexing.

func (*Node) GetName

func (n *Node) GetName() string

GetName returns the node's name.

func (*Node) Index

func (n *Node) Index() string

Index tells the indexer where the node should go.

func (*Node) LatestStatus added in v0.8.0

func (n *Node) LatestStatus() (*NodeStatus, error)

LatestStatus returns the node's latest status.

func (*Node) Save

func (n *Node) Save() error

Save the node.

func (*Node) URLType

func (n *Node) URLType() string

URLType returns the base element of a node's URL.

func (*Node) UpdateFromJSON added in v0.6.0

func (n *Node) UpdateFromJSON(jsonNode map[string]interface{}) util.Gerror

UpdateFromJSON updates an existing node with the uploaded JSON.

func (*Node) UpdateStatus added in v0.8.0

func (n *Node) UpdateStatus(status string) error

UpdateStatus updates a node's current status (up, down, or new).

type NodeStatus added in v0.8.0

type NodeStatus struct {
	Node      *Node
	Status    string
	UpdatedAt time.Time
}

NodeStatus records a node's status at a particular time.

func AllNodeStatuses added in v0.8.0

func AllNodeStatuses() []*NodeStatus

AllNodeStatuses returns all node status reports on the server, from all nodes.

func (*NodeStatus) ToJSON added in v0.8.0

func (ns *NodeStatus) ToJSON() map[string]string

ToJSON formats a node status report for export to JSON.

Jump to

Keyboard shortcuts

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