Documentation
¶
Index ¶
- type Spec
- type Yaml
- func (y *Yaml) Changelog() string
- func (y *Yaml) Condition(source string, scm scm.ScmHandler, resultCondition *result.Condition) error
- func (y *Yaml) Read() error
- func (y *Yaml) Source(workingDir string, resultSource *result.Source) error
- func (y *Yaml) Target(source string, scm scm.ScmHandler, dryRun bool, resultTarget *result.Target) error
- func (y *Yaml) UpdateAbsoluteFilePath(workDir string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Spec ¶
type Spec struct {
/*
"file" defines the yaml file path to interact with.
compatible:
* source
* condition
* target
remark:
* "file" and "files" are mutually exclusive
* when used as a source or condition, the file path also accept the following protocols
* protocols "https://", "http://", and "file://" are supported in path for source and condition
*/
File string `yaml:",omitempty"`
/*
"files" defines the list of yaml files path to interact with.
compatible:
* condition
* target
remark:
* file and files are mutually exclusive
* protocols "https://", "http://", and "file://" are supported in file path for source and condition
*/
Files []string `yaml:",omitempty"`
/*
"key" defines the yaml keypath.
compatible:
* source
* condition
* target
remark:
* key is a simpler version of yamlpath accepts keys.
example:
* key: $.name
* key: $.agent.name
* key: $.agents[0].name
* key: $.agents[*].name
* key: $.'agents.name'
remark:
field path with key/value is not supported at the moment.
some help would be useful on https://github.com/goccy/go-yaml/issues/290
*/
Key string `yaml:",omitempty"`
/*
"value" is the value associated with a yaml key.
compatible:
* source
* condition
* target
default:
When used from a condition or a target, the default value is set to linked source output.
*/
Value string `yaml:",omitempty"`
/*
"keyonly" allows to only check if a key exist and do not return an error otherwise
compatible:
* condition
default:
false
*/
KeyOnly bool `yaml:",omitempty"`
}
"yaml" defines the specification for manipulating "yaml" files. It can be used as a "source", a "condition", or a "target".
type Yaml ¶
type Yaml struct {
// contains filtered or unexported fields
}
Yaml defines a resource of kind "yaml"
func New ¶
New returns a reference to a newly initialized Yaml object from a Spec or an error if the provided YamlSpec triggers a validation error.
func (*Yaml) Changelog ¶
Changelog returns the changelog for this resource, or an empty string if not supported
func (*Yaml) Condition ¶
func (y *Yaml) Condition(source string, scm scm.ScmHandler, resultCondition *result.Condition) error
Condition checks if a key exists in a yaml file
func (*Yaml) Read ¶
Read puts the content of the file(s) as value of the y.files map if the file(s) exist(s) or log the non existence of the file
func (*Yaml) Target ¶
func (y *Yaml) Target(source string, scm scm.ScmHandler, dryRun bool, resultTarget *result.Target) error
Target updates a scm repository based on the modified yaml file.
func (*Yaml) UpdateAbsoluteFilePath ¶ added in v0.50.0
Click to show internal directories.
Click to hide internal directories.