Documentation
¶
Index ¶
- Constants
- func AddResource(fileName string, syverConfig SyverConfig, resourceName, key string, ...) error
- func AddResources(fileName, resourceName string, keys []string, c *util.Config) error
- func AutoAddResource(fileName string, syverConfig SyverConfig, key string, c *util.Config, ...) error
- func AutoAddResources(fileName string, keys []string, c *util.Config) error
- func NewTemplateFilter(varsFiles []string, varsInline string, discovered map[string]bool) (func([]byte) ([]byte, error), error)
- func RenderJSON(c *util.Config) (string, error)
- func Serve(c *util.Config) error
- func Validate(c *util.Config) (code int, err error)
- func ValidateConfig(c *util.Config, syverConfig *SyverConfig) (code int, err error)
- func ValidateResults(c *util.Config) (results <-chan []resource.TestResult, err error)
- func WriteJSON(filePath string, syverConfig SyverConfig) error
- type DiscoveryConfig
- type DiscoveryEntry
- type SyverConfig
- type TemplateFilter
- type TmplVars
Constants ¶
const ( UNSET = iota JSON YAML )
Variables ¶
This section is empty.
Functions ¶
func AddResource ¶
func AddResource(fileName string, syverConfig SyverConfig, resourceName, key string, config util.Config, sys *system.System) error
AddResource adds a single resource to fileName
func AddResources ¶
AddResources is a simple wrapper to add multiple resources
func AutoAddResource ¶
func AutoAddResource(fileName string, syverConfig SyverConfig, key string, c *util.Config, sys *system.System) error
AutoAddResource adds a single resource to fileName with automatic detection of the type of resource
func AutoAddResources ¶
AutoAddResources is a simple wrapper to add multiple resources
func NewTemplateFilter ¶
func NewTemplateFilter(varsFiles []string, varsInline string, discovered map[string]bool) (func([]byte) ([]byte, error), error)
NewTemplateFilter creates a new Template Filter based in the file and inline variables.
func RenderJSON ¶
RenderJSON reads json file recursively returning string
func Validate ¶
Validate performs validation, writes formatted output to stdout by default and supports retries and more, this is the full featured Validate used by the CLI invocation and will produce output to StdOut. Use ValidateResults for programmatic access
func ValidateConfig ¶
func ValidateConfig(c *util.Config, syverConfig *SyverConfig) (code int, err error)
func ValidateResults ¶
func ValidateResults(c *util.Config) (results <-chan []resource.TestResult, err error)
ValidateResults performs validation and provides programmatic access to validation results no retries or outputs are supported
func WriteJSON ¶
func WriteJSON(filePath string, syverConfig SyverConfig) error
Types ¶
type DiscoveryConfig ¶
type DiscoveryConfig struct {
Files resource.FileMap `json:"file,omitempty" yaml:"file,omitempty"`
Packages resource.PackageMap `json:"package,omitempty" yaml:"package,omitempty"`
Addrs resource.AddrMap `json:"addr,omitempty" yaml:"addr,omitempty"`
Ports resource.PortMap `json:"port,omitempty" yaml:"port,omitempty"`
Services resource.ServiceMap `json:"service,omitempty" yaml:"service,omitempty"`
Users resource.UserMap `json:"user,omitempty" yaml:"user,omitempty"`
Groups resource.GroupMap `json:"group,omitempty" yaml:"group,omitempty"`
Commands resource.CommandMap `json:"command,omitempty" yaml:"command,omitempty"`
DNS resource.DNSMap `json:"dns,omitempty" yaml:"dns,omitempty"`
Processes resource.ProcessMap `json:"process,omitempty" yaml:"process,omitempty"`
KernelParams resource.KernelParamMap `json:"kernel-param,omitempty" yaml:"kernel-param,omitempty"`
Mounts resource.MountMap `json:"mount,omitempty" yaml:"mount,omitempty"`
Interfaces resource.InterfaceMap `json:"interface,omitempty" yaml:"interface,omitempty"`
HTTPs resource.HTTPMap `json:"http,omitempty" yaml:"http,omitempty"`
Matchings resource.MatchingMap `json:"matching,omitempty" yaml:"matching,omitempty"`
Registries resource.RegistryMap `json:"registry,omitempty" yaml:"registry,omitempty"`
}
DiscoveryConfig holds discovery-phase tests keyed by resource type.
func (*DiscoveryConfig) Entries ¶
func (c *DiscoveryConfig) Entries() ([]DiscoveryEntry, error)
func (*DiscoveryConfig) IsEmpty ¶
func (c *DiscoveryConfig) IsEmpty() bool
func (*DiscoveryConfig) Merge ¶
func (c *DiscoveryConfig) Merge(g2 DiscoveryConfig)
type DiscoveryEntry ¶
DiscoveryEntry pairs a register name with a discovery resource.
type SyverConfig ¶
type SyverConfig struct {
Discovery DiscoveryConfig `json:"discovery,omitempty" yaml:"discovery,omitempty"`
Files resource.FileMap `json:"file,omitempty" yaml:"file,omitempty"`
Packages resource.PackageMap `json:"package,omitempty" yaml:"package,omitempty"`
Addrs resource.AddrMap `json:"addr,omitempty" yaml:"addr,omitempty"`
Ports resource.PortMap `json:"port,omitempty" yaml:"port,omitempty"`
Services resource.ServiceMap `json:"service,omitempty" yaml:"service,omitempty"`
Users resource.UserMap `json:"user,omitempty" yaml:"user,omitempty"`
Groups resource.GroupMap `json:"group,omitempty" yaml:"group,omitempty"`
Commands resource.CommandMap `json:"command,omitempty" yaml:"command,omitempty"`
DNS resource.DNSMap `json:"dns,omitempty" yaml:"dns,omitempty"`
Processes resource.ProcessMap `json:"process,omitempty" yaml:"process,omitempty"`
Syverfiles resource.SyverfileMap `json:"gossfile,omitempty" yaml:"gossfile,omitempty"`
// SyverfileAlias is an input-only alias for Syverfiles: a gossfile
// written with `syverfile:` entries decodes here, gets folded into
// Syverfiles (see ReadJSONData in store.go), and is then nil'd out --
// it is never itself written back out (omitempty drops it once nil).
SyverfileAlias resource.SyverfileMap `json:"syverfile,omitempty" yaml:"syverfile,omitempty"`
KernelParams resource.KernelParamMap `json:"kernel-param,omitempty" yaml:"kernel-param,omitempty"`
Mounts resource.MountMap `json:"mount,omitempty" yaml:"mount,omitempty"`
Interfaces resource.InterfaceMap `json:"interface,omitempty" yaml:"interface,omitempty"`
HTTPs resource.HTTPMap `json:"http,omitempty" yaml:"http,omitempty"`
Matchings resource.MatchingMap `json:"matching,omitempty" yaml:"matching,omitempty"`
Registries resource.RegistryMap `json:"registry,omitempty" yaml:"registry,omitempty"`
}
func NewSyverConfig ¶
func NewSyverConfig() *SyverConfig
func ReadJSON ¶
func ReadJSON(filePath string) (SyverConfig, error)
ReadJSON Reads json file returning SyverConfig
func ReadJSONData ¶
func ReadJSONData(data []byte, detectFormat bool) (SyverConfig, error)
ReadJSONData Reads json byte array returning SyverConfig
func (*SyverConfig) Merge ¶
func (c *SyverConfig) Merge(g2 SyverConfig)
Merge consumes all the resources in g2 into c, duplicate resources will be overwritten with the ones in g2
func (*SyverConfig) Resources ¶
func (c *SyverConfig) Resources() []resource.Resource
type TemplateFilter ¶
TemplateFilter is the type of the Goss Template Filter which include custom variables and functions.
func NewPeekTemplateFilter ¶
func NewPeekTemplateFilter(varsFiles []string, varsInline string) (TemplateFilter, error)
NewPeekTemplateFilter renders templates before discovery results exist. Missing .Discovered keys evaluate as false instead of failing template execution.