yaml

package
v0.47.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Spec

type Spec struct {
	// [source,condition,target] File contains the file path to take in account
	File string `yaml:",omitempty"`
	// [source,condition,target] Files contains the file path(s) to take in account. For 'source': limited to one item
	Files []string `yaml:",omitempty"`
	// [source,condition,target] Key is the YAML key to retrieve
	Key string `yaml:",omitempty"`
	// [source,condition,target] Value is the YAML value to set. Default value set to source output for condition and target
	Value string `yaml:",omitempty"`
	// [condition] allow checking for only the existence of a key (not its value)
	KeyOnly bool `yaml:",omitempty"`
	// [target] Indent defines the yaml indentation for file updated by target of kind yaml. Default to 2
	Indent int `yaml:",omitempty"`
}

Spec defines a specification for a "yaml" resource parsed from an updatecli manifest file

func (*Spec) Validate added in v0.44.0

func (s *Spec) Validate() error

Validate validates the object and returns an error (with all the failed validation messages) if it is not valid

type Yaml

type Yaml struct {
	// contains filtered or unexported fields
}

Yaml defines a resource of kind "yaml"

func New

func New(spec interface{}) (*Yaml, error)

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

func (y *Yaml) Changelog() string

Changelog returns the changelog for this resource, or an empty string if not supported

func (*Yaml) Condition

func (y *Yaml) Condition(source string) (bool, error)

Condition checks if a key exists in a yaml file

func (*Yaml) ConditionFromSCM

func (y *Yaml) ConditionFromSCM(source string, scm scm.ScmHandler) (bool, error)

ConditionFromSCM checks if a key exists in a yaml file

func (*Yaml) Read

func (y *Yaml) Read() error

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) Source

func (y *Yaml) Source(workingDir string) (string, error)

Source return the latest version

func (*Yaml) Target

func (y *Yaml) Target(source string, dryRun bool) (bool, error)

Target updates a scm repository based on the modified yaml file.

func (*Yaml) TargetFromSCM

func (y *Yaml) TargetFromSCM(source string, scm scm.ScmHandler, dryRun bool) (bool, []string, string, error)

TargetFromSCM updates a scm repository based on the modified yaml file.

Jump to

Keyboard shortcuts

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