runtime

package
v0.9.2-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LegacyCodec

func LegacyCodec(versions ...schema.GroupVersion) runtime.Codec

LegacyCodec it's a codec which uses ugorji instead of jsoniter, mutator has some bugs when dealing with encoding/decoding of common types. We expect to Deprecate mutator in the future and use webhooks to mutate or deny/allow access to attributes

Types

type Serializer

type Serializer struct {
	// contains filtered or unexported fields
}

func NewSerializer

func NewSerializer(meta runtimejson.MetaFactory, creater runtime.ObjectCreater, typer runtime.ObjectTyper, pretty bool) *Serializer

NewSerializer creates a JSON serializer that handles encoding versioned objects into the proper JSON form. If typer is not nil, the object has the group, version, and kind fields set.

func NewYAMLSerializer

func NewYAMLSerializer(meta runtimejson.MetaFactory, creater runtime.ObjectCreater, typer runtime.ObjectTyper) *Serializer

NewYAMLSerializer creates a YAML serializer that handles encoding versioned objects into the proper YAML form. If typer is not nil, the object has the group, version, and kind fields set. This serializer supports only the subset of YAML that matches JSON, and will error if constructs are used that do not serialize to JSON.

func (*Serializer) Decode

func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error)

Decode attempts to convert the provided data into YAML or JSON, extract the stored schema kind, apply the provided default gvk, and then load that data into an object matching the desired schema kind or the provided into. If into is *runtime.Unknown, the raw data will be extracted and no decoding will be performed. If into is not registered with the typer, then the object will be straight decoded using normal JSON/YAML unmarshalling. If into is provided and the original data is not fully qualified with kind/version/group, the type of the into will be used to alter the returned gvk. On success or most errors, the method will return the calculated schema kind.

func (*Serializer) Encode

func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error

Encode serializes the provided object to the given writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL