blob: 0e212ec941fff181e4126287bc9a579fcfc13777 [file] [log] [blame]
Matteo Scandoloa4285862020-12-01 18:10:10 -08001/*
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.
28//
29// 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.
32//
33// // 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// }
41//
42// // 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// }
50//
51// // 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// }
60//
61// 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.)
68//
69// +k8s:deepcopy-gen=true
70// +protobuf=true
71// +k8s:openapi-gen=true
72message RawExtension {
73 // Raw is the underlying serialization of this object.
74 //
75 // 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
86//
87// TypeMeta is provided here for convenience. You may use it directly from this package or define
88// your own with the same fields.
89//
90// +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.
106//
107// +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