Documentation
¶
Overview ¶
Package openslosdk provides utilities for working with openslo.Object.
Index ¶
- func Decode(r io.Reader, format ObjectFormat) ([]openslo.Object, error)
- func Encode(out io.Writer, format ObjectFormat, objects ...openslo.Object) error
- func FilterByKind[T openslo.Object](objects []openslo.Object) []T
- func Validate(objects ...openslo.Object) error
- type ObjectFormat
- type ReferenceExporter
- type ReferenceInliner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode reads objects from io.Reader and decodes them, according to the provided ObjectFormat, into a slice of openslo.Object.
func Encode ¶
Encode writes the provided openslo.Object to io.Writer, according to the provided ObjectFormat.
func FilterByKind ¶
FilterByKind filters openslo.Object slice and returns its subset matching the type constraint.
Types ¶
type ObjectFormat ¶
type ObjectFormat int
ObjectFormat represents the serialization format of openslo.Object.
const ( FormatYAML ObjectFormat = iota + 1 FormatJSON )
func (ObjectFormat) String ¶
func (f ObjectFormat) String() string
String implements the fmt.Stringer interface.
func (ObjectFormat) Validate ¶
func (f ObjectFormat) Validate() error
Validate checks if ObjectFormat is supported.
type ReferenceExporter ¶ added in v0.4.0
type ReferenceExporter struct {
// contains filtered or unexported fields
}
func NewReferenceExporter ¶ added in v0.4.0
func NewReferenceExporter(objects ...openslo.Object) *ReferenceExporter
func (*ReferenceExporter) Export ¶ added in v0.4.0
func (r *ReferenceExporter) Export() []openslo.Object
Export replaces all the inlined objects with references and returns the original objects along with the exported, previously inlined, objects.
type ReferenceInliner ¶ added in v0.4.0
type ReferenceInliner struct {
// contains filtered or unexported fields
}
ReferenceInliner is a utility to inline referenced openslo.Object in referencing object(s).
func NewReferenceInliner ¶ added in v0.4.0
func NewReferenceInliner(objects ...openslo.Object) *ReferenceInliner
func (*ReferenceInliner) Inline ¶ added in v0.4.0
func (r *ReferenceInliner) Inline() ([]openslo.Object, error)
Inline finds all referenced objects in the provided slice of openslo.Object and replaces the references with an inlined version of the referenced openslo.Object. If the referenced object is not found in the provided openslo.Object slice, an error will be returned.
By default, it will not remove referenced objects from the result. If you want to remove referenced objects, you can use the ReferenceInliner.RemoveReferencedObjects option.
func (*ReferenceInliner) RemoveReferencedObjects ¶ added in v0.4.0
func (r *ReferenceInliner) RemoveReferencedObjects() *ReferenceInliner
RemoveReferencedObjects instructs ReferenceInliner to remove referenced objects from the result of ReferenceInliner.Inline.