Documentation ¶
Index ¶
- Constants
- Variables
- func AsRawMessage(value interface{}) (json.RawMessage, error)
- func CheckSpecification(data []byte) error
- func CompleteSpecWithType(typ string, data []byte) ([]byte, error)
- func EvaluateUnstructured[T TypedObject, R TypedObjectDecoder[T]](u *UnstructuredTypedObject, types Scheme[T, R]) (T, error)
- func GetEncoder[T VersionedTypedObject](obj T) encoder
- func GetKind(v TypedObject) string
- func GetVersion(v TypedObject) string
- func IsUnknown(o TypedObject) bool
- func KindNames[T TypedObject, R TypedObjectDecoder[T]](scheme KnownTypesProvider[T, R]) []string
- func KindToVersionList(types []string, excludes ...string) map[string]string
- func KindVersion(t string) (string, string)
- func MarshalVersionedTypedObject[T VersionedTypedObject](obj T, toe ...TypedObjectEncoder[T]) ([]byte, error)
- func MustProtoType(proto interface{}) reflect.Type
- func Nil[T any]() T
- func ProtoType(proto interface{}) (reflect.Type, error)
- func ToYAML(data interface{}) ([]byte, error)
- func TypeName(args ...string) string
- func TypeNames[T TypedObject, R TypedObjectDecoder[T]](scheme Scheme[T, R]) []string
- func TypedObjectEqual(a, b TypedObject) bool
- func TypedObjectFactory(proto TypedObject) func() TypedObject
- func UnstructuredTypesEqual(a, b *UnstructuredTypedObject) bool
- func Validate(o interface{}) error
- type Binary
- type Converter
- type DirectDecoder
- type Encoding
- type EncodingWrapper
- type FormatVersion
- func MustNewMultiFormatVersion[T VersionedTypedObject](kind string, formats FormatVersionRegistry[T]) FormatVersion[T]
- func NewConvertedVersion[T VersionedTypedObject, I VersionedTypedObject, V TypedObject](converter Converter[I, V]) FormatVersion[T]
- func NewConvertedVersionByProto[T VersionedTypedObject, I VersionedTypedObject, V TypedObject](proto V, converter Converter[I, V]) FormatVersion[T]
- func NewMultiFormatVersion[T VersionedTypedObject](kind string, formats FormatVersionRegistry[T]) (FormatVersion[T], error)
- func NewSimpleVersion[T VersionedTypedObject, I VersionedTypedObject]() FormatVersion[T]
- type FormatVersionRegistry
- type IdentityConverter
- type InternalVersionedTypedObject
- type JSONMarhaler
- type KnownTypes
- type KnownTypesProvider
- type MarshalFunction
- type Marshaler
- type Object
- type ObjectType
- type ObjectTypedObject
- type ObjectVersionedType
- type ObjectVersionedTypedObject
- type RawValue
- type Scheme
- func MustNewDefaultScheme[T TypedObject, R TypedObjectDecoder[T]](protoUnstr Unstructured, acceptUnknown bool, ...) Scheme[T, R]
- func NewDefaultScheme[T TypedObject, R TypedObjectDecoder[T]](protoUnstr Unstructured, acceptUnknown bool, ...) (Scheme[T, R], error)
- func NewScheme[T TypedObject, R TypedObjectDecoder[T]](base ...Scheme[T, R]) Scheme[T, R]
- type SchemeCommon
- type TypeGetter
- type TypeInfo
- type TypeScheme
- func MustNewDefaultTypeScheme[T TypedObject, R TypedObjectType[T]](protoUnstr Unstructured, acceptUnknown bool, ...) TypeScheme[T, R]
- func NewDefaultTypeScheme[T TypedObject, R TypedObjectType[T]](protoUnstr Unstructured, acceptUnknown bool, ...) (TypeScheme[T, R], error)
- func NewTypeScheme[T TypedObject, R TypedObjectType[T]](base ...TypeScheme[T, R]) TypeScheme[T, R]
- type TypeSetter
- type TypeVersionScheme
- type TypedObject
- type TypedObjectDecoder
- type TypedObjectEncoder
- type TypedObjectType
- type Unknown
- type UnmarshalFunction
- type Unmarshaler
- type Unstructured
- type UnstructuredConverter
- type UnstructuredMap
- type UnstructuredTypedObject
- func (u *UnstructuredTypedObject) DeepCopy() *UnstructuredTypedObject
- func (u *UnstructuredTypedObject) DeepCopyInto(out **UnstructuredTypedObject)
- func (u UnstructuredTypedObject) GetRaw() ([]byte, error)
- func (u UnstructuredTypedObject) MarshalJSON() ([]byte, error)
- func (_ UnstructuredTypedObject) OpenAPISchemaFormat() string
- func (_ UnstructuredTypedObject) OpenAPISchemaType() []string
- func (u *UnstructuredTypedObject) SetType(ttype string)
- func (s *UnstructuredTypedObject) ToUnstructured() (*UnstructuredTypedObject, error)
- func (u *UnstructuredTypedObject) UnmarshalJSON(data []byte) error
- type UnstructuredTypedObjectList
- type UnstructuredVersionedTypedObject
- func (u *UnstructuredVersionedTypedObject) DeepCopy() *UnstructuredVersionedTypedObject
- func (s *UnstructuredVersionedTypedObject) GetKind() string
- func (s *UnstructuredVersionedTypedObject) GetVersion() string
- func (s *UnstructuredVersionedTypedObject) ToUnstructured() (*UnstructuredTypedObject, error)
- type Validater
- type VersionedObjectType
- type VersionedTypeInfo
- type VersionedTypeRegistry
- type VersionedTypedObject
- type VersionedTypedObjectType
- func NewMultiFormatVersionedType[T VersionedTypedObject, R VersionedTypedObjectType[T]](kind string, versions TypeVersionScheme[T, R]) (VersionedTypedObjectType[T], error)
- func NewVersionedTypedObjectType[T VersionedTypedObject, I VersionedTypedObject](name string) VersionedTypedObjectType[T]
- func NewVersionedTypedObjectTypeByConverter[T VersionedTypedObject, I VersionedTypedObject, V TypedObject](name string, converter Converter[I, V]) VersionedTypedObjectType[T]
- func NewVersionedTypedObjectTypeByFormatVersion[T VersionedTypedObject](name string, fmt FormatVersion[T]) VersionedTypedObjectType[T]
- func NewVersionedTypedObjectTypeByProtoConverter[T VersionedTypedObject, I VersionedTypedObject](name string, proto TypedObject, converter Converter[I, TypedObject]) VersionedTypedObjectType[T]
- func NewVersionedTypedObjectTypeByVersion[T VersionedTypedObject, I VersionedTypedObject](name string, version FormatVersion[I]) VersionedTypedObjectType[T]
Constants ¶
const ATTR_TYPE = "type"
const VersionSeparator = "/"
Variables ¶
var DefaultJSONEncoding = &EncodingWrapper{ Marshaler: MarshalFunction(json.Marshal), Unmarshaler: UnmarshalFunction(json.Unmarshal), }
var DefaultYAMLEncoding = &EncodingWrapper{ Marshaler: MarshalFunction(yaml.Marshal), Unmarshaler: UnmarshalFunction(func(data []byte, obj interface{}) error { return yaml.Unmarshal(data, obj) }), }
Functions ¶
func AsRawMessage ¶ added in v0.4.1
func AsRawMessage(value interface{}) (json.RawMessage, error)
func CheckSpecification ¶ added in v0.7.0
CheckSpecification checks a byte sequence to describe a valid minimum specification object.
func CompleteSpecWithType ¶ added in v0.9.0
func EvaluateUnstructured ¶ added in v0.3.0
func EvaluateUnstructured[T TypedObject, R TypedObjectDecoder[T]](u *UnstructuredTypedObject, types Scheme[T, R]) (T, error)
EvaluateUnstructured converts an unstructured object into a typed object. Go does not support generic methods.
func GetEncoder ¶ added in v0.3.0
func GetEncoder[T VersionedTypedObject](obj T) encoder
func GetKind ¶ added in v0.3.0
func GetKind(v TypedObject) string
func GetVersion ¶ added in v0.3.0
func GetVersion(v TypedObject) string
func IsUnknown ¶ added in v0.3.0
func IsUnknown(o TypedObject) bool
func KindNames ¶
func KindNames[T TypedObject, R TypedObjectDecoder[T]](scheme KnownTypesProvider[T, R]) []string
func KindToVersionList ¶ added in v0.3.0
func KindVersion ¶
func MarshalVersionedTypedObject ¶ added in v0.3.0
func MarshalVersionedTypedObject[T VersionedTypedObject](obj T, toe ...TypedObjectEncoder[T]) ([]byte, error)
func MustProtoType ¶
func TypeNames ¶
func TypeNames[T TypedObject, R TypedObjectDecoder[T]](scheme Scheme[T, R]) []string
func TypedObjectEqual ¶
func TypedObjectEqual(a, b TypedObject) bool
TypedObjectEqual compares two typed objects using the unstructured type.
func TypedObjectFactory ¶
func TypedObjectFactory(proto TypedObject) func() TypedObject
func UnstructuredTypesEqual ¶
func UnstructuredTypesEqual(a, b *UnstructuredTypedObject) bool
UnstructuredTypesEqual compares two unstructured object.
Types ¶
type Binary ¶
type Binary []byte
Binary holds binary data which will be marshaled a base64 encoded string. If the string starts with a '!', the data is used as string byte sequence.
func (Binary) MarshalJSON ¶
MarshalJSON returns m as the JSON encoding of m.
func (*Binary) UnmarshalJSON ¶
UnmarshalJSON sets *m to a copy of data.
type Converter ¶ added in v0.3.0
type Converter[T VersionedTypedObject, V TypedObject] interface { // ConvertFrom converts from an internal version into an external format. ConvertFrom(object T) (V, error) // ConvertTo converts from an external format into an internal version. ConvertTo(object V) (T, error) }
type DirectDecoder ¶
type DirectDecoder[T TypedObject] struct { // contains filtered or unexported fields }
func MustNewDirectDecoder ¶
func MustNewDirectDecoder[T TypedObject](proto T) *DirectDecoder[T]
func NewDirectDecoder ¶
func NewDirectDecoder[T TypedObject](proto T) (*DirectDecoder[T], error)
func (*DirectDecoder[T]) CreateInstance ¶
func (d *DirectDecoder[T]) CreateInstance() T
func (*DirectDecoder[T]) Decode ¶
func (d *DirectDecoder[T]) Decode(data []byte, unmarshaler Unmarshaler) (T, error)
type Encoding ¶
type Encoding interface { Unmarshaler Marshaler }
type EncodingWrapper ¶
type EncodingWrapper struct { Unmarshaler Marshaler }
type FormatVersion ¶ added in v0.3.0
type FormatVersion[T VersionedTypedObject] interface { TypedObjectDecoder[T] TypedObjectEncoder[T] }
func MustNewMultiFormatVersion ¶ added in v0.3.0
func MustNewMultiFormatVersion[T VersionedTypedObject](kind string, formats FormatVersionRegistry[T]) FormatVersion[T]
func NewConvertedVersion ¶ added in v0.3.0
func NewConvertedVersion[T VersionedTypedObject, I VersionedTypedObject, V TypedObject](converter Converter[I, V]) FormatVersion[T]
NewConvertedVersion creates a new format version for versioned typed objects, where T is the common *interface* of all types of the same type realm and I is the *internal implementation* commonly used for the various version variants of a dedicated kind of type, representing the format this format version is responsible for. Therefore, I must be subtype of T, which cannot be expressed in Go. The converter must convert between the external version, specified by the given prototype and the *internal* representation (type I) used to internally represent a set of variants as Go object.
func NewConvertedVersionByProto ¶ added in v0.3.0
func NewConvertedVersionByProto[T VersionedTypedObject, I VersionedTypedObject, V TypedObject](proto V, converter Converter[I, V]) FormatVersion[T]
func NewMultiFormatVersion ¶ added in v0.3.0
func NewMultiFormatVersion[T VersionedTypedObject](kind string, formats FormatVersionRegistry[T]) (FormatVersion[T], error)
NewMultiFormatVersion is an anonymous version, which covers a set of formats. It also accepts legacy formats with a legacy kind.
func NewSimpleVersion ¶ added in v0.3.0
func NewSimpleVersion[T VersionedTypedObject, I VersionedTypedObject]() FormatVersion[T]
NewSimpleVersion creates a new format version for versioned typed objects, where T is the common *interface* of all types of the same type realm. It creates an external version identical to the internal representation (type I). This must be a struct pointer type.
type FormatVersionRegistry ¶ added in v0.3.0
type FormatVersionRegistry[I VersionedTypedObject] interface { FormatVersion[I] Register(string, FormatVersion[I]) KnownFormats() map[string]FormatVersion[I] GetFormat(name string) FormatVersion[I] }
func NewFormatVersionRegistry ¶ added in v0.3.0
func NewFormatVersionRegistry[I VersionedTypedObject]() FormatVersionRegistry[I]
type IdentityConverter ¶ added in v0.3.0
type IdentityConverter[T TypedObject] struct{}
func (IdentityConverter[T]) ConvertFrom ¶ added in v0.3.0
func (_ IdentityConverter[T]) ConvertFrom(object T) (T, error)
func (IdentityConverter[T]) ConvertTo ¶ added in v0.3.0
func (_ IdentityConverter[T]) ConvertTo(object T) (T, error)
type InternalVersionedTypedObject ¶ added in v0.3.0
type InternalVersionedTypedObject[T VersionedTypedObject] struct { ObjectVersionedType // contains filtered or unexported fields }
InternalVersionedTypedObject is the base type used by *internal* representations of versioned specification formats. It is used to convert from/to dedicated format versions.
func NewInternalVersionedTypedObject ¶ added in v0.3.0
func NewInternalVersionedTypedObject[T VersionedTypedObject](encoder TypedObjectEncoder[T], types ...string) InternalVersionedTypedObject[T]
type JSONMarhaler ¶
type KnownTypes ¶
type KnownTypes[T TypedObject, R TypedObjectDecoder[T]] map[string]R
KnownTypes is a set of known type names mapped to appropriate object decoders.
func (KnownTypes[T, R]) Copy ¶
func (t KnownTypes[T, R]) Copy() KnownTypes[T, R]
Copy provides a copy of the actually known types.
func (KnownTypes[T, R]) TypeNames ¶
func (t KnownTypes[T, R]) TypeNames() []string
TypeNames return a sorted list of known type names.
type KnownTypesProvider ¶ added in v0.3.0
type KnownTypesProvider[T TypedObject, R TypedObjectDecoder[T]] interface { KnownTypes() KnownTypes[T, R] }
type MarshalFunction ¶
func (MarshalFunction) Marshal ¶
func (f MarshalFunction) Marshal(obj interface{}) ([]byte, error)
type ObjectType ¶
type ObjectType struct { // Type describes the type of the object. Type string `json:"type"` }
ObjectType is the data type providing serializable type information. It is an implementation of TypeInfo.
func NewObjectType ¶
func NewObjectType(typ string) ObjectType
NewObjectType creates an ObjectType value.
func (ObjectType) GetType ¶
func (t ObjectType) GetType() string
GetType returns the type of the object.
func (*ObjectType) SetType ¶
func (t *ObjectType) SetType(typ string)
SetType sets the type of the object.
type ObjectTypedObject ¶ added in v0.3.0
type ObjectTypedObject = ObjectType
ObjectTypedObject is the minimal implementation of a typed object managing the type information.
func NewTypedObject ¶ added in v0.3.0
func NewTypedObject(typ string) ObjectTypedObject
type ObjectVersionedType ¶
type ObjectVersionedType = ObjectVersionedTypedObject
ObjectVersionedType is a minimal implementation of a VersionedTypedObject. For compatibility, we keep the old not aligned type name.
type ObjectVersionedTypedObject ¶ added in v0.3.0
type ObjectVersionedTypedObject = VersionedObjectType
ObjectVersionedTypedObject is a minimal implementation of a VersionedTypedObject.
func NewVersionedTypedObject ¶ added in v0.3.0
func NewVersionedTypedObject(args ...string) ObjectVersionedTypedObject
NewVersionedTypedObject creates an ObjectVersionedType value.
type RawValue ¶ added in v0.4.1
type RawValue struct {
json.RawMessage `json:",inline"`
}
RawValue is a json-encoded representation of a value object like a json.RawMessage, but additionally offers Getter and Setter.
type Scheme ¶
type Scheme[T TypedObject, R TypedObjectDecoder[T]] interface { SchemeCommon KnownTypesProvider[T, R] TypedObjectEncoder[T] TypedObjectDecoder[T] BaseScheme() Scheme[T, R] // Go does not support an additional type parameter S Scheme[T,S] to return the correct type here AddKnownTypes(scheme KnownTypesProvider[T, R]) RegisterByDecoder(typ string, decoder R) error ValidateInterface(object T) error CreateUnstructured() T Convert(object TypedObject) (T, error) GetDecoder(otype string) R EnforceDecode(data []byte, unmarshaler Unmarshaler) (T, error) }
Scheme is the interface to describe a set of object types that implement a dedicated interface. As such it knows about the desired interface of the instances and can validate it. Additionally, it provides an implementation for generic unstructured objects that can be used to decode any serialized from of object candidates and provide the effective type.
func MustNewDefaultScheme ¶
func MustNewDefaultScheme[T TypedObject, R TypedObjectDecoder[T]](protoUnstr Unstructured, acceptUnknown bool, defaultdecoder TypedObjectDecoder[T], base ...Scheme[T, R]) Scheme[T, R]
func NewDefaultScheme ¶
func NewDefaultScheme[T TypedObject, R TypedObjectDecoder[T]](protoUnstr Unstructured, acceptUnknown bool, defaultdecoder TypedObjectDecoder[T], base ...Scheme[T, R]) (Scheme[T, R], error)
func NewScheme ¶ added in v0.3.0
func NewScheme[T TypedObject, R TypedObjectDecoder[T]](base ...Scheme[T, R]) Scheme[T, R]
type SchemeCommon ¶ added in v0.3.0
type SchemeCommon interface {
KnownTypeNames() []string
}
type TypeGetter ¶
type TypeGetter interface { // GetType returns the type of the access object. GetType() string }
TypeGetter is the interface to be implemented for extracting a type.
type TypeInfo ¶ added in v0.3.0
type TypeInfo interface { TypeGetter }
TypeInfo defines the accessors for type information.
type TypeScheme ¶ added in v0.3.0
type TypeScheme[T TypedObject, R TypedObjectType[T]] interface { Scheme[T, R] Register(typ R) GetType(name string) R }
TypeScheme is a scheme based on Types instead of decoders.
func MustNewDefaultTypeScheme ¶ added in v0.3.0
func MustNewDefaultTypeScheme[T TypedObject, R TypedObjectType[T]](protoUnstr Unstructured, acceptUnknown bool, defaultdecoder TypedObjectDecoder[T], base ...TypeScheme[T, R]) TypeScheme[T, R]
func NewDefaultTypeScheme ¶ added in v0.3.0
func NewDefaultTypeScheme[T TypedObject, R TypedObjectType[T]](protoUnstr Unstructured, acceptUnknown bool, defaultdecoder TypedObjectDecoder[T], base ...TypeScheme[T, R]) (TypeScheme[T, R], error)
func NewTypeScheme ¶ added in v0.3.0
func NewTypeScheme[T TypedObject, R TypedObjectType[T]](base ...TypeScheme[T, R]) TypeScheme[T, R]
type TypeSetter ¶
type TypeSetter interface { // SetType sets the type of abstract element SetType(typ string) }
TypeSetter is the interface to be implemented for extracting a type.
type TypeVersionScheme ¶ added in v0.3.0
type TypeVersionScheme[T VersionedTypedObject, R VersionedTypedObjectType[T]] interface { WithKindAliases(kind ...string) TypeVersionScheme[T, R] Register(t R) error // contains filtered or unexported methods }
TypeVersionScheme is used to register different versions for the same internal representation of a versioned typed object.
func NewTypeVersionScheme ¶ added in v0.3.0
func NewTypeVersionScheme[T VersionedTypedObject, R VersionedTypedObjectType[T]](kind string, reg VersionedTypeRegistry[T, R]) TypeVersionScheme[T, R]
type TypedObject ¶
type TypedObject interface { TypeInfo }
TypedObject defines the common interface for all kinds of typed objects.
type TypedObjectDecoder ¶
type TypedObjectDecoder[T TypedObject] interface { Decode(data []byte, unmarshaler Unmarshaler) (T, error) }
TypedObjectDecoder is able to provide an effective typed object for some serilaized form. The technical deserialization is done by an Unmarshaler.
type TypedObjectEncoder ¶
type TypedObjectEncoder[T TypedObject] interface { Encode(T, Marshaler) ([]byte, error) }
TypedObjectEncoder is able to provide a versioned representation of an effective TypedObject.
type TypedObjectType ¶ added in v0.3.0
type TypedObjectType[T TypedObject] interface { TypeInfo TypedObjectDecoder[T] }
TypedObjectType is the interface for a type object for an TypedObject.
func NewTypedObjectTypeByDecoder ¶ added in v0.3.0
func NewTypedObjectTypeByDecoder[T TypedObject](name string, decoder TypedObjectDecoder[T]) TypedObjectType[T]
func NewTypedObjectTypeByProto ¶ added in v0.3.0
func NewTypedObjectTypeByProto[T TypedObject](name string, proto T) TypedObjectType[T]
type Unknown ¶ added in v0.3.0
type Unknown interface {
IsUnknown() bool
}
Unknown is the interface to be implemented by representations on an unknown, but nevertheless decoded specification of a typed object.
type UnmarshalFunction ¶
func (UnmarshalFunction) Unmarshal ¶
func (f UnmarshalFunction) Unmarshal(data []byte, obj interface{}) error
type Unmarshaler ¶
type Unstructured ¶
type Unstructured interface { TypeGetter GetRaw() ([]byte, error) }
Unstructured is the interface to represent generic object data for types handled by schemes.
type UnstructuredConverter ¶
type UnstructuredConverter interface {
ToUnstructured() (*UnstructuredTypedObject, error)
}
UnstructuredConverter converts the actual object to an UnstructuredTypedObject.
type UnstructuredMap ¶
type UnstructuredMap map[string]interface{}
UnstructuredMap is a generic data map.
func ToUnstructuredObject ¶
func ToUnstructuredObject(obj interface{}) (UnstructuredMap, error)
ToUnstructuredObject converts any object into a structure map.
func (UnstructuredMap) FlatCopy ¶
func (m UnstructuredMap) FlatCopy() UnstructuredMap
FlatCopy just copies the attributes.
func (UnstructuredMap) FlatMerge ¶
func (m UnstructuredMap) FlatMerge(o UnstructuredMap) UnstructuredMap
FlatMerge just joins the direct attribute set.
func (UnstructuredMap) Match ¶ added in v0.3.0
func (m UnstructuredMap) Match(o UnstructuredMap) bool
type UnstructuredTypedObject ¶
type UnstructuredTypedObject struct { ObjectType `json:",inline"` Object UnstructuredMap `json:"-"` }
UnstructuredTypedObject describes a generic typed object. +kubebuilder:pruning:PreserveUnknownFields
func NewEmptyUnstructured ¶
func NewEmptyUnstructured(ttype string) *UnstructuredTypedObject
NewEmptyUnstructured creates a new typed object without additional data.
func NewUnstructured ¶ added in v0.4.1
func NewUnstructured(ttype string, data UnstructuredMap) *UnstructuredTypedObject
NewUnstructured creates a new unstructured typed object.
func ToUnstructuredTypedObject ¶
func ToUnstructuredTypedObject(obj interface{}) (*UnstructuredTypedObject, error)
ToUnstructuredTypedObject converts an object to an unstructured object.
func (*UnstructuredTypedObject) DeepCopy ¶
func (u *UnstructuredTypedObject) DeepCopy() *UnstructuredTypedObject
DeepCopy is a deepcopy function, copying the receiver, creating a new UnstructuredTypedObject.
func (*UnstructuredTypedObject) DeepCopyInto ¶
func (u *UnstructuredTypedObject) DeepCopyInto(out **UnstructuredTypedObject)
DeepCopyInto is deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (UnstructuredTypedObject) GetRaw ¶
func (u UnstructuredTypedObject) GetRaw() ([]byte, error)
func (UnstructuredTypedObject) MarshalJSON ¶
func (u UnstructuredTypedObject) MarshalJSON() ([]byte, error)
MarshalJSON implements a custom json unmarshal method for a unstructured type.
func (UnstructuredTypedObject) OpenAPISchemaFormat ¶
func (_ UnstructuredTypedObject) OpenAPISchemaFormat() string
func (UnstructuredTypedObject) OpenAPISchemaType ¶
func (_ UnstructuredTypedObject) OpenAPISchemaType() []string
func (*UnstructuredTypedObject) SetType ¶
func (u *UnstructuredTypedObject) SetType(ttype string)
func (*UnstructuredTypedObject) ToUnstructured ¶
func (s *UnstructuredTypedObject) ToUnstructured() (*UnstructuredTypedObject, error)
func (*UnstructuredTypedObject) UnmarshalJSON ¶
func (u *UnstructuredTypedObject) UnmarshalJSON(data []byte) error
UnmarshalJSON implements a custom json unmarshal method for a unstructured typed object.
type UnstructuredTypedObjectList ¶
type UnstructuredTypedObjectList []*UnstructuredTypedObject
func (UnstructuredTypedObjectList) Copy ¶
func (l UnstructuredTypedObjectList) Copy() UnstructuredTypedObjectList
type UnstructuredVersionedTypedObject ¶
type UnstructuredVersionedTypedObject struct {
UnstructuredTypedObject `json:",inline"`
}
func NewEmptyUnstructuredVersioned ¶
func NewEmptyUnstructuredVersioned(ttype string) *UnstructuredVersionedTypedObject
NewEmptyUnstructuredVersioned creates a new typed object without additional data.
func ToUnstructuredVersionedTypedObject ¶
func ToUnstructuredVersionedTypedObject(obj TypedObject) (*UnstructuredVersionedTypedObject, error)
func (*UnstructuredVersionedTypedObject) DeepCopy ¶
func (u *UnstructuredVersionedTypedObject) DeepCopy() *UnstructuredVersionedTypedObject
func (*UnstructuredVersionedTypedObject) GetKind ¶
func (s *UnstructuredVersionedTypedObject) GetKind() string
func (*UnstructuredVersionedTypedObject) GetVersion ¶
func (s *UnstructuredVersionedTypedObject) GetVersion() string
func (*UnstructuredVersionedTypedObject) ToUnstructured ¶
func (s *UnstructuredVersionedTypedObject) ToUnstructured() (*UnstructuredTypedObject, error)
type VersionedObjectType ¶ added in v0.3.0
type VersionedObjectType ObjectType
func NewVersionedObjectType ¶
func NewVersionedObjectType(args ...string) VersionedObjectType
func (VersionedObjectType) GetKind ¶ added in v0.3.0
func (v VersionedObjectType) GetKind() string
GetKind returns the kind of the object.
func (VersionedObjectType) GetType ¶ added in v0.3.0
func (t VersionedObjectType) GetType() string
GetType returns the type of the object.
func (VersionedObjectType) GetVersion ¶ added in v0.3.0
func (v VersionedObjectType) GetVersion() string
GetVersion returns the version of the object.
func (*VersionedObjectType) SetKind ¶ added in v0.3.0
func (v *VersionedObjectType) SetKind(kind string)
SetKind sets the kind of the object.
func (*VersionedObjectType) SetType ¶ added in v0.3.0
func (t *VersionedObjectType) SetType(typ string)
SetType sets the type of the object.
func (*VersionedObjectType) SetVersion ¶ added in v0.3.0
func (v *VersionedObjectType) SetVersion(version string)
SetVersion sets the version of the object.
type VersionedTypeInfo ¶ added in v0.3.0
VersionedTypeInfo in the accessor for versioned type information.
type VersionedTypeRegistry ¶ added in v0.3.0
type VersionedTypeRegistry[T VersionedTypedObject, R VersionedTypedObjectType[T]] interface { Register(t R) // contains filtered or unexported methods }
type VersionedTypedObject ¶
type VersionedTypedObject interface { TypedObject VersionedTypeInfo }
VersionedTypedObject in an instance of a VersionedType.
type VersionedTypedObjectType ¶ added in v0.3.0
type VersionedTypedObjectType[T VersionedTypedObject] interface { VersionedTypeInfo TypedObjectDecoder[T] TypedObjectEncoder[T] }
VersionedTypedObjectType is the interface of a type object for a versioned type.
func NewMultiFormatVersionedType ¶ added in v0.3.0
func NewMultiFormatVersionedType[T VersionedTypedObject, R VersionedTypedObjectType[T]](kind string, versions TypeVersionScheme[T, R]) (VersionedTypedObjectType[T], error)
func NewVersionedTypedObjectType ¶ added in v0.3.0
func NewVersionedTypedObjectType[T VersionedTypedObject, I VersionedTypedObject](name string) VersionedTypedObjectType[T]
func NewVersionedTypedObjectTypeByConverter ¶ added in v0.3.0
func NewVersionedTypedObjectTypeByConverter[T VersionedTypedObject, I VersionedTypedObject, V TypedObject](name string, converter Converter[I, V]) VersionedTypedObjectType[T]
func NewVersionedTypedObjectTypeByFormatVersion ¶ added in v0.3.0
func NewVersionedTypedObjectTypeByFormatVersion[T VersionedTypedObject](name string, fmt FormatVersion[T]) VersionedTypedObjectType[T]
func NewVersionedTypedObjectTypeByProtoConverter ¶ added in v0.3.0
func NewVersionedTypedObjectTypeByProtoConverter[T VersionedTypedObject, I VersionedTypedObject](name string, proto TypedObject, converter Converter[I, TypedObject]) VersionedTypedObjectType[T]
func NewVersionedTypedObjectTypeByVersion ¶ added in v0.3.0
func NewVersionedTypedObjectTypeByVersion[T VersionedTypedObject, I VersionedTypedObject](name string, version FormatVersion[I]) VersionedTypedObjectType[T]
NewVersionedTypedObjectTypeByVersion creates a new type object for versioned typed objects, where T is the common *interface* of all types of the same type realm and I is the *internal implementation* commonly used for the various version variants of a dedicated kind of type. Therefore, I must be subtype of T, which cannot be expressed in Go.