template

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const TemplatePath = "TEMPLATE_PATH"

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	NewVersion string
	Data       JSON
	Vars       map[string]string
}

Context contain the template context used during conversion. Holds template variables and data.

type Engine

type Engine interface {
	Run(name string, resource []byte, newVersion string, variables map[string]string) ([]byte, error)
}

Engine is a interface that describes a way to prepare the Deployment for cloning.

func NewDefaultEngine

func NewDefaultEngine() Engine

NewDefaultEngine returns a new Engine with a predefined templates.

func NewDefaultPatchEngine added in v0.0.4

func NewDefaultPatchEngine(path string) Engine

NewDefaultPatchEngine returns a new Engine with a predefined templates.

func NewPatchEngine added in v0.0.4

func NewPatchEngine(patches Patches) Engine

NewPatchEngine constructs a new Engine with the given templates.

type JSON

type JSON map[string]interface{}

JSON is a parsed json structure with helper functions to access the data based on json paths.

func NewJSON

func NewJSON(data []byte) (JSON, error)

NewJSON constructs a JSON object from a json string.

func (JSON) Equal

func (t JSON) Equal(path string, compare interface{}) bool

Equal checks if the values are the same.

func (JSON) Has

func (t JSON) Has(path string) bool

Has is a check if the json contain a value behind a json path, e.g. /spec/metadata/name.

func (JSON) Value

func (t JSON) Value(path string) (interface{}, error)

Value returns the object value behind a json path, e.g. /spec/metadata/name.

type Patch

type Patch struct {
	Name      string
	Template  []byte
	Variables map[string]string
}

Patch is a named JSON Patch and it's defined default variables.

type Patches

type Patches []Patch

Patches holds all known patch templates for a Engine.

Jump to

Keyboard shortcuts

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