transform

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 7 Imported by: 47

Documentation

Index

Constants

View Source
const (
	RequestVersion  = V1
	ResponseVersion = V1
)
View Source
const (
	// Metadata string is the constant string that will be used by the binary-pluigin helper and the cli helpers
	// To notice that
	MetadataString string = "METADATA"
)

Variables

This section is empty.

Functions

func EqualPluginOperation

func EqualPluginOperation(pluginOp1, pluginOp2 PluginOperation) bool

func EqualPluginOperationList

func EqualPluginOperationList(pluginOps1, pluginOps2 []PluginOperation) bool

func ParseOptionalFieldMapVal

func ParseOptionalFieldMapVal(sliceVal string) map[string]string

func ParseOptionalFieldSliceVal

func ParseOptionalFieldSliceVal(sliceVal string) []string

Types

type Metadata

type Metadata interface {
	Metadata() PluginMetadata
}

type OptionalFields

type OptionalFields struct {
	FlagName string `json:"flagName"`
	Help     string `json:"help"`
	Example  string `json:"example"`
}

type Plugin

type Plugin interface {
	PluginRun
	Metadata
}

type PluginMetadata

type PluginMetadata struct {
	Name            string           `json:"name"`
	Version         string           `json:"version"`
	RequestVersion  []Version        `json:"requestVersion"`
	ResponseVersion []Version        `json:"responseVersion"`
	OptionalFields  []OptionalFields `json:"optionalFields,omitempty"`
}

type PluginOperation

type PluginOperation struct {
	PluginName string
	Operation  jsonpatch.Operation
}

func PluginOperationsFromPatch

func PluginOperationsFromPatch(pluginName string, patches jsonpatch.Patch) []PluginOperation

type PluginRequest added in v0.0.2

type PluginRequest struct {
	unstructured.Unstructured `json:",inline"`
	Extras                    map[string]string `json:"extras,omitempty"`
}

type PluginResponse

type PluginResponse struct {
	Version    string          `json:"version,omitempty"`
	IsWhiteOut bool            `json:"isWhiteOut,omitempty"`
	Patches    jsonpatch.Patch `json:"patches,omitempty"`
}

type PluginRun

type PluginRun interface {
	// Determine for a given resources what the plugin is deciding to do with this
	Run(PluginRequest) (PluginResponse, error)
}

type Runner

type Runner struct {
	// This is where we need to put extra info
	// This should include generic args to be passed to each Plugin
	// This also needs to handle the options that it will need.
	// TODO: Figure out options that the runner will need and implement here.
	PluginPriorities map[string]int
	OptionalFlags    map[string]string
	Log              *logrus.Logger
}

func (*Runner) Run

func (r *Runner) Run(object unstructured.Unstructured, plugins []Plugin) (RunnerResponse, error)

type RunnerResponse

type RunnerResponse struct {
	TransformFile  []byte
	HaveWhiteOut   bool
	IgnoredPatches []byte
}

RunnerResponse will be responsble for TransformFile is a marshaled jsonpatch.Patch IgnoredPatches is a marshaled []PluginOperation

type Version

type Version string
const (
	V1 Version = "v1"
)

Jump to

Keyboard shortcuts

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