Documentation ¶
Overview ¶
Package converter provides utilities for converting between various types.
Index ¶
- func SanitizeName(name string) string
- type ContentType
- type Demuxer
- type Muxer
- func (m *Muxer) ToBundle() (*bundle.Bundle, error)
- func (m *Muxer) ToComponentPackage() (*bundle.ComponentPackage, error)
- func (m *Muxer) ToComponentSet() (*bundle.ComponentSet, error)
- func (m *Muxer) ToObject(obj interface{}) error
- func (m *Muxer) ToUnstructured() (*unstructured.Unstructured, error)
- type ObjectExporter
- type UnstructuredConverter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SanitizeName ¶ added in v0.4.1
SanitizeName sanitizes a metadata.name field, replacing unsafe characters with _ and truncating if it's longer than 253 characters.
Types ¶
type ContentType ¶ added in v0.5.0
type ContentType string
ContentType for conversion.
var ( // UnknownContent indicates content of unknown type. UnknownContent ContentType // YAML indicates YAML content. YAML ContentType = "yaml" // JSON indicates JSON content. JSON ContentType = "json" )
type Demuxer ¶ added in v0.5.0
type Demuxer struct {
// contains filtered or unexported fields
}
Demuxer converts from an object to some serialized format for the object.
func FromObject ¶ added in v0.5.0
func FromObject(obj interface{}) *Demuxer
FromObject creates a converting demuxer from an object.
func (*Demuxer) ToContentType ¶ added in v0.5.0
ToContentType converts to a custom content type.
type Muxer ¶ added in v0.5.0
type Muxer struct {
// contains filtered or unexported fields
}
Muxer converts from an object's serialized format to an actual instance of the object.
func FromContentType ¶ added in v0.5.0
FromContentType takes an explicit content type to use for creating a conversion Muxer.
func FromFileName ¶ added in v0.5.0
FromFileName creates a Muxer instance by guessing the type based on the file extension.
func FromJSONString ¶ added in v0.5.0
FromJSONString creates a Muxer instance from a JSON string.
func FromYAMLString ¶ added in v0.5.0
FromYAMLString creates a Muxer instance from a YAML string.
func (*Muxer) ToComponentPackage ¶ added in v0.5.0
func (m *Muxer) ToComponentPackage() (*bundle.ComponentPackage, error)
ToComponentPackage converts input data to the ComponentPackage type.
func (*Muxer) ToComponentSet ¶ added in v0.5.0
func (m *Muxer) ToComponentSet() (*bundle.ComponentSet, error)
ToComponentSet converts input data to the ComponentSet type.
func (*Muxer) ToObject ¶ added in v0.6.1
ToObject converts to an arbitrary object via standard YAML / JSON serialization.
func (*Muxer) ToUnstructured ¶ added in v0.5.0
func (m *Muxer) ToUnstructured() (*unstructured.Unstructured, error)
ToUnstructured converts input data to the Unstructured type.
type ObjectExporter ¶
type ObjectExporter struct {
Objects []*unstructured.Unstructured
}
ObjectExporter exports cluster objects
func (*ObjectExporter) ExportAsMultiYAML ¶
func (e *ObjectExporter) ExportAsMultiYAML() ([]string, error)
ExportAsMultiYAML converts cluster objects into multiple YAML files.
func (*ObjectExporter) ExportAsYAML ¶
func (e *ObjectExporter) ExportAsYAML() (string, error)
ExportAsYAML converts cluster objects into single YAML file.
type UnstructuredConverter ¶ added in v0.5.0
type UnstructuredConverter struct {
// contains filtered or unexported fields
}
UnstructuredConverter is a converter between unstructured.Unstructured and other types.
func FromUnstructured ¶ added in v0.5.0
func FromUnstructured(o *unstructured.Unstructured) *UnstructuredConverter
FromUnstructured creates an UnstructuredConverter.
func (*UnstructuredConverter) ExtractObjectMeta ¶ added in v0.5.0
func (c *UnstructuredConverter) ExtractObjectMeta() *metav1.ObjectMeta
ExtractObjectMeta creates an ObjectMeta object from an Unstructured object.
func (*UnstructuredConverter) ToObject ¶ added in v0.6.1
func (c *UnstructuredConverter) ToObject(obj interface{}) error
ToObject converts an Unstructured object to an arbitrary interface via JSON.