encoding

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 39 Imported by: 0

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 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) (*runtime.TypeMeta, 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 DetectAndConvert

func DetectAndConvert(outMediaType string, in []byte, out io.Writer) (*runtime.TypeMeta, error)

DetectAndConvert first detects the media type of the in param data and then converts it from the kv store encoded data to the given output format using kubernetes' api machinery to perform the conversion.

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