util

package
v0.3.20 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSON format = "json"
	YAML format = "yaml"
)

Variables

This section is empty.

Functions

func IsValueInList added in v0.3.6

func IsValueInList(value string, list []string) bool

func ValidateSections added in v0.3.3

func ValidateSections(unmarshal func(interface{}) error, i interface{}, whitelist map[string]bool) error

func WhitelistAttrs added in v0.3.3

func WhitelistAttrs(i interface{}, format format) (map[string]bool, error)

Types

type Command

type Command struct {
	Cmd            *exec.Cmd
	Stdout, Stderr bytes.Buffer
	Err            error
	Status         int
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand(name string, arg ...string) *Command

func (*Command) Run

func (c *Command) Run() error

type Config added in v0.0.18

type Config struct {
	AllowInsecure         bool
	AnnounceToCLI         bool
	Cache                 time.Duration
	Debug                 bool
	Endpoint              string
	FormatOptions         []string
	IgnoreList            []string
	ListenAddress         string
	LocalAddress          string
	MaxConcurrent         int
	Method                string
	NoColor               *bool
	NoFollowRedirects     bool
	OutputFormat          string
	OutputWriter          io.Writer
	PackageManager        string
	Password              string
	RequestBody           string
	Proxy                 string
	RequestHeader         []string
	RetryTimeout          time.Duration
	Server                string
	Sleep                 time.Duration
	Spec                  string
	Timeout               time.Duration
	Username              string
	CAFile                string
	CertFile              string
	KeyFile               string
	Vars                  string
	VarsInline            string
	DisabledResourceTypes []string
}

Config is the runtime configuration for the goss system, the cli.Context gets converted to this and it allows other packages to embed goss by creating this structure and using it when adding, validating etc.

NewConfig can be used to create this which will default to what the CLI assumes and allow manipulation via ConfigOption functions

func NewConfig added in v0.3.11

func NewConfig(opts ...ConfigOption) (rc *Config, err error)

NewConfig creates a default configuration modeled on the defaults the CLI sets, modified using opts

func (*Config) TimeOutMilliSeconds added in v0.3.11

func (c *Config) TimeOutMilliSeconds() int

TimeOutMilliSeconds is the timeout as milliseconds

type ConfigOption added in v0.3.11

type ConfigOption func(c *Config) error

ConfigOption manipulates Config

func WithCache added in v0.3.11

func WithCache(d time.Duration) ConfigOption

WithCache sets how long results may be cached for

func WithColor added in v0.3.11

func WithColor() ConfigOption

WithColor enables colored output

func WithDebug added in v0.3.11

func WithDebug() ConfigOption

WithDebug enables debug output

func WithDisabledResourceTypes added in v0.3.19

func WithDisabledResourceTypes(t ...string) ConfigOption

WithDisabledResourceTypes ensures that any resource matching types listed will be skipped when validating

func WithFormatOptions added in v0.3.11

func WithFormatOptions(opts ...string) ConfigOption

WithFormatOptions sets options used by the output format plugins, valid options are output.WithFormatOptions

func WithMaxConcurrency added in v0.3.11

func WithMaxConcurrency(mc int) ConfigOption

WithMaxConcurrency is the maximum concurrent test that can be run

func WithNoColor added in v0.3.11

func WithNoColor() ConfigOption

WithNoColor disables colored output

func WithOutputFormat added in v0.3.11

func WithOutputFormat(f string) ConfigOption

WithOutputFormat is the formatter to use for output

func WithPackageManager added in v0.3.11

func WithPackageManager(p string) ConfigOption

WithPackageManager overrides the package manager to use

func WithResultWriter added in v0.3.11

func WithResultWriter(w io.Writer) ConfigOption

WithResultWriter sets the writer to write output format to when validating

func WithRetryTimeout added in v0.3.11

func WithRetryTimeout(d time.Duration) ConfigOption

WithRetryTimeout sets the maximum amount of time checks can be retried, it's runtime + WithSleep

func WithSleep added in v0.3.11

func WithSleep(d time.Duration) ConfigOption

WithSleep sets the time to sleep between retries when WithRetryTimeout is set

func WithSpecFile added in v0.3.11

func WithSpecFile(f string) ConfigOption

WithSpecFile sets the path to the file holding spec contents

func WithVarsBytes added in v0.3.11

func WithVarsBytes(v []byte) ConfigOption

WithVarsBytes is a yaml or json byte stream to use as variables passed to the Validator

func WithVarsData added in v0.3.11

func WithVarsData(v interface{}) ConfigOption

WithVarsData uses v as variables to pass to the Validator

func WithVarsFile added in v0.3.11

func WithVarsFile(file string) ConfigOption

WithVarsFile is a json or yaml file containing variables to pass to the validator

func WithVarsString added in v0.3.11

func WithVarsString(v string) ConfigOption

WithVarsString is a yaml or json string to use as variables passed to the Validator

type OutputConfig added in v0.3.6

type OutputConfig struct {
	FormatOptions []string
}

Jump to

Keyboard shortcuts

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