Documentation ¶
Index ¶
Constants ¶
const ( // FragmentTypeUnknown indicates this Fragment is unknown // and needs to be decoded. FragmentTypeUnknown = iota // FragmentTypeInvalid indicates that this Fragment could not be parsed // or contains syntax errors. FragmentTypeInvalid // FragmentTypeObject indicates this Fragment contains a Kubernetes Object. FragmentTypeObject // FragmentTypeModule indicates this Fragment contains a Rego module. FragmentTypeModule )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
Document is a collection of related Fragments.
func ReadDocument ¶
ReadDocument reads a stream of Fragments that are separated by a YAML document separator (see https://yaml.org/spec/1.0/#id2561718). The contents of each Fragment is opaque and need not be YAML.
type Fragment ¶
type Fragment struct { Bytes []byte Type FragmentType Location Location // contains filtered or unexported fields }
Fragment is a parseable portion of a Document.
func NewRegoFragment ¶
NewRegoFragment decodes the given data and returns a new Fragment of type FragmentTypeModule.
func (*Fragment) Decode ¶
func (f *Fragment) Decode() (FragmentType, error)
Decode attempts to parse the Fragment.
func (*Fragment) IsDecoded ¶
IsDecoded returns whether this fragment has been decoded to a known fragment type.
func (*Fragment) Object ¶
func (f *Fragment) Object() *unstructured.Unstructured
Object returns the Kubernetes object if there is one.
type FragmentType ¶
type FragmentType int
FragmentType is the parsed content type for the Fragment.
func (FragmentType) String ¶
func (t FragmentType) String() string
type InvalidFragmentErr ¶
type InvalidFragmentErr struct { // Type is the fragment type that was expected at the point // the error happened. Type FragmentType }
InvalidFragmentErr is an error value returned to indicate to the caller what type of fragment was found to be invalid.
func (*InvalidFragmentErr) Error ¶
func (e *InvalidFragmentErr) Error() string