runtime

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: Apache-2.0 Imports: 5 Imported by: 558

Documentation

Overview

Package runtime is a generated protocol buffer package.

It is generated from these files:

k8s.io/apimachinery/pkg/runtime/generated.proto

It has these top-level messages:

RawExtension
TypeMeta
Unknown

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenerated   = fmt.Errorf("proto: integer overflow")
)

Functions

This section is empty.

Types

type RawExtension

type RawExtension struct {
	// Raw is the underlying serialization of this object.
	//
	// TODO: Determine how to detect ContentType and ContentEncoding of 'Raw' data.
	Raw              []byte `protobuf:"bytes,1,opt,name=raw" json:"raw,omitempty"`
	XXX_unrecognized []byte `json:"-"`
}

RawExtension is used to hold extensions in external versions.

To use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.

// Internal package:

type MyAPIObject struct {
	runtime.TypeMeta `json:",inline"`
	MyPlugin runtime.Object `json:"myPlugin"`
}
type PluginA struct {
	AOption string `json:"aOption"`
}

// External package:

type MyAPIObject struct {
	runtime.TypeMeta `json:",inline"`
	MyPlugin runtime.RawExtension `json:"myPlugin"`
}
type PluginA struct {
	AOption string `json:"aOption"`
}

// On the wire, the JSON will look something like this:

{
	"kind":"MyAPIObject",
	"apiVersion":"v1",
	"myPlugin": {
		"kind":"PluginA",
		"aOption":"foo",
	},
}

So what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)

+k8s:deepcopy-gen=true +protobuf=true +k8s:openapi-gen=true

func (*RawExtension) Descriptor

func (*RawExtension) Descriptor() ([]byte, []int)

func (*RawExtension) GetRaw

func (m *RawExtension) GetRaw() []byte

func (*RawExtension) Marshal

func (m *RawExtension) Marshal() (dAtA []byte, err error)

func (*RawExtension) MarshalTo

func (m *RawExtension) MarshalTo(dAtA []byte) (int, error)

func (*RawExtension) ProtoMessage

func (*RawExtension) ProtoMessage()

func (*RawExtension) Reset

func (m *RawExtension) Reset()

func (*RawExtension) Size

func (m *RawExtension) Size() (n int)

func (*RawExtension) String

func (m *RawExtension) String() string

func (*RawExtension) Unmarshal

func (m *RawExtension) Unmarshal(dAtA []byte) error

type TypeMeta

type TypeMeta struct {
	// +optional
	ApiVersion *string `protobuf:"bytes,1,opt,name=apiVersion" json:"apiVersion,omitempty"`
	// +optional
	Kind             *string `protobuf:"bytes,2,opt,name=kind" json:"kind,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

TypeMeta is shared by all top level objects. The proper way to use it is to inline it in your type, like this:

type MyAwesomeAPIObject struct {
     runtime.TypeMeta    `json:",inline"`
     ... // other fields
}

func (obj *MyAwesomeAPIObject) SetGroupVersionKind(gvk *metav1.GroupVersionKind) { metav1.UpdateTypeMeta(obj,gvk) }; GroupVersionKind() *GroupVersionKind

TypeMeta is provided here for convenience. You may use it directly from this package or define your own with the same fields.

+k8s:deepcopy-gen=false +protobuf=true +k8s:openapi-gen=true

func (*TypeMeta) Descriptor

func (*TypeMeta) Descriptor() ([]byte, []int)

func (*TypeMeta) GetApiVersion

func (m *TypeMeta) GetApiVersion() string

func (*TypeMeta) GetKind

func (m *TypeMeta) GetKind() string

func (*TypeMeta) Marshal

func (m *TypeMeta) Marshal() (dAtA []byte, err error)

func (*TypeMeta) MarshalTo

func (m *TypeMeta) MarshalTo(dAtA []byte) (int, error)

func (*TypeMeta) ProtoMessage

func (*TypeMeta) ProtoMessage()

func (*TypeMeta) Reset

func (m *TypeMeta) Reset()

func (*TypeMeta) Size

func (m *TypeMeta) Size() (n int)

func (*TypeMeta) String

func (m *TypeMeta) String() string

func (*TypeMeta) Unmarshal

func (m *TypeMeta) Unmarshal(dAtA []byte) error

type Unknown

type Unknown struct {
	TypeMeta *TypeMeta `protobuf:"bytes,1,opt,name=typeMeta" json:"typeMeta,omitempty"`
	// Raw will hold the complete serialized object which couldn't be matched
	// with a registered type. Most likely, nothing should be done with this
	// except for passing it through the system.
	Raw []byte `protobuf:"bytes,2,opt,name=raw" json:"raw,omitempty"`
	// ContentEncoding is encoding used to encode 'Raw' data.
	// Unspecified means no encoding.
	ContentEncoding *string `protobuf:"bytes,3,opt,name=contentEncoding" json:"contentEncoding,omitempty"`
	// ContentType  is serialization method used to serialize 'Raw'.
	// Unspecified means ContentTypeJSON.
	ContentType      *string `protobuf:"bytes,4,opt,name=contentType" json:"contentType,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

Unknown allows api objects with unknown types to be passed-through. This can be used to deal with the API objects from a plug-in. Unknown objects still have functioning TypeMeta features-- kind, version, etc. TODO: Make this object have easy access to field based accessors and settors for metadata and field mutatation.

+k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +protobuf=true +k8s:openapi-gen=true

func (*Unknown) Descriptor

func (*Unknown) Descriptor() ([]byte, []int)

func (*Unknown) GetContentEncoding

func (m *Unknown) GetContentEncoding() string

func (*Unknown) GetContentType

func (m *Unknown) GetContentType() string

func (*Unknown) GetRaw

func (m *Unknown) GetRaw() []byte

func (*Unknown) GetTypeMeta

func (m *Unknown) GetTypeMeta() *TypeMeta

func (*Unknown) Marshal

func (m *Unknown) Marshal() (dAtA []byte, err error)

func (*Unknown) MarshalTo

func (m *Unknown) MarshalTo(dAtA []byte) (int, error)

func (*Unknown) ProtoMessage

func (*Unknown) ProtoMessage()

func (*Unknown) Reset

func (m *Unknown) Reset()

func (*Unknown) Size

func (m *Unknown) Size() (n int)

func (*Unknown) String

func (m *Unknown) String() string

func (*Unknown) Unmarshal

func (m *Unknown) Unmarshal(dAtA []byte) error

Directories

Path Synopsis
Package schema is a generated protocol buffer package.
Package schema is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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