mirror of https://github.com/k3s-io/k3s
Add priority and condition to column definitions
Allow the server to indicate additional information along with each row and table.pull/6/head
parent
d6cc1de9cd
commit
3f41f8fcd1
|
@ -334,6 +334,12 @@ kube::util::group-version-to-pkg-path() {
|
|||
meta/v1)
|
||||
echo "../vendor/k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
;;
|
||||
meta/v1alpha1)
|
||||
echo "vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
|
||||
;;
|
||||
meta/v1alpha1)
|
||||
echo "../vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
|
||||
;;
|
||||
unversioned)
|
||||
echo "pkg/api/unversioned"
|
||||
;;
|
||||
|
|
|
@ -28,7 +28,7 @@ source "${KUBE_ROOT}/hack/lib/swagger.sh"
|
|||
|
||||
kube::golang::setup_env
|
||||
|
||||
GROUP_VERSIONS=(meta/v1 ${KUBE_AVAILABLE_GROUP_VERSIONS})
|
||||
GROUP_VERSIONS=(meta/v1 meta/v1alpha1 ${KUBE_AVAILABLE_GROUP_VERSIONS})
|
||||
|
||||
# To avoid compile errors, remove the currently existing files.
|
||||
for group_version in "${GROUP_VERSIONS[@]}"; do
|
||||
|
|
|
@ -72,9 +72,15 @@ func addToGroupVersion(scheme *runtime.Scheme, groupVersion schema.GroupVersion)
|
|||
)
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&metav1alpha1.Table{},
|
||||
&metav1alpha1.TableOptions{},
|
||||
&metav1alpha1.PartialObjectMetadata{},
|
||||
&metav1alpha1.PartialObjectMetadataList{},
|
||||
)
|
||||
scheme.AddKnownTypes(metav1alpha1.SchemeGroupVersion,
|
||||
&metav1alpha1.Table{},
|
||||
&metav1alpha1.TableOptions{},
|
||||
&metav1alpha1.PartialObjectMetadata{},
|
||||
&metav1alpha1.PartialObjectMetadataList{},
|
||||
)
|
||||
// Allow delete options to be decoded across all version in this scheme (we may want to be more clever than this)
|
||||
scheme.AddUnversionedTypes(SchemeGroupVersion, &metav1.DeleteOptions{})
|
||||
|
|
|
@ -14,6 +14,7 @@ go_library(
|
|||
"generated.pb.go",
|
||||
"register.go",
|
||||
"types.go",
|
||||
"types_swagger_doc_generated.go",
|
||||
"zz_generated.deepcopy.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
|
|
|
@ -26,6 +26,7 @@ limitations under the License.
|
|||
|
||||
It has these top-level messages:
|
||||
PartialObjectMetadata
|
||||
PartialObjectMetadataList
|
||||
TableOptions
|
||||
*/
|
||||
package v1alpha1
|
||||
|
@ -54,12 +55,19 @@ func (m *PartialObjectMetadata) Reset() { *m = PartialObjectM
|
|||
func (*PartialObjectMetadata) ProtoMessage() {}
|
||||
func (*PartialObjectMetadata) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
|
||||
func (m *PartialObjectMetadataList) Reset() { *m = PartialObjectMetadataList{} }
|
||||
func (*PartialObjectMetadataList) ProtoMessage() {}
|
||||
func (*PartialObjectMetadataList) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptorGenerated, []int{1}
|
||||
}
|
||||
|
||||
func (m *TableOptions) Reset() { *m = TableOptions{} }
|
||||
func (*TableOptions) ProtoMessage() {}
|
||||
func (*TableOptions) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
|
||||
func (*TableOptions) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*PartialObjectMetadata)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1alpha1.PartialObjectMetadata")
|
||||
proto.RegisterType((*PartialObjectMetadataList)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1alpha1.PartialObjectMetadataList")
|
||||
proto.RegisterType((*TableOptions)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1alpha1.TableOptions")
|
||||
}
|
||||
func (m *PartialObjectMetadata) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -88,6 +96,36 @@ func (m *PartialObjectMetadata) MarshalTo(dAtA []byte) (int, error) {
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *PartialObjectMetadataList) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *PartialObjectMetadataList) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Items) > 0 {
|
||||
for _, msg := range m.Items {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(msg.Size()))
|
||||
n, err := msg.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n
|
||||
}
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *TableOptions) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
|
@ -145,6 +183,18 @@ func (m *PartialObjectMetadata) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *PartialObjectMetadataList) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Items) > 0 {
|
||||
for _, e := range m.Items {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *TableOptions) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
|
@ -176,6 +226,16 @@ func (this *PartialObjectMetadata) String() string {
|
|||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *PartialObjectMetadataList) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&PartialObjectMetadataList{`,
|
||||
`Items:` + strings.Replace(fmt.Sprintf("%v", this.Items), "PartialObjectMetadata", "PartialObjectMetadata", 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *TableOptions) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
|
@ -274,6 +334,87 @@ func (m *PartialObjectMetadata) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *PartialObjectMetadataList) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: PartialObjectMetadataList: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: PartialObjectMetadataList: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Items = append(m.Items, &PartialObjectMetadata{})
|
||||
if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *TableOptions) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
@ -463,27 +604,30 @@ func init() {
|
|||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 344 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x3f, 0x4f, 0xf3, 0x30,
|
||||
0x10, 0x87, 0x93, 0xad, 0x6f, 0x5e, 0xba, 0x04, 0x21, 0xa1, 0x0e, 0x2e, 0xea, 0x84, 0x2a, 0xb0,
|
||||
0x29, 0x20, 0xc4, 0xdc, 0x8d, 0x01, 0xb5, 0x2a, 0x4c, 0x4c, 0x38, 0xc9, 0x91, 0x98, 0x24, 0x76,
|
||||
0x64, 0x5f, 0x2a, 0x75, 0xe3, 0x23, 0xf0, 0xb1, 0x3a, 0x76, 0x64, 0xaa, 0x68, 0xf8, 0x16, 0x4c,
|
||||
0xa8, 0x69, 0x4b, 0xff, 0xa9, 0xa2, 0xdb, 0xdd, 0xef, 0xf2, 0x3c, 0x39, 0x5b, 0x76, 0x1e, 0xe2,
|
||||
0x5b, 0x43, 0x85, 0x62, 0x71, 0xee, 0x81, 0x96, 0x80, 0x60, 0x58, 0x1f, 0x64, 0xa0, 0x34, 0x9b,
|
||||
0x0f, 0x78, 0x26, 0x52, 0xee, 0x47, 0x42, 0x82, 0x1e, 0xb0, 0x2c, 0x0e, 0xa7, 0x81, 0x61, 0x29,
|
||||
0x20, 0x67, 0xfd, 0x16, 0x4f, 0xb2, 0x88, 0xb7, 0x58, 0x08, 0x12, 0x34, 0x47, 0x08, 0x68, 0xa6,
|
||||
0x15, 0x2a, 0xb7, 0x39, 0x63, 0xe9, 0x2a, 0x4b, 0xb3, 0x38, 0x9c, 0x06, 0x86, 0x4e, 0x59, 0xba,
|
||||
0x60, 0x6b, 0xe7, 0xa1, 0xc0, 0x28, 0xf7, 0xa8, 0xaf, 0x52, 0x16, 0xaa, 0x50, 0xb1, 0x52, 0xe1,
|
||||
0xe5, 0x2f, 0x65, 0x57, 0x36, 0x65, 0x35, 0x53, 0xd7, 0xae, 0xf7, 0x59, 0x6b, 0x73, 0xa1, 0xda,
|
||||
0xce, 0xc3, 0xe8, 0x5c, 0xa2, 0x48, 0x61, 0x0b, 0xb8, 0xf9, 0x0b, 0x30, 0x7e, 0x04, 0x29, 0xdf,
|
||||
0xe2, 0xae, 0x76, 0x71, 0x39, 0x8a, 0x84, 0x09, 0x89, 0x06, 0xf5, 0x26, 0xd4, 0x18, 0x38, 0x47,
|
||||
0x5d, 0xae, 0x51, 0xf0, 0xa4, 0xe3, 0xbd, 0x82, 0x8f, 0xf7, 0x80, 0x3c, 0xe0, 0xc8, 0xdd, 0x67,
|
||||
0xa7, 0x92, 0xce, 0xeb, 0x63, 0xfb, 0xc4, 0x3e, 0xfd, 0x7f, 0x79, 0x41, 0xf7, 0xb9, 0x5a, 0xba,
|
||||
0xf4, 0xb4, 0xdd, 0xe1, 0xb8, 0x6e, 0x15, 0xe3, 0xba, 0xb3, 0xcc, 0x7a, 0xbf, 0xd6, 0x86, 0xe7,
|
||||
0x1c, 0x3c, 0x72, 0x2f, 0x81, 0x4e, 0x86, 0x42, 0x49, 0xe3, 0xf6, 0x9c, 0xaa, 0x90, 0x7e, 0x92,
|
||||
0x07, 0x30, 0xfb, 0xbc, 0xfc, 0xed, 0xbf, 0xf6, 0xd9, 0x5c, 0x52, 0xbd, 0x5b, 0x1d, 0x7e, 0x8f,
|
||||
0xeb, 0x87, 0x6b, 0x41, 0x57, 0x25, 0xc2, 0x1f, 0xf4, 0xd6, 0x15, 0xed, 0xe6, 0x70, 0x42, 0xac,
|
||||
0xd1, 0x84, 0x58, 0x1f, 0x13, 0x62, 0xbd, 0x15, 0xc4, 0x1e, 0x16, 0xc4, 0x1e, 0x15, 0xc4, 0xfe,
|
||||
0x2c, 0x88, 0xfd, 0xfe, 0x45, 0xac, 0xa7, 0xca, 0xe2, 0x35, 0xfc, 0x04, 0x00, 0x00, 0xff, 0xff,
|
||||
0x20, 0xf7, 0xa9, 0xe2, 0x8f, 0x02, 0x00, 0x00,
|
||||
// 388 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xbf, 0x6e, 0xd4, 0x40,
|
||||
0x10, 0x87, 0x6d, 0xa1, 0x48, 0xc9, 0x86, 0x34, 0x46, 0x48, 0xe1, 0x8a, 0x75, 0x74, 0x55, 0x14,
|
||||
0xc1, 0x2e, 0x09, 0x08, 0xd1, 0xe2, 0x2e, 0x12, 0x28, 0x91, 0xa1, 0xa2, 0x62, 0x6d, 0x0f, 0xf6,
|
||||
0x62, 0x7b, 0xd7, 0xda, 0x1d, 0x47, 0xba, 0x0a, 0x1e, 0x81, 0xc7, 0xba, 0x32, 0x25, 0x95, 0xc5,
|
||||
0x99, 0xb7, 0xa0, 0x42, 0xb6, 0x2f, 0xe4, 0xfe, 0x2a, 0xd7, 0xcd, 0xfc, 0x46, 0xdf, 0xe7, 0x19,
|
||||
0x2f, 0xf9, 0x98, 0xbf, 0xb5, 0x4c, 0x6a, 0x9e, 0xd7, 0x11, 0x18, 0x05, 0x08, 0x96, 0xdf, 0x80,
|
||||
0x4a, 0xb4, 0xe1, 0xf3, 0x81, 0xa8, 0x64, 0x29, 0xe2, 0x4c, 0x2a, 0x30, 0x13, 0x5e, 0xe5, 0x69,
|
||||
0x17, 0x58, 0x5e, 0x02, 0x0a, 0x7e, 0x73, 0x2e, 0x8a, 0x2a, 0x13, 0xe7, 0x3c, 0x05, 0x05, 0x46,
|
||||
0x20, 0x24, 0xac, 0x32, 0x1a, 0xb5, 0x77, 0x36, 0xb0, 0x6c, 0x91, 0x65, 0x55, 0x9e, 0x76, 0x81,
|
||||
0x65, 0x1d, 0xcb, 0xee, 0xd8, 0xd1, 0x8b, 0x54, 0x62, 0x56, 0x47, 0x2c, 0xd6, 0x25, 0x4f, 0x75,
|
||||
0xaa, 0x79, 0xaf, 0x88, 0xea, 0xaf, 0x7d, 0xd7, 0x37, 0x7d, 0x35, 0xa8, 0x47, 0xaf, 0x77, 0x59,
|
||||
0x6b, 0x75, 0xa1, 0xd1, 0xd6, 0x63, 0x4c, 0xad, 0x50, 0x96, 0xb0, 0x06, 0xbc, 0x79, 0x08, 0xb0,
|
||||
0x71, 0x06, 0xa5, 0x58, 0xe3, 0x5e, 0x6d, 0xe3, 0x6a, 0x94, 0x05, 0x97, 0x0a, 0x2d, 0x9a, 0x55,
|
||||
0x68, 0x3c, 0x21, 0x4f, 0xaf, 0x85, 0x41, 0x29, 0x8a, 0xab, 0xe8, 0x1b, 0xc4, 0xf8, 0x01, 0x50,
|
||||
0x24, 0x02, 0x85, 0xf7, 0x85, 0xec, 0x97, 0xf3, 0xfa, 0xd8, 0x3d, 0x71, 0x4f, 0x0f, 0x2f, 0x5e,
|
||||
0xb2, 0x5d, 0x7e, 0x2d, 0xbb, 0xf7, 0x04, 0xde, 0xb4, 0xf1, 0x9d, 0xb6, 0xf1, 0xc9, 0x7d, 0x16,
|
||||
0xfe, 0xb7, 0x8e, 0xbf, 0x93, 0x67, 0x1b, 0x3f, 0xfd, 0x5e, 0x5a, 0xf4, 0x22, 0xb2, 0x27, 0x11,
|
||||
0x4a, 0x7b, 0xec, 0x9e, 0x3c, 0x3a, 0x3d, 0xbc, 0x78, 0xc7, 0x76, 0x7f, 0x56, 0xb6, 0xd1, 0x1a,
|
||||
0x1c, 0xb4, 0x8d, 0xbf, 0x77, 0xd9, 0x39, 0xc3, 0x41, 0x3d, 0x8e, 0xc8, 0xe3, 0x4f, 0x22, 0x2a,
|
||||
0xe0, 0xaa, 0x42, 0xa9, 0x95, 0xf5, 0x42, 0x72, 0x24, 0x55, 0x5c, 0xd4, 0x09, 0x0c, 0x68, 0x7f,
|
||||
0xf7, 0x41, 0xf0, 0x7c, 0x7e, 0xc5, 0xd1, 0xe5, 0xe2, 0xf0, 0x6f, 0xe3, 0x3f, 0x59, 0x0a, 0xae,
|
||||
0x75, 0x21, 0xe3, 0x49, 0xb8, 0xac, 0x08, 0xce, 0xa6, 0x33, 0xea, 0xdc, 0xce, 0xa8, 0xf3, 0x6b,
|
||||
0x46, 0x9d, 0x1f, 0x2d, 0x75, 0xa7, 0x2d, 0x75, 0x6f, 0x5b, 0xea, 0xfe, 0x6e, 0xa9, 0xfb, 0xf3,
|
||||
0x0f, 0x75, 0x3e, 0xef, 0xdf, 0xed, 0xfd, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x08, 0x1a, 0xd9, 0x53,
|
||||
0x10, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
@ -38,6 +38,12 @@ message PartialObjectMetadata {
|
|||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
}
|
||||
|
||||
// PartialObjectMetadataList contains a list of objects containing only their metadata
|
||||
message PartialObjectMetadataList {
|
||||
// items contains each of the included items.
|
||||
repeated PartialObjectMetadata items = 1;
|
||||
}
|
||||
|
||||
// TableOptions are used when a Table is requested by the caller.
|
||||
message TableOptions {
|
||||
// includeObject decides whether to include each object along with its columnar information.
|
||||
|
|
|
@ -43,6 +43,7 @@ func init() {
|
|||
&Table{},
|
||||
&TableOptions{},
|
||||
&PartialObjectMetadata{},
|
||||
&PartialObjectMetadataList{},
|
||||
)
|
||||
|
||||
// register manually. This usually goes through the SchemeBuilder, which we cannot use here.
|
||||
|
|
|
@ -22,6 +22,9 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// TODO: Table does not generate to protobuf because of the interface{} - fix protobuf
|
||||
// generation to support a meta type that can accept any valid JSON.
|
||||
|
||||
// Table is a tabular representation of a set of API resources. The server transforms the
|
||||
// object into a set of preferred columns for quickly reviewing the objects.
|
||||
// +protobuf=false
|
||||
|
@ -30,28 +33,33 @@ type Table struct {
|
|||
// Standard list metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
v1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
v1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
// columnDefinitions describes each column in the returned items array. The number of cells per row
|
||||
// will always match the number of column definitions.
|
||||
ColumnDefinitions []TableColumnDefinitions `json:"columnDefinitions"`
|
||||
ColumnDefinitions []TableColumnDefinition `json:"columnDefinitions"`
|
||||
// rows is the list of items in the table.
|
||||
Rows []TableRow `json:"rows"`
|
||||
}
|
||||
|
||||
// TableColumnDefinitions contains information about a column returned in the Table.
|
||||
// TableColumnDefinition contains information about a column returned in the Table.
|
||||
// +protobuf=false
|
||||
type TableColumnDefinitions struct {
|
||||
type TableColumnDefinition struct {
|
||||
// name is a human readable name for the column.
|
||||
Name string `json:"name"`
|
||||
// type is an OpenAPI type definition for this column.
|
||||
// See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
|
||||
Type string `json:"type"`
|
||||
// format is an optional OpenAPI type definition for this column.
|
||||
// format is an optional OpenAPI type definition for this column. The 'name' format is applied
|
||||
// to the primary identifier column to assist in clients identifying column is the resource name.
|
||||
// See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
|
||||
Format string `json:"format"`
|
||||
// description is a human readable description of this column.
|
||||
Description string `json:"description"`
|
||||
// priority is an integer defining the relative importance of this column compared to others. Lower
|
||||
// numbers are considered higher priority. Columns that may be omitted in limited space scenarios
|
||||
// should be given a higher priority.
|
||||
Priority int32 `json:"priority"`
|
||||
}
|
||||
|
||||
// TableRow is an individual row in a table.
|
||||
|
@ -60,13 +68,54 @@ type TableRow struct {
|
|||
// cells will be as wide as headers and may contain strings, numbers, booleans, simple maps, or lists, or
|
||||
// null. See the type field of the column definition for a more detailed description.
|
||||
Cells []interface{} `json:"cells"`
|
||||
// conditions describe additional status of a row that are relevant for a human user.
|
||||
// +optional
|
||||
Conditions []TableRowCondition `json:"conditions,omitempty"`
|
||||
// This field contains the requested additional information about each object based on the includeObject
|
||||
// policy when requesting the Table. If "None", this field is empty, if "Object" this will be the
|
||||
// default serialization of the object for the current API version, and if "Metadata" (the default) will
|
||||
// contain the object metadata. Check the returned kind and apiVersion of the object before parsing.
|
||||
Object runtime.RawExtension `json:"object"`
|
||||
// +optional
|
||||
Object runtime.RawExtension `json:"object,omitempty"`
|
||||
}
|
||||
|
||||
// TableRowCondition allows a row to be marked with additional information.
|
||||
// +protobuf=false
|
||||
type TableRowCondition struct {
|
||||
// Type of row condition.
|
||||
Type RowConditionType `json:"type"`
|
||||
// Status of the condition, one of True, False, Unknown.
|
||||
Status ConditionStatus `json:"status"`
|
||||
// (brief) machine readable reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason,omitempty"`
|
||||
// Human readable message indicating details about last transition.
|
||||
// +optional
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
type RowConditionType string
|
||||
|
||||
// These are valid conditions of a row. This list is not exhaustive and new conditions may be
|
||||
// inculded by other resources.
|
||||
const (
|
||||
// RowCompleted means the underlying resource has reached completion and may be given less
|
||||
// visual priority than other resources.
|
||||
RowCompleted RowConditionType = "Completed"
|
||||
)
|
||||
|
||||
type ConditionStatus string
|
||||
|
||||
// These are valid condition statuses. "ConditionTrue" means a resource is in the condition.
|
||||
// "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes
|
||||
// can't decide if a resource is in the condition or not. In the future, we could add other
|
||||
// intermediate conditions, e.g. ConditionDegraded.
|
||||
const (
|
||||
ConditionTrue ConditionStatus = "True"
|
||||
ConditionFalse ConditionStatus = "False"
|
||||
ConditionUnknown ConditionStatus = "Unknown"
|
||||
)
|
||||
|
||||
// IncludeObjectPolicy controls which portion of the object is returned with a Table.
|
||||
type IncludeObjectPolicy string
|
||||
|
||||
|
@ -86,7 +135,7 @@ type TableOptions struct {
|
|||
// Specifying "None" will return no object, specifying "Object" will return the full object contents, and
|
||||
// specifying "Metadata" (the default) will return the object's metadata in the PartialObjectMetadata kind
|
||||
// in version v1alpha1 of the meta.k8s.io API group.
|
||||
IncludeObject IncludeObjectPolicy `json:"includeObject,omitempty" protobuf:"bytes,1,opt,name=includeObject"`
|
||||
IncludeObject IncludeObjectPolicy `json:"includeObject,omitempty" protobuf:"bytes,1,opt,name=includeObject,casttype=IncludeObjectPolicy"`
|
||||
}
|
||||
|
||||
// PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients
|
||||
|
@ -98,3 +147,11 @@ type PartialObjectMetadata struct {
|
|||
// +optional
|
||||
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
}
|
||||
|
||||
// PartialObjectMetadataList contains a list of objects containing only their metadata
|
||||
type PartialObjectMetadataList struct {
|
||||
v1.TypeMeta `json:",inline"`
|
||||
|
||||
// items contains each of the included items.
|
||||
Items []*PartialObjectMetadata `json:"items" protobuf:"bytes,1,rep,name=items"`
|
||||
}
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
// This file contains a collection of methods that can be used from go-restful to
|
||||
// generate Swagger API documentation for its models. Please read this PR for more
|
||||
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
|
||||
//
|
||||
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
|
||||
// they are on one line! For multiple line or blocks that you want to ignore use ---.
|
||||
// Any context after a --- is ignored.
|
||||
//
|
||||
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS START HERE
|
||||
var map_PartialObjectMetadata = map[string]string{
|
||||
"": "PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients to get access to a particular ObjectMeta schema without knowing the details of the version.",
|
||||
"metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
|
||||
}
|
||||
|
||||
func (PartialObjectMetadata) SwaggerDoc() map[string]string {
|
||||
return map_PartialObjectMetadata
|
||||
}
|
||||
|
||||
var map_PartialObjectMetadataList = map[string]string{
|
||||
"": "PartialObjectMetadataList contains a list of objects containing only their metadata",
|
||||
"items": "items contains each of the included items.",
|
||||
}
|
||||
|
||||
func (PartialObjectMetadataList) SwaggerDoc() map[string]string {
|
||||
return map_PartialObjectMetadataList
|
||||
}
|
||||
|
||||
var map_Table = map[string]string{
|
||||
"": "Table is a tabular representation of a set of API resources. The server transforms the object into a set of preferred columns for quickly reviewing the objects.",
|
||||
"metadata": "Standard list metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
|
||||
"columnDefinitions": "columnDefinitions describes each column in the returned items array. The number of cells per row will always match the number of column definitions.",
|
||||
"rows": "rows is the list of items in the table.",
|
||||
}
|
||||
|
||||
func (Table) SwaggerDoc() map[string]string {
|
||||
return map_Table
|
||||
}
|
||||
|
||||
var map_TableColumnDefinition = map[string]string{
|
||||
"": "TableColumnDefinition contains information about a column returned in the Table.",
|
||||
"name": "name is a human readable name for the column.",
|
||||
"type": "type is an OpenAPI type definition for this column. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.",
|
||||
"format": "format is an optional OpenAPI type definition for this column. The 'name' format is applied to the primary identifier column to assist in clients identifying column is the resource name. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.",
|
||||
"description": "description is a human readable description of this column.",
|
||||
"priority": "priority is an integer defining the relative importance of this column compared to others. Lower numbers are considered higher priority. Columns that may be omitted in limited space scenarios should be given a higher priority.",
|
||||
}
|
||||
|
||||
func (TableColumnDefinition) SwaggerDoc() map[string]string {
|
||||
return map_TableColumnDefinition
|
||||
}
|
||||
|
||||
var map_TableOptions = map[string]string{
|
||||
"": "TableOptions are used when a Table is requested by the caller.",
|
||||
"includeObject": "includeObject decides whether to include each object along with its columnar information. Specifying \"None\" will return no object, specifying \"Object\" will return the full object contents, and specifying \"Metadata\" (the default) will return the object's metadata in the PartialObjectMetadata kind in version v1alpha1 of the meta.k8s.io API group.",
|
||||
}
|
||||
|
||||
func (TableOptions) SwaggerDoc() map[string]string {
|
||||
return map_TableOptions
|
||||
}
|
||||
|
||||
var map_TableRow = map[string]string{
|
||||
"": "TableRow is an individual row in a table.",
|
||||
"cells": "cells will be as wide as headers and may contain strings, numbers, booleans, simple maps, or lists, or null. See the type field of the column definition for a more detailed description.",
|
||||
"conditions": "conditions describe additional status of a row that are relevant for a human user.",
|
||||
"object": "This field contains the requested additional information about each object based on the includeObject policy when requesting the Table. If \"None\", this field is empty, if \"Object\" this will be the default serialization of the object for the current API version, and if \"Metadata\" (the default) will contain the object metadata. Check the returned kind and apiVersion of the object before parsing.",
|
||||
}
|
||||
|
||||
func (TableRow) SwaggerDoc() map[string]string {
|
||||
return map_TableRow
|
||||
}
|
||||
|
||||
var map_TableRowCondition = map[string]string{
|
||||
"": "TableRowCondition allows a row to be marked with additional information.",
|
||||
"type": "Type of row condition.",
|
||||
"status": "Status of the condition, one of True, False, Unknown.",
|
||||
"reason": "(brief) machine readable reason for the condition's last transition.",
|
||||
"message": "Human readable message indicating details about last transition.",
|
||||
}
|
||||
|
||||
func (TableRowCondition) SwaggerDoc() map[string]string {
|
||||
return map_TableRowCondition
|
||||
}
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS END HERE
|
|
@ -31,10 +31,12 @@ import (
|
|||
func GetGeneratedDeepCopyFuncs() []conversion.GeneratedDeepCopyFunc {
|
||||
return []conversion.GeneratedDeepCopyFunc{
|
||||
{Fn: DeepCopy_v1alpha1_PartialObjectMetadata, InType: reflect.TypeOf(&PartialObjectMetadata{})},
|
||||
{Fn: DeepCopy_v1alpha1_PartialObjectMetadataList, InType: reflect.TypeOf(&PartialObjectMetadataList{})},
|
||||
{Fn: DeepCopy_v1alpha1_Table, InType: reflect.TypeOf(&Table{})},
|
||||
{Fn: DeepCopy_v1alpha1_TableColumnDefinitions, InType: reflect.TypeOf(&TableColumnDefinitions{})},
|
||||
{Fn: DeepCopy_v1alpha1_TableColumnDefinition, InType: reflect.TypeOf(&TableColumnDefinition{})},
|
||||
{Fn: DeepCopy_v1alpha1_TableOptions, InType: reflect.TypeOf(&TableOptions{})},
|
||||
{Fn: DeepCopy_v1alpha1_TableRow, InType: reflect.TypeOf(&TableRow{})},
|
||||
{Fn: DeepCopy_v1alpha1_TableRowCondition, InType: reflect.TypeOf(&TableRowCondition{})},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,6 +55,27 @@ func DeepCopy_v1alpha1_PartialObjectMetadata(in interface{}, out interface{}, c
|
|||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1alpha1_PartialObjectMetadataList is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1alpha1_PartialObjectMetadataList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PartialObjectMetadataList)
|
||||
out := out.(*PartialObjectMetadataList)
|
||||
*out = *in
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]*PartialObjectMetadata, len(*in))
|
||||
for i := range *in {
|
||||
if newVal, err := c.DeepCopy(&(*in)[i]); err != nil {
|
||||
return err
|
||||
} else {
|
||||
(*out)[i] = *newVal.(**PartialObjectMetadata)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1alpha1_Table is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1alpha1_Table(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
|
@ -61,7 +84,7 @@ func DeepCopy_v1alpha1_Table(in interface{}, out interface{}, c *conversion.Clon
|
|||
*out = *in
|
||||
if in.ColumnDefinitions != nil {
|
||||
in, out := &in.ColumnDefinitions, &out.ColumnDefinitions
|
||||
*out = make([]TableColumnDefinitions, len(*in))
|
||||
*out = make([]TableColumnDefinition, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Rows != nil {
|
||||
|
@ -79,11 +102,11 @@ func DeepCopy_v1alpha1_Table(in interface{}, out interface{}, c *conversion.Clon
|
|||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1alpha1_TableColumnDefinitions is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1alpha1_TableColumnDefinitions(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
// DeepCopy_v1alpha1_TableColumnDefinition is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1alpha1_TableColumnDefinition(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*TableColumnDefinitions)
|
||||
out := out.(*TableColumnDefinitions)
|
||||
in := in.(*TableColumnDefinition)
|
||||
out := out.(*TableColumnDefinition)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
|
@ -116,6 +139,11 @@ func DeepCopy_v1alpha1_TableRow(in interface{}, out interface{}, c *conversion.C
|
|||
}
|
||||
}
|
||||
}
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
*out = make([]TableRowCondition, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if newVal, err := c.DeepCopy(&in.Object); err != nil {
|
||||
return err
|
||||
} else {
|
||||
|
@ -124,3 +152,13 @@ func DeepCopy_v1alpha1_TableRow(in interface{}, out interface{}, c *conversion.C
|
|||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1alpha1_TableRowCondition is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1alpha1_TableRowCondition(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*TableRowCondition)
|
||||
out := out.(*TableRowCondition)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue