blob: 0e212ec941fff181e4126287bc9a579fcfc13777 [file] [log] [blame]
Zack Williamse940c7a2019-08-21 14:25:39 -07001/*
2Copyright The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17
18// This file was autogenerated by go-to-protobuf. Do not edit it manually!
19
20syntax = 'proto2';
21
22package k8s.io.apimachinery.pkg.runtime;
23
24// Package-wide variables from generator "generated".
25option go_package = "runtime";
26
27// RawExtension is used to hold extensions in external versions.
David Bainbridge86971522019-09-26 22:09:39 +000028//
Zack Williamse940c7a2019-08-21 14:25:39 -070029// To use this, make a field which has RawExtension as its type in your external, versioned
30// struct, and Object in your internal struct. You also need to register your
31// various plugin types.
David Bainbridge86971522019-09-26 22:09:39 +000032//
Zack Williamse940c7a2019-08-21 14:25:39 -070033// // Internal package:
34// type MyAPIObject struct {
35// runtime.TypeMeta `json:",inline"`
36// MyPlugin runtime.Object `json:"myPlugin"`
37// }
38// type PluginA struct {
39// AOption string `json:"aOption"`
40// }
David Bainbridge86971522019-09-26 22:09:39 +000041//
Zack Williamse940c7a2019-08-21 14:25:39 -070042// // External package:
43// type MyAPIObject struct {
44// runtime.TypeMeta `json:",inline"`
45// MyPlugin runtime.RawExtension `json:"myPlugin"`
46// }
47// type PluginA struct {
48// AOption string `json:"aOption"`
49// }
David Bainbridge86971522019-09-26 22:09:39 +000050//
Zack Williamse940c7a2019-08-21 14:25:39 -070051// // On the wire, the JSON will look something like this:
52// {
53// "kind":"MyAPIObject",
54// "apiVersion":"v1",
55// "myPlugin": {
56// "kind":"PluginA",
57// "aOption":"foo",
58// },
59// }
David Bainbridge86971522019-09-26 22:09:39 +000060//
Zack Williamse940c7a2019-08-21 14:25:39 -070061// So what happens? Decode first uses json or yaml to unmarshal the serialized data into
62// your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked.
63// The next step is to copy (using pkg/conversion) into the internal struct. The runtime
64// package's DefaultScheme has conversion functions installed which will unpack the
65// JSON stored in RawExtension, turning it into the correct object type, and storing it
66// in the Object. (TODO: In the case where the object is of an unknown type, a
67// runtime.Unknown object will be created and stored.)
David Bainbridge86971522019-09-26 22:09:39 +000068//
Zack Williamse940c7a2019-08-21 14:25:39 -070069// +k8s:deepcopy-gen=true
70// +protobuf=true
71// +k8s:openapi-gen=true
72message RawExtension {
73 // Raw is the underlying serialization of this object.
David Bainbridge86971522019-09-26 22:09:39 +000074 //
Zack Williamse940c7a2019-08-21 14:25:39 -070075 // TODO: Determine how to detect ContentType and ContentEncoding of 'Raw' data.
76 optional bytes raw = 1;
77}
78
79// TypeMeta is shared by all top level objects. The proper way to use it is to inline it in your type,
80// like this:
81// type MyAwesomeAPIObject struct {
82// runtime.TypeMeta `json:",inline"`
83// ... // other fields
84// }
85// func (obj *MyAwesomeAPIObject) SetGroupVersionKind(gvk *metav1.GroupVersionKind) { metav1.UpdateTypeMeta(obj,gvk) }; GroupVersionKind() *GroupVersionKind
David Bainbridge86971522019-09-26 22:09:39 +000086//
Zack Williamse940c7a2019-08-21 14:25:39 -070087// TypeMeta is provided here for convenience. You may use it directly from this package or define
88// your own with the same fields.
David Bainbridge86971522019-09-26 22:09:39 +000089//
Zack Williamse940c7a2019-08-21 14:25:39 -070090// +k8s:deepcopy-gen=false
91// +protobuf=true
92// +k8s:openapi-gen=true
93message TypeMeta {
94 // +optional
95 optional string apiVersion = 1;
96
97 // +optional
98 optional string kind = 2;
99}
100
101// Unknown allows api objects with unknown types to be passed-through. This can be used
102// to deal with the API objects from a plug-in. Unknown objects still have functioning
103// TypeMeta features-- kind, version, etc.
104// TODO: Make this object have easy access to field based accessors and settors for
105// metadata and field mutatation.
David Bainbridge86971522019-09-26 22:09:39 +0000106//
Zack Williamse940c7a2019-08-21 14:25:39 -0700107// +k8s:deepcopy-gen=true
108// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
109// +protobuf=true
110// +k8s:openapi-gen=true
111message Unknown {
112 optional TypeMeta typeMeta = 1;
113
114 // Raw will hold the complete serialized object which couldn't be matched
115 // with a registered type. Most likely, nothing should be done with this
116 // except for passing it through the system.
117 optional bytes raw = 2;
118
119 // ContentEncoding is encoding used to encode 'Raw' data.
120 // Unspecified means no encoding.
121 optional string contentEncoding = 3;
122
123 // ContentType is serialization method used to serialize 'Raw'.
124 // Unspecified means ContentTypeJSON.
125 optional string contentType = 4;
126}
127