sls

package
v1.0.620 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 14 Imported by: 2

Documentation

Overview

Package sls handles parsing of Salt Pillar files

Index

Constants

View Source
const Decrypt = "decrypt"

Decrypt action

View Source
const Encrypt = "encrypt"

Encrypt action

View Source
const Rotate = "rotate"

Rotate action

View Source
const Validate = "validate"

Validate action (keys)

Variables

This section is empty.

Functions

func WriteSlsFile

func WriteSlsFile(buffer bytes.Buffer, outFilePath string) (int, error)

WriteSlsFile writes a buffer to the specified file If the outFilePath is not stdout an INFO string will be printed to stdout

Types

type Sls

type Sls struct {
	Error          error
	Yaml           *yaml.Yaml
	Pki            *pki.Pki
	KeyMap         map[string]interface{}
	FilePath       string
	EncryptionPath string
	KeyMeta        string
	KeyCount       int
	IsInclude      bool
}

Sls sls data

func New

func New(filePath string, p pki.Pki, encPath string) Sls

New returns a Sls object

func (*Sls) FormatBuffer

func (s *Sls) FormatBuffer(action string) (bytes.Buffer, error)

FormatBuffer returns a formatted .sls buffer with the gpg renderer line

func (*Sls) GetValueFromPath

func (s *Sls) GetValueFromPath(path string) interface{}

GetValueFromPath returns the value from a path string

func (*Sls) PerformAction

func (s *Sls) PerformAction(action string) (bytes.Buffer, error)

PerformAction takes an action string (encrypt or decrypt) and applies that action on all items

func (*Sls) ProcessValues

func (s *Sls) ProcessValues(vals interface{}, action string) (interface{}, error)

ProcessValues will encrypt or decrypt given values

func (*Sls) ProcessYaml

func (s *Sls) ProcessYaml(secretNames []string, secretValues []string) error

ProcessYaml encrypts elements matching keys specified on the command line

func (*Sls) ReadBytes

func (s *Sls) ReadBytes(buf []byte) error

ReadBytes loads YAML from a []byte

func (*Sls) ReadSlsFile

func (s *Sls) ReadSlsFile() error

ReadSlsFile open and read a yaml file, if the file has include statements we throw an error as the YAML parser will try to act on the include directives

func (*Sls) ScanForIncludes

func (s *Sls) ScanForIncludes(reader io.Reader) error

ScanForIncludes looks for include statements in the given io.Reader

func (*Sls) SetValueFromPath

func (s *Sls) SetValueFromPath(path string, value string) error

SetValueFromPath returns the value from a path string

Jump to

Keyboard shortcuts

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