encoding

package
v0.0.0-...-6efeff1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2018 License: Apache-2.0 Imports: 41 Imported by: 2

Documentation

Index

Constants

View Source
const (
	StorageBinaryMediaType = "application/vnd.kubernetes.storagebinary"
	ProtobufMediaType      = "application/vnd.kubernetes.protobuf"
	YamlMediaType          = "application/yaml"
	JsonMediaType          = "application/json"

	ProtobufShortname = "proto"
	YamlShortname     = "yaml"
	JsonShortname     = "json"
)

Variables

View Source
var ProtoEncodingPrefix = []byte{0x6b, 0x38, 0x73, 0x00}

See k8s.io/apimachinery/pkg/runtime/serializer/protobuf.go

View Source
var Registry = registered.NewOrDie(os.Getenv("KUBE_API_VERSIONS"))
View Source
var Scheme = runtime.NewScheme()

Functions

func AddToScheme

func AddToScheme(scheme *runtime.Scheme)

AddToScheme adds all types of this clientset into the given scheme. This allows composition of clientsets, like in:

import (
  "k8s.io/client-go/kubernetes"
  clientsetscheme "k8s.io/client-go/kuberentes/scheme"
  aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
)

kclientset, _ := kubernetes.NewForConfig(c)
aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)

After this, RawExtensions in Kubernetes types will serialize kube-aggregator types correctly.

func Convert

func Convert(inMediaType, outMediaType string, in []byte, out io.Writer) error

Convert from kv store encoded data to the given output format using kubernetes' api machinery to perform the conversion.

func DecodeRaw

func DecodeRaw(in []byte, out io.Writer) error

DecodeRaw decodes the raw payload bytes contained within the 'Unknown' protobuf envelope of the given storage data.

func DecodeSummary

func DecodeSummary(inMediaType string, in []byte, out io.Writer) error

DecodeSummary decodes the TypeMeta, ContentEncoding and ContentType fields from the 'Unknown' protobuf envelope of the given storage data.

func DecodeUnknown

func DecodeUnknown(in []byte) (*runtime.Unknown, error)

DecodeUnknown decodes the Unknown protobuf type from the given storage data.

func DetectAndExtract

func DetectAndExtract(in []byte) (string, []byte, error)

DetectAndExtract searches the the start of either json of protobuf data, and, if found, returns the mime type and data.

func ToMediaType

func ToMediaType(out string) (string, error)

ToMediaType maps 'out' flag values to corresponding mime types.

Types

This section is empty.

Jump to

Keyboard shortcuts

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