Documentation ¶
Index ¶
- Variables
- func NewUnstructuredCreator() runtime.ObjectCreater
- func NewUnstructuredNegotiatedSerializer() runtime.NegotiatedSerializer
- type Serializer
- type SerializerManager
- type UnstructuredNegotiatedSerializer
- func (s UnstructuredNegotiatedSerializer) DecoderToVersion(decoder runtime.Decoder, _ runtime.GroupVersioner) runtime.Decoder
- func (s UnstructuredNegotiatedSerializer) EncoderForVersion(encoder runtime.Encoder, _ runtime.GroupVersioner) runtime.Encoder
- func (s UnstructuredNegotiatedSerializer) SupportedMediaTypes() []runtime.SerializerInfo
- type WithVersionCodecFactory
- type WithVersionDecoder
Constants ¶
This section is empty.
Variables ¶
var YurtHubSerializer = NewSerializerManager()
YurtHubSerializer is a global serializer manager for yurthub
Functions ¶
func NewUnstructuredCreator ¶
func NewUnstructuredCreator() runtime.ObjectCreater
NewUnstructuredCreator returns a simple object creator that always returns an Unstructured or UnstructuredList
func NewUnstructuredNegotiatedSerializer ¶
func NewUnstructuredNegotiatedSerializer() runtime.NegotiatedSerializer
NewUnstructuredNegotiatedSerializer returns a negotiated serializer for Unstructured resources
Types ¶
type Serializer ¶
type Serializer struct { runtime.ClientNegotiator // contains filtered or unexported fields }
Serializer is used for transforming objects into a serialized format and back for cache manager of hub agent.
func (*Serializer) Decode ¶
func (s *Serializer) Decode(b []byte) (runtime.Object, error)
Decode decodes byte data into runtime object with embedded contentType.
func (*Serializer) Encode ¶ added in v0.4.1
func (s *Serializer) Encode(obj runtime.Object) ([]byte, error)
Encode encode object and return bytes of it.
func (*Serializer) WatchDecoder ¶
func (s *Serializer) WatchDecoder(body io.ReadCloser) (*restclientwatch.Decoder, error)
WatchDecoder generates a Decoder for decoding response of watch request.
func (*Serializer) WatchEncode ¶
WatchEncode writes watch event to provided io.Writer
type SerializerManager ¶
type SerializerManager struct { sync.Mutex // NegotiatedSerializer is used for obtaining encoders and decoders for multiple // supported media types. NegotiatedSerializer runtime.NegotiatedSerializer // UnstructuredNegotiatedSerializer is used to obtain encoders and decoders // for resources not registered in the scheme UnstructuredNegotiatedSerializer runtime.NegotiatedSerializer // ClientNegotiators includes all of ClientNegotiators by GroupVersionResource ClientNegotiators map[schema.GroupVersionResource]*yurtClientNegotiator // WatchEventClientNegotiator is a ClientNegotiators for WatchEvent WatchEventClientNegotiator runtime.ClientNegotiator }
SerializerManager is responsible for managing *rest.Serializers
func NewSerializerManager ¶
func NewSerializerManager() *SerializerManager
NewSerializerManager creates a *SerializerManager object with no version conversion
func (*SerializerManager) CreateSerializer ¶
func (sm *SerializerManager) CreateSerializer(contentType, group, version, resource string) *Serializer
CreateSerializer will returns a Serializer object for encoding or decoding runtime object.
func (*SerializerManager) GetNegotiatedSerializer ¶
func (sm *SerializerManager) GetNegotiatedSerializer(gvr schema.GroupVersionResource) runtime.NegotiatedSerializer
GetNegotiatedSerializer returns an NegotiatedSerializer object based on GroupVersionResource
type UnstructuredNegotiatedSerializer ¶
type UnstructuredNegotiatedSerializer struct {
// contains filtered or unexported fields
}
func (UnstructuredNegotiatedSerializer) DecoderToVersion ¶
func (s UnstructuredNegotiatedSerializer) DecoderToVersion(decoder runtime.Decoder, _ runtime.GroupVersioner) runtime.Decoder
DecoderToVersion do nothing, and returns a decoder that does not do conversion
func (UnstructuredNegotiatedSerializer) EncoderForVersion ¶
func (s UnstructuredNegotiatedSerializer) EncoderForVersion(encoder runtime.Encoder, _ runtime.GroupVersioner) runtime.Encoder
EncoderForVersion do nothing, but returns a encoder, if the object is unstructured, the encoder will encode object without conversion
func (UnstructuredNegotiatedSerializer) SupportedMediaTypes ¶
func (s UnstructuredNegotiatedSerializer) SupportedMediaTypes() []runtime.SerializerInfo
type WithVersionCodecFactory ¶
type WithVersionCodecFactory struct {
serializer.CodecFactory
}
WithVersionCodecFactory is a CodecFactory that will explicitly ignore requests to perform conversion. It keeps the gvk during deserialization. This wrapper is used while code migrates away from using conversion (such as external clients)
func (WithVersionCodecFactory) DecoderToVersion ¶
func (f WithVersionCodecFactory) DecoderToVersion(serializer runtime.Decoder, _ runtime.GroupVersioner) runtime.Decoder
DecoderToVersion returns an decoder that does not do conversion, and keeps the gvk information
func (WithVersionCodecFactory) EncoderForVersion ¶
func (f WithVersionCodecFactory) EncoderForVersion(serializer runtime.Encoder, version runtime.GroupVersioner) runtime.Encoder
EncoderForVersion returns an encoder that does not do conversion, but does set the group version kind of the object when serialized.
type WithVersionDecoder ¶
WithVersionDecoder keeps the group version kind of a deserialized object.
func (WithVersionDecoder) Decode ¶
func (d WithVersionDecoder) Decode(data []byte, defaults *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error)
Decode does not do conversion. It keeps the gvk during deserialization.