Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scheme ¶
type Scheme struct {
// contains filtered or unexported fields
}
Scheme defines methods for serializing and deserializing API objects, a type registry for converting group, version, and kind information to and from Go schemas, and mappings between Go schemas of different versions. A scheme is the foundation for a versioned API and versioned configuration over time.
In a Scheme, a Type is a particular Go struct, a Version is a point-in-time identifier for a particular representation of that Type (typically backwards compatible), a Kind is the unique name for that Type within the Version, and a Group identifies a set of Versions, Kinds, and Types that evolve over time. An Unversioned Type is one that is not yet formally bound to a type and is promised to be backwards compatible (effectively a "v1" of a Type that does not expect to break in the future).
Schemes are not expected to change at runtime and are only threadsafe after registration is complete.
func NewScheme ¶
func NewScheme() *Scheme
NewScheme creates a new Scheme. This scheme is pluggable by default.
func (*Scheme) AddTypeDefaultingFunc ¶
func (s *Scheme) AddTypeDefaultingFunc(srcType interface{}, fn func(interface{}))
AddTypeDefaultingFunc registers a function that is passed a pointer to an object and can default fields on the object. These functions will be invoked when Default() is called. The function will never be called unless the defaulted object matches srcType. If this function is invoked twice with the same srcType, the fn passed to the later call will be used instead.
func (*Scheme) AddTypeViperLoadingFunc ¶
func (s *Scheme) AddTypeViperLoadingFunc(srcType interface{}, fn func(obj interface{}, v *viper.Viper) error)
AddTypeViperLoadingFunc registers a function that is passed a pointer to an object and can set fields from viper on the object. These functions will be invoked when Viper() is called. The function will never be called unless the object matches srcType. If this function is invoked twice with the same srcType, the fn passed to the later call will be used instead.
type SchemeBuilder ¶
SchemeBuilder collects functions that add things to a scheme. It's to allow code to compile without explicitly referencing generated types. You should declare one in each package that will have generated deep copy or conversion functions.
func NewSchemeBuilder ¶
func NewSchemeBuilder(funcs ...func(*Scheme) error) SchemeBuilder
NewSchemeBuilder calls Register for you.
func (*SchemeBuilder) AddToScheme ¶
func (sb *SchemeBuilder) AddToScheme(s *Scheme) error
AddToScheme applies all the stored functions to the scheme. A non-nil error indicates that one function failed and the attempt was abandoned.
func (*SchemeBuilder) Register ¶
func (sb *SchemeBuilder) Register(funcs ...func(*Scheme) error)
Register adds a scheme setup function to the list.