encoding

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 8 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

Functions

func Convert

func Convert(codecs serializer.CodecFactory, inMediaType, outMediaType string, in []byte) ([]byte, *runtime.TypeMeta, error)

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

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 DecodeTypeMeta

func DecodeTypeMeta(inMediaType string, in []byte) (*runtime.TypeMeta, error)

DecodeTypeMeta gets the TypeMeta from the given data, either as JSON or Protobuf.

func DecodeUnknown

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

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

func DetectAndConvert

func DetectAndConvert(codecs serializer.CodecFactory, outMediaType string, in []byte) ([]byte, *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