salt

package module
v0.0.0-...-37a3cec Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: MPL-2.0 Imports: 7 Imported by: 0

README

go-salt

Synopsis

Library for interacting with salts salt-master API.

https://saltstack.com/

Build status

  • CircleCI Master

Installing

$ make deps
$ make install

Tests

Running the tests:

make test

Contributing

Please read through our contributing guidelines. Included are directions for opening issues, coding standards, and notes on development.

Moreover, if your pull request contains patches or features, you must include relevant unit tests.

Versioning

For transparency into our release cycle and in striving to maintain backward compatibility, this project is maintained under the Semantic Versioning guidelines.

Code and documentation copyright since 2015 r3labs.io authors.

Code released under the Mozilla Public License Version 2.0.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Connector *Connector
}

Client ...

func NewClient

func NewClient(config Config) (*Client, error)

NewClient ...

func (*Client) Execute

func (c *Client) Execute(function, command, target, targetType string) (string, error)

Execute ...

func (*Client) Job

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

Job ...

func (*Client) Jobs

func (c *Client) Jobs() ([]map[string]Job, error)

Jobs ...

func (*Client) Minion

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

Minion ...

func (*Client) Minions

func (c *Client) Minions() (map[string]Minion, error)

Minions ...

type Config

type Config struct {
	Schema        string
	Host          string
	Port          string
	Username      string
	Password      string
	Debug         bool
	SSLSkipVerify bool
}

Config ...

type Connector

type Connector struct {
	Config    Config
	Client    *http.Client
	AuthToken string
}

Connector ...

func NewConnector

func NewConnector(config Config) *Connector

NewConnector ...

func (*Connector) Authenticate

func (c *Connector) Authenticate() error

Authenticate ...

func (*Connector) Get

func (c *Connector) Get(uri string) (*http.Response, error)

Get ...

func (*Connector) Post

func (c *Connector) Post(uri string, data []byte) (*http.Response, error)

Post ...

type ExecutionResponse

type ExecutionResponse struct {
	Job []Job `json:"return"`
}

ExecutionResponse ...

type Job

type Job struct {
	ID         string            `json:"jid"`
	Function   string            `json:"Function"`
	Target     string            `json:"Target"`
	User       string            `json:"User"`
	StartTime  string            `json:"StartTime"`
	TargetType string            `json:"Target-Type"`
	Arguments  []string          `json:"Arguments"`
	Minions    []string          `json:"Minions"`
	Result     map[string]Result `json:"Result"`
}

Job ...

func (*Job) Running

func (j *Job) Running() bool

Running ...

func (*Job) Successful

func (j *Job) Successful() bool

Successful ...

type JobResponse

type JobResponse struct {
	Job []Job `json:"info"`
}

JobResponse ...

type JobsResponse

type JobsResponse struct {
	Jobs []map[string]Job `json:"return"`
}

JobsResponse ...

type Minion

type Minion struct {
	ID            string   `json:"id"`
	Name          string   `json:"nodename"`
	Host          string   `json:"host"`
	Domain        string   `json:"domain"`
	OS            string   `json:"os"`
	OSRelease     string   `json:"osrelease"`
	OSName        string   `json:"osfullname"`
	Kernel        string   `json:"kernel"`
	KernelRelease string   `json:"kernelrelease"`
	Shell         string   `json:"shell"`
	ARCH          string   `json:"osarch"`
	CPUS          int      `json:"num_cpus"`
	RAM           int      `json:"mem_total"`
	CPUModel      string   `json:"cpu_model"`
	CPUFlags      []string `json:"cpu_flags"`
	Virtual       string   `json:"virtual"`
	IPv4          []string `json:"ipv4"`
	IPv6          []string `json:"ipv6"`
	Path          string   `json:"path"`
	ServerID      int      `json:"server_id"`
}

Minion ...

type MinionsResponse

type MinionsResponse struct {
	Minions []map[string]Minion `json:"return"`
}

MinionsResponse ...

type Result

type Result struct {
	Return struct {
		PID     int    `json:"pid"`
		Retcode int    `json:"retcode"`
		Stdout  string `json:"stdout"`
		Stderr  string `json:"stderr"`
	} `json:"return"`
}

Result ...

Jump to

Keyboard shortcuts

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