v1

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DockerVersionRequirementSpecTemplate *template.Template
)
View Source
var (
	KubernetesTotalMemoryRequirementSpecTemplate *template.Template
)
View Source
var (
	KubernetesVersionRequirementSpecTemplate *template.Template
)
View Source
var (
	SelinuxNotEnforcingRequirementSpecTemplate *template.Template
)

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type AnalyzerShared

type AnalyzerShared struct {
	Message     string          `json:"message,omitempty" yaml:"message,omitempty" hcl:"message,omitempty"`
	Severity    common.Severity `json:"severity,omitempty" yaml:"severity,omitempty" hcl:"severity,omitempty"`
	Meta        *meta.Meta      `json:"meta,omitempty" yaml:"meta,omitempty" hcl:"meta,omitempty"`
	CollectRefs []meta.Ref      `json:"collect_refs,omitempty" yaml:"collect_refs,omitempty" hcl:"collect_refs,omitempty"`
}

type AnalyzerSpec

type AnalyzerSpec struct {
	AnalyzerShared `json:",inline" yaml:",inline" hcl:",inline"`

	Raw *RawRequirement `json:"raw,omitempty" yaml:"raw,omitempty" hcl:"raw,omitempty"`

	SelinuxNotEnforcing *SelinuxNotEnforcingRequirement `json:"selinux.notenforcing,omitempty" yaml:"selinux.notenforcing,omitempty" hcl:"selinux.notenforcing,omitempty"`

	DockerVersion *DockerVersionRequirement `json:"docker.version,omitempty" yaml:"docker.version,omitempty" hcl:"docker.version,omitempty"`

	KubernetesVersion     *KubernetesVersionRequirement     `json:"kubernetes.version,omitempty" yaml:"kubernetes.version,omitempty" hcl:"kubernetes.version,omitempty"`
	KubernetesTotalMemory *KubernetesTotalMemoryRequirement `json:"kubernetes.total-memory,omitempty" yaml:"kubernetes.total-memory,omitempty" hcl:"kubernetes.total-memory,omitempty"`
}

AnalyzerSpec is a spec to analyze one or more collect assets

func (AnalyzerSpec) GetRequirement added in v0.19.2

func (a AnalyzerSpec) GetRequirement() Requirement

type Condition

type Condition struct {
	ConditionShared `json:",inline" yaml:",inline" hcl:",inline"`

	Eval *EvalCondition `json:"eval,omitempty" yaml:"eval,omitempty" hcl:"eval,omitempty"`
}

type ConditionShared

type ConditionShared struct {
	Severity common.Severity `json:"severity" yaml:"severity" hcl:"severity"`
	Message  string          `json:"message,omitempty" yaml:"message,omitempty" hcl:"message,omitempty"`
}

type DockerVersionRequirement added in v0.19.2

type DockerVersionRequirement struct {
	ServerVersionMin string `json:"server_version_minimum" yaml:"server_version_minimum" hcl:"server_version_minimum"`
}

func (*DockerVersionRequirement) GetRawSpec added in v0.19.2

func (a *DockerVersionRequirement) GetRawSpec() (RawSpec, error)

func (*DockerVersionRequirement) Validate added in v0.19.2

func (a *DockerVersionRequirement) Validate(spec AnalyzerSpec) error

type EvalCondition

type EvalCondition struct {
	Operator   EvalOperator        `json:"operator,omitempty" yaml:"operator,omitempty" hcl:"operator,omitempty"`
	Statements []string            `json:"statements" yaml:"statements" hcl:"statements"`
	Variables  []map[string]string `json:"variables,omitempty" yaml:"variables,omitempty" hcl:"variables,omitempty"`
}

type EvalOperator

type EvalOperator string
const (
	AndOperator EvalOperator = "and"
	OrOperator  EvalOperator = "or"
)

type KubernetesTotalMemoryRequirement added in v0.19.2

type KubernetesTotalMemoryRequirement struct {
	Min string `json:"minimum" yaml:"minimum" hcl:"minimum"`
}

func (*KubernetesTotalMemoryRequirement) GetRawSpec added in v0.19.2

func (a *KubernetesTotalMemoryRequirement) GetRawSpec() (RawSpec, error)

func (*KubernetesTotalMemoryRequirement) Validate added in v0.19.2

type KubernetesVersionRequirement added in v0.19.2

type KubernetesVersionRequirement struct {
	SemverMin string `json:"semver_minimum" yaml:"semver_minimum" hcl:"semver_minimum"`
}

func (*KubernetesVersionRequirement) GetRawSpec added in v0.19.2

func (a *KubernetesVersionRequirement) GetRawSpec() (RawSpec, error)

func (*KubernetesVersionRequirement) Validate added in v0.19.2

type RawRequirement added in v0.19.2

type RawRequirement struct {
	Conditions []Condition `json:"conditions" yaml:"conditions" hcl:"conditions"`
}

func (*RawRequirement) GetRawSpec added in v0.19.2

func (r *RawRequirement) GetRawSpec() (RawSpec, error)

func (*RawRequirement) Validate added in v0.19.2

func (r *RawRequirement) Validate(spec AnalyzerSpec) error

type RawSpec

type RawSpec struct {
	AnalyzerShared `json:",inline" yaml:",inline" hcl:",inline"`

	Raw *RawRequirement `json:"raw,omitempty" yaml:"raw,omitempty" hcl:"raw,omitempty"`
}

RawSpec is a translated spec from an AnalyzerSpec

type Requirement added in v0.19.2

type Requirement interface {
	Validate(spec AnalyzerSpec) error
	GetRawSpec() (RawSpec, error)
}

type SelinuxNotEnforcingRequirement added in v0.19.2

type SelinuxNotEnforcingRequirement struct {
}

func (*SelinuxNotEnforcingRequirement) GetRawSpec added in v0.19.2

func (a *SelinuxNotEnforcingRequirement) GetRawSpec() (RawSpec, error)

func (*SelinuxNotEnforcingRequirement) Validate added in v0.19.2

Jump to

Keyboard shortcuts

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