2 Copyright 2017 The Kubernetes Authors.
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
17 // package v1beta1 is alpha objects from meta that will be introduced.
21 "k8s.io/apimachinery/pkg/apis/meta/v1"
22 "k8s.io/apimachinery/pkg/runtime"
25 // TODO: Table does not generate to protobuf because of the interface{} - fix protobuf
26 // generation to support a meta type that can accept any valid JSON.
28 // Table is a tabular representation of a set of API resources. The server transforms the
29 // object into a set of preferred columns for quickly reviewing the objects.
31 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
33 v1.TypeMeta `json:",inline"`
34 // Standard list metadata.
35 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
37 v1.ListMeta `json:"metadata,omitempty"`
39 // columnDefinitions describes each column in the returned items array. The number of cells per row
40 // will always match the number of column definitions.
41 ColumnDefinitions []TableColumnDefinition `json:"columnDefinitions"`
42 // rows is the list of items in the table.
43 Rows []TableRow `json:"rows"`
46 // TableColumnDefinition contains information about a column returned in the Table.
48 type TableColumnDefinition struct {
49 // name is a human readable name for the column.
50 Name string `json:"name"`
51 // type is an OpenAPI type definition for this column.
52 // See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
53 Type string `json:"type"`
54 // format is an optional OpenAPI type definition for this column. The 'name' format is applied
55 // to the primary identifier column to assist in clients identifying column is the resource name.
56 // See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
57 Format string `json:"format"`
58 // description is a human readable description of this column.
59 Description string `json:"description"`
60 // priority is an integer defining the relative importance of this column compared to others. Lower
61 // numbers are considered higher priority. Columns that may be omitted in limited space scenarios
62 // should be given a higher priority.
63 Priority int32 `json:"priority"`
66 // TableRow is an individual row in a table.
68 type TableRow struct {
69 // cells will be as wide as headers and may contain strings, numbers (float64 or int64), booleans, simple
70 // maps, or lists, or null. See the type field of the column definition for a more detailed description.
71 Cells []interface{} `json:"cells"`
72 // conditions describe additional status of a row that are relevant for a human user.
74 Conditions []TableRowCondition `json:"conditions,omitempty"`
75 // This field contains the requested additional information about each object based on the includeObject
76 // policy when requesting the Table. If "None", this field is empty, if "Object" this will be the
77 // default serialization of the object for the current API version, and if "Metadata" (the default) will
78 // contain the object metadata. Check the returned kind and apiVersion of the object before parsing.
80 Object runtime.RawExtension `json:"object,omitempty"`
83 // TableRowCondition allows a row to be marked with additional information.
85 type TableRowCondition struct {
86 // Type of row condition.
87 Type RowConditionType `json:"type"`
88 // Status of the condition, one of True, False, Unknown.
89 Status ConditionStatus `json:"status"`
90 // (brief) machine readable reason for the condition's last transition.
92 Reason string `json:"reason,omitempty"`
93 // Human readable message indicating details about last transition.
95 Message string `json:"message,omitempty"`
98 type RowConditionType string
100 // These are valid conditions of a row. This list is not exhaustive and new conditions may be
101 // included by other resources.
103 // RowCompleted means the underlying resource has reached completion and may be given less
104 // visual priority than other resources.
105 RowCompleted RowConditionType = "Completed"
108 type ConditionStatus string
110 // These are valid condition statuses. "ConditionTrue" means a resource is in the condition.
111 // "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes
112 // can't decide if a resource is in the condition or not. In the future, we could add other
113 // intermediate conditions, e.g. ConditionDegraded.
115 ConditionTrue ConditionStatus = "True"
116 ConditionFalse ConditionStatus = "False"
117 ConditionUnknown ConditionStatus = "Unknown"
120 // IncludeObjectPolicy controls which portion of the object is returned with a Table.
121 type IncludeObjectPolicy string
124 // IncludeNone returns no object.
125 IncludeNone IncludeObjectPolicy = "None"
126 // IncludeMetadata serializes the object containing only its metadata field.
127 IncludeMetadata IncludeObjectPolicy = "Metadata"
128 // IncludeObject contains the full object.
129 IncludeObject IncludeObjectPolicy = "Object"
132 // TableOptions are used when a Table is requested by the caller.
133 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
134 type TableOptions struct {
135 v1.TypeMeta `json:",inline"`
136 // includeObject decides whether to include each object along with its columnar information.
137 // Specifying "None" will return no object, specifying "Object" will return the full object contents, and
138 // specifying "Metadata" (the default) will return the object's metadata in the PartialObjectMetadata kind
139 // in version v1beta1 of the meta.k8s.io API group.
140 IncludeObject IncludeObjectPolicy `json:"includeObject,omitempty" protobuf:"bytes,1,opt,name=includeObject,casttype=IncludeObjectPolicy"`
143 // PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients
144 // to get access to a particular ObjectMeta schema without knowing the details of the version.
145 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
146 type PartialObjectMetadata struct {
147 v1.TypeMeta `json:",inline"`
148 // Standard object's metadata.
149 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
151 v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
154 // PartialObjectMetadataList contains a list of objects containing only their metadata
155 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
156 type PartialObjectMetadataList struct {
157 v1.TypeMeta `json:",inline"`
159 // items contains each of the included items.
160 Items []*PartialObjectMetadata `json:"items" protobuf:"bytes,1,rep,name=items"`