condition

package
v0.55.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWrongConfig is returned when a condition spec has missing attributes which are mandatory
	ErrWrongConfig = errors.New("wrong condition configuration")
)

Functions

This section is empty.

Types

type Condition

type Condition struct {
	// Result stores the condition result after a condition run.
	Result result.Condition
	// Config defines condition input parameters
	Config Config
	// Scm stores scm information
	Scm *scm.ScmHandler
}

Condition defines which condition needs to be met in order to update targets based on the source output

func (*Condition) Run

func (c *Condition) Run(source string) (err error)

Run tests if a specific condition is true

type Config

type Config struct {
	resource.ResourceConfig `yaml:",inline,omitempty"`
	// ! Deprecated in favor of sourceID
	DeprecatedSourceID string `yaml:"sourceID,omitempty" jsonschema:"-"`
	// sourceid specifies which "source", based on its ID, is used to retrieve the default value.
	SourceID string `yaml:",omitempty"`
	// disablesourceinput disable the mechanism to retrieve a default value from a source.
	DisableSourceInput bool `yaml:",omitempty"`
	// FailWhen allows to reverse a condition expected result from true to false.
	FailWhen bool `yaml:",omitempty"`
}

Config defines conditions input parameters

func (Config) JSONSchema added in v0.23.0

func (c Config) JSONSchema() *jschema.Schema

JSONSchema implements the json schema interface to generate the "condition" jsonschema.

func (*Config) Validate added in v0.23.0

func (c *Config) Validate() error

Validate checks if a condition configuration is valid

Jump to

Keyboard shortcuts

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