addhdlrs

package
v2.0.0-...-98cc131 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckForUnknown

func CheckForUnknown(fldPath *field.Path, plainOrig, accepted interface{}) error

func CheckForUnknownForData

func CheckForUnknownForData(fldPath *field.Path, orig []byte, accepted interface{}) error

func PrintElements

func PrintElements(p common2.Printer, elems []Element, outfile string, fss ...vfs.FileSystem) error

func Validate

func Validate(r *ResourceInput, ctx inputs.Context, inputFilePath string) error

Types

type Element

type Element interface {
	Source() SourceInfo
	Spec() ElementSpec
	Type() string
	Data() []byte
	Input() *ResourceInput
}

func DetermineElement

func DetermineElement(ctx clictx.Context, ictx inputs.Context, si SourceInfo, d map[string]interface{}, h ElementSpecHandler) (Element, error)

func DetermineElementForData

func DetermineElementForData(ctx clictx.Context, ictx inputs.Context, si SourceInfo, d []byte, h ElementSpecHandler) (Element, error)

func DetermineElements

func DetermineElements(ctx clictx.Context, ictx inputs.Context, origin SourceInfo, d interface{}, h ElementSpecHandler) ([]Element, error)

DetermineElements maps a list of raw element specifications into an evaluated element list.

func DetermineElementsForSource

func DetermineElementsForSource(ctx clictx.Context, ictx inputs.Context, templ template.Options, h ElementSpecHandler, source ElementSource) ([]Element, error)

func MapSpecsToElems

func MapSpecsToElems[T ElementSpec](ctx clictx.Context, ictx inputs.Context, si SourceInfo, specs []T, h ElementSpecHandler) ([]Element, error)

func NewElement

func NewElement(spec ElementSpec, input *ResourceInput, src SourceInfo, data []byte, indices ...interface{}) Element

func ProcessDescriptions

func ProcessDescriptions(ctx clictx.Context, printer common2.Printer, templ template.Options, h ElementSpecHandler, sources []ElementSource) ([]Element, inputs.Context, error)

type ElementSource

type ElementSource interface {
	Origin() SourceInfo
	Get() (string, error)
}

type ElementSpec

type ElementSpec interface {
	GetName() string
	GetVersion() string
	SetVersion(string)
	Info() string
	Validate(ctx clictx.Context, input *ResourceInput) error
}

func DecodeElement

func DecodeElement(data []byte, h ElementSpecHandler) (ElementSpec, error)

type ElementSpecHandler

type ElementSpecHandler interface {
	Key() string
	RequireInputs() bool
	Decode(data []byte) (ElementSpec, error)
}

type ResourceInput

type ResourceInput struct {
	Access *cpi.GenericAccessSpec `json:"access"`
	// Input  *inputs.BlobInput                `json:"input,omitempty"`
	Input *inputs.GenericInputSpec `json:"input,omitempty"`
}

func DecodeInput

func DecodeInput(data []byte, ctx clictx.Context) (*ResourceInput, error)

type SourceInfo

type SourceInfo interface {
	Origin() string
	Id() string

	String() string
	Sub(indices ...interface{}) SourceInfo
}

func NewSourceInfo

func NewSourceInfo(origin string) SourceInfo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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