mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
ObjectMeta, ListMeta, and TypeMeta should implement their interfaces
Make unversioned.ListMeta implement List. Update all the *List types so they implement GetListMeta. This helps avoid using reflection to get list information. Remove all unnecessary boilerplate, move the interfaces to the right places, and add a test that verifies that objects implement one, the other, but never both.
This commit is contained in:
committed by
Clayton Coleman
parent
64b4967774
commit
e3af3451c8
@@ -35,6 +35,11 @@ func ListAccessor(obj interface{}) (List, error) {
|
||||
return om, nil
|
||||
}
|
||||
}
|
||||
if listMetaAccessor, ok := obj.(unversioned.ListMetaAccessor); ok {
|
||||
if om := listMetaAccessor.GetListMeta(); om != nil {
|
||||
return om, nil
|
||||
}
|
||||
}
|
||||
// we may get passed an object that is directly portable to List
|
||||
if list, ok := obj.(List); ok {
|
||||
return list, nil
|
||||
|
||||
Reference in New Issue
Block a user