Add ListMeta to PartialObjectMetadataList

Unfortunately the proto id is now inconsistent with other "correct" objects,
but to change it will require a breaking serialization change. Worth considering.
This commit is contained in:
Clayton Coleman 2019-03-24 21:21:55 -04:00
parent 13cde9e181
commit efde94a0bc
4 changed files with 79 additions and 26 deletions

View File

@ -122,6 +122,14 @@ func (m *PartialObjectMetadataList) MarshalTo(dAtA []byte) (int, error) {
i += n i += n
} }
} }
dAtA[i] = 0x12
i++
i = encodeVarintGenerated(dAtA, i, uint64(m.ListMeta.Size()))
n2, err := m.ListMeta.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
return i, nil return i, nil
} }
@ -173,6 +181,8 @@ func (m *PartialObjectMetadataList) Size() (n int) {
n += 1 + l + sovGenerated(uint64(l)) n += 1 + l + sovGenerated(uint64(l))
} }
} }
l = m.ListMeta.Size()
n += 1 + l + sovGenerated(uint64(l))
return n return n
} }
@ -213,6 +223,7 @@ func (this *PartialObjectMetadataList) String() string {
} }
s := strings.Join([]string{`&PartialObjectMetadataList{`, s := strings.Join([]string{`&PartialObjectMetadataList{`,
`Items:` + strings.Replace(fmt.Sprintf("%v", this.Items), "PartialObjectMetadata", "PartialObjectMetadata", 1) + `,`, `Items:` + strings.Replace(fmt.Sprintf("%v", this.Items), "PartialObjectMetadata", "PartialObjectMetadata", 1) + `,`,
`ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ListMeta", 1), `&`, ``, 1) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
@ -375,6 +386,36 @@ func (m *PartialObjectMetadataList) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", 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
}
if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:]) skippy, err := skipGenerated(dAtA[iNdEx:])
@ -585,29 +626,31 @@ func init() {
} }
var fileDescriptorGenerated = []byte{ var fileDescriptorGenerated = []byte{
// 375 bytes of a gzipped FileDescriptorProto // 402 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xcd, 0x0a, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x4f, 0x8b, 0xd3, 0x40,
0x10, 0xc7, 0xb3, 0x48, 0xd1, 0x6e, 0xed, 0x25, 0x22, 0xd4, 0x1e, 0x36, 0xa5, 0xa7, 0x0a, 0x76, 0x18, 0xc6, 0x33, 0xca, 0xe2, 0xee, 0xac, 0x0b, 0x12, 0x11, 0xd6, 0x1e, 0x26, 0xcb, 0x9e, 0x2a,
0xd7, 0x16, 0x11, 0x8f, 0x92, 0x5b, 0x41, 0x69, 0x09, 0x9e, 0x3c, 0xb9, 0x49, 0xc6, 0x74, 0xcd, 0xd8, 0x19, 0x5b, 0x44, 0x3c, 0x4a, 0x6e, 0x05, 0xa5, 0x25, 0x78, 0x12, 0x0f, 0x4e, 0x92, 0xd7,
0xc7, 0x86, 0xec, 0xa6, 0xd0, 0x8b, 0xf8, 0x08, 0x3e, 0x56, 0x8f, 0x3d, 0xf6, 0x14, 0x6c, 0x7c, 0x74, 0xcc, 0x9f, 0x09, 0x99, 0x49, 0xa1, 0x37, 0x3f, 0x82, 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0xf1, 0xad, 0x24, 0x68, 0x57, 0x12, 0xb4, 0x2f, 0x09, 0x3a, 0x94, 0x04, 0xfd, 0x28, 0x6f, 0x11, 0x57, 0xd3, 0xee, 0xf2, 0x57, 0x61, 0x3d, 0x3e, 0x10, 0xe6, 0x32, 0x12, 0xde, 0xca,
0x09, 0xfa, 0xfe, 0x93, 0x18, 0x1f, 0x1f, 0xb6, 0xab, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xf3, 0x39, 0x44, 0xd8, 0xa3, 0xf5, 0x8e, 0x18, 0x9b, 0x1d, 0x31, 0xb6, 0x3b, 0x62, 0x7c, 0x2d, 0x09,
0xe1, 0xde, 0x86, 0xdb, 0x02, 0x00, 0x00, 0x5a, 0x97, 0x04, 0x6d, 0x4a, 0x82, 0xb6, 0x25, 0x41, 0x3f, 0x4a, 0x82, 0xbe, 0xfd, 0x24, 0xc6,
0x87, 0x07, 0xed, 0x61, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x78, 0xd8, 0x63, 0x3a, 0x03,
0x00, 0x00,
} }

View File

@ -41,6 +41,11 @@ message PartialObjectMetadata {
// PartialObjectMetadataList contains a list of objects containing only their metadata // PartialObjectMetadataList contains a list of objects containing only their metadata
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
message PartialObjectMetadataList { message PartialObjectMetadataList {
// Standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 2;
// items contains each of the included items. // items contains each of the included items.
repeated PartialObjectMetadata items = 1; repeated PartialObjectMetadata items = 1;
} }

View File

@ -18,7 +18,7 @@ limitations under the License.
package v1beta1 package v1beta1
import ( import (
"k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
) )
@ -159,6 +159,10 @@ type PartialObjectMetadata struct {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type PartialObjectMetadataList struct { type PartialObjectMetadataList struct {
v1.TypeMeta `json:",inline"` v1.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
// +optional
v1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,2,opt,name=metadata"`
// items contains each of the included items. // items contains each of the included items.
Items []*PartialObjectMetadata `json:"items" protobuf:"bytes,1,rep,name=items"` Items []*PartialObjectMetadata `json:"items" protobuf:"bytes,1,rep,name=items"`

View File

@ -54,6 +54,7 @@ func (in *PartialObjectMetadata) DeepCopyObject() runtime.Object {
func (in *PartialObjectMetadataList) DeepCopyInto(out *PartialObjectMetadataList) { func (in *PartialObjectMetadataList) DeepCopyInto(out *PartialObjectMetadataList) {
*out = *in *out = *in
out.TypeMeta = in.TypeMeta out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil { if in.Items != nil {
in, out := &in.Items, &out.Items in, out := &in.Items, &out.Items
*out = make([]*PartialObjectMetadata, len(*in)) *out = make([]*PartialObjectMetadata, len(*in))