yaml

package
v0.0.0-...-2873e01 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownResource        = fmt.Errorf("unknown resource")
	ErrResourceStateUndefined = fmt.Errorf("undefined resource state")
	ErrInvalidResourceType    = fmt.Errorf("invalid resource state")
)

Functions

func Decoder

func Decoder() *decoder

func IsValidRef

func IsValidRef(s string) bool

func NewYamlEncoder

func NewYamlEncoder(cfg *EncoderConfig) envoy.PrepareEncodeStreamer

NewYamlEncoder initializes a fresh yaml encoder

Types

type Document

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

Document defines the supported yaml structure

func (*Document) Decode

func (doc *Document) Decode(ctx context.Context) ([]resource.Interface, error)

func (*Document) MarshalYAML

func (doc *Document) MarshalYAML() (interface{}, error)

func (*Document) UnmarshalYAML

func (doc *Document) UnmarshalYAML(n *yaml.Node) (err error)

type EncoderConfig

type EncoderConfig struct {
	// Skip if defines a pkg/expr expression when to skip the resource
	SkipIf string
	// Defer is called after the resource is encoded, regardles of the result
	Defer func()
	// DeferOk is called after the resource is encoded, only when successful
	DeferOk func()
	// DeferNok is called after the resource is encoded, only when failed
	// If you return an error, the encoding will terminate.
	// If you return nil (ignore the error), the encoding will continue.
	DeferNok func(error) error

	// Timezone defines what timezone should be used when encoding timestamps
	//
	// If not defined, UTC is used
	Timezone string
	// TimeLayout defines how to format the encoded timestamp
	//
	// If not defined, RFC3339 is used (this one - 2006-01-02T15:04:05Z07:00)
	TimeLayout string

	// // CompactOutput forces the output to be as compact as possible
	// CompactOutput bool
	// MappedOutput forces the sequences to encode as maps (where possible)
	MappedOutput bool
}

EncoderConfig allows us to configure the resource encoding process

type EnvoyMarshler

type EnvoyMarshler interface {
	MarshalEnvoy() ([]resource.Interface, error)
}

Jump to

Keyboard shortcuts

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