Rename JSONBase -> TypeMeta in preparation for v1beta3
Will make subsequent refactor much easier
This commit is contained in:
@@ -23,18 +23,18 @@ import (
|
||||
// Note that the types provided in this file are not versioned and are intended to be
|
||||
// safe to use from within all versions of every API object.
|
||||
|
||||
// JSONBase is shared by all top level objects. The proper way to use it is to inline it in your type,
|
||||
// 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.JSONBase `yaml:",inline" json:",inline"`
|
||||
// runtime.TypeMeta `yaml:",inline" json:",inline"`
|
||||
// ... // other fields
|
||||
// }
|
||||
// func (*MyAwesomeAPIObject) IsAnAPIObject() {}
|
||||
//
|
||||
// JSONBase is provided here for convenience. You may use it directly from this package or define
|
||||
// TypeMeta is provided here for convenience. You may use it directly from this package or define
|
||||
// your own with the same fields.
|
||||
//
|
||||
type JSONBase struct {
|
||||
type TypeMeta struct {
|
||||
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
|
||||
ID string `json:"id,omitempty" yaml:"id,omitempty"`
|
||||
CreationTimestamp util.Time `json:"creationTimestamp,omitempty" yaml:"creationTimestamp,omitempty"`
|
||||
@@ -43,7 +43,7 @@ type JSONBase struct {
|
||||
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
||||
}
|
||||
|
||||
// PluginBase is like JSONBase, but it's intended for plugin objects that won't ever be encoded
|
||||
// PluginBase is like TypeMeta, but it's intended for plugin objects that won't ever be encoded
|
||||
// except while embedded in other objects.
|
||||
type PluginBase struct {
|
||||
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
|
||||
@@ -71,7 +71,7 @@ type EmbeddedObject struct {
|
||||
//
|
||||
// // Internal package:
|
||||
// type MyAPIObject struct {
|
||||
// runtime.JSONBase `yaml:",inline" json:",inline"`
|
||||
// runtime.TypeMeta `yaml:",inline" json:",inline"`
|
||||
// MyPlugin runtime.EmbeddedObject `json:"myPlugin" yaml:"myPlugin"`
|
||||
// }
|
||||
// type PluginA struct {
|
||||
@@ -81,7 +81,7 @@ type EmbeddedObject struct {
|
||||
//
|
||||
// // External package:
|
||||
// type MyAPIObject struct {
|
||||
// runtime.JSONBase `yaml:",inline" json:",inline"`
|
||||
// runtime.TypeMeta `yaml:",inline" json:",inline"`
|
||||
// MyPlugin runtime.RawExtension `json:"myPlugin" yaml:"myPlugin"`
|
||||
// }
|
||||
// type PluginA struct {
|
||||
@@ -112,10 +112,10 @@ type RawExtension struct {
|
||||
|
||||
// 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
|
||||
// JSONBase features-- kind, version, resourceVersion, etc.
|
||||
// TypeMeta features-- kind, version, resourceVersion, etc.
|
||||
// TODO: Not implemented yet!
|
||||
type Unknown struct {
|
||||
JSONBase `yaml:",inline" json:",inline"`
|
||||
TypeMeta `yaml:",inline" json:",inline"`
|
||||
// RawJSON will hold the complete JSON of the 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.
|
||||
|
Reference in New Issue
Block a user