json

package
v0.35.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSpecFileUndefined       = errors.New("json file undefined")
	ErrSpecKeyUndefined        = errors.New("json key undefined")
	ErrSpecFileAndFilesDefined = errors.New("parameter \"file\" and \"files\" are mutually exclusive")
	// ErrWrongSpec is returned when the Spec has wrong content
	ErrWrongSpec error = errors.New("wrong spec content")
)

Functions

This section is empty.

Types

type Json

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

Json stores configuration about the file and the key value which needs to be updated.

func New

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

func (*Json) Changelog

func (j *Json) Changelog() string

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

func (*Json) Condition

func (j *Json) Condition(source string) (bool, error)

func (*Json) ConditionFromSCM

func (j *Json) ConditionFromSCM(source string, scm scm.ScmHandler) (bool, error)

func (*Json) Source

func (j *Json) Source(workingDir string) (string, error)

func (*Json) Target

func (j *Json) Target(source string, dryRun bool) (changed bool, err error)

func (*Json) TargetFromSCM

func (j *Json) TargetFromSCM(source string, scm scm.ScmHandler, dryRun bool) (changed bool, files []string, message string, err error)

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

type Spec

type Spec struct {
	// [s][c][t] File specifies the Json file to manipuate
	File string `yaml:",omitempty"`
	// [c][t] Files specifies a list of Json file to manipuate
	Files []string `yaml:",omitempty"`
	// [s][c][t] Key specifies the Jsonpath key to manipuate
	Key string `yaml:",omitempty"`
	// [s][c][t] Value specifies the Jsonpath key to manipuate. Default to source output
	Value string `yaml:",omitempty"`
	// [c][t] Multiple allows to query multiple values at once
	Multiple bool `yaml:",omitempty"`
}

func (*Spec) Validate

func (s *Spec) Validate() error

Jump to

Keyboard shortcuts

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