Documentation ¶
Index ¶
- func CheckForUnknown(fldPath *field.Path, plainOrig, accepted interface{}) error
- func CheckForUnknownForData(fldPath *field.Path, orig []byte, accepted interface{}) error
- func PrintElements(p common2.Printer, elems []Element, outfile string, fss ...vfs.FileSystem) error
- func Validate(r *ResourceInput, ctx inputs.Context, inputFilePath string) error
- func ValidateElementIdentities(kind string, elems []Element) error
- func ValidateElementSpecIdentities(kind string, src string, elems []ElementSpec) error
- type Element
- func DetermineElement(ctx clictx.Context, ictx inputs.Context, si SourceInfo, ...) (Element, error)
- func DetermineElementForData(ctx clictx.Context, ictx inputs.Context, si SourceInfo, d []byte, ...) (Element, error)
- func DetermineElements(ctx clictx.Context, ictx inputs.Context, origin SourceInfo, d interface{}, ...) ([]Element, error)
- func DetermineElementsForSource(ctx clictx.Context, ictx inputs.Context, templ template.Options, ...) ([]Element, error)
- func MapSpecsToElems[T ElementSpec](ctx clictx.Context, ictx inputs.Context, si SourceInfo, specs []T, ...) ([]Element, error)
- func NewElement(spec ElementSpec, input *ResourceInput, src SourceInfo, data []byte, ...) Element
- func ProcessDescriptions(ctx clictx.Context, printer common2.Printer, templ template.Options, ...) ([]Element, inputs.Context, error)
- type ElementSource
- type ElementSpec
- type ElementSpecHandler
- type ResourceInput
- type SourceInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckForUnknown ¶
func CheckForUnknownForData ¶
func PrintElements ¶
func ValidateElementIdentities ¶ added in v0.5.0
func ValidateElementSpecIdentities ¶ added in v0.5.0
func ValidateElementSpecIdentities(kind string, src string, elems []ElementSpec) error
ValidateElementSpecIdentities validate the element specifications taken from some source (for example a resources.yaml or components.yaml). The parameter src somehow identifies the element source, for example the path of the parsed file.
Types ¶
type Element ¶
type Element interface { // Source provides info about the source the element has been // derived from. (for example a component.yaml or resources.yaml). Source() SourceInfo // Spec provides access to the element specification. Spec() ElementSpec // Type is used for types elements, like sources and resources. Type() string // Data provides access to the element descriptor representation. Data() []byte // Input provides access to the underlying data specification. // It is either an access specification or an input specification. Input() *ResourceInput }
Element is the abstraction over model elements handled by the add handler, for example, resources, sources, references or complete component versions.
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 ¶
type ElementSource ¶
type ElementSource interface { // Origin provides access to the source // specification used to provide elements. Origin() SourceInfo // Get provides access to the content of the element source. Get() (string, error) }
type ElementSpec ¶
type ElementSpec interface { GetName() string GetVersion() string SetVersion(string) GetRawIdentity() metav1.Identity Info() string Validate(ctx clictx.Context, input *ResourceInput) error }
ElementSpec is the specification of the model element. It provides access to common attributes, like the identity.
func DecodeElement ¶
func DecodeElement(data []byte, h ElementSpecHandler) (ElementSpec, error)
type ElementSpecHandler ¶
type ElementSpecHandler interface { Key() string RequireInputs() bool Decode(data []byte) (ElementSpec, error) }
ElementSpecHandler is the interface for a handler responsible to handle a dedicated kind of element specification.
type ResourceInput ¶
type ResourceInput struct { Access *cpi.GenericAccessSpec `json:"access"` // Input *inputs.BlobInput `json:"input,omitempty"` Input *inputs.GenericInputSpec `json:"input,omitempty"` }
ResourceInput describe the source for the content of a content based element (sources or resources). It is either an input or access specification.
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