mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Set list meta on PartialObjectMetadataList during transform
This commit is contained in:
parent
efde94a0bc
commit
6801ce990a
@ -37,8 +37,9 @@ func (PartialObjectMetadata) SwaggerDoc() map[string]string {
|
||||
}
|
||||
|
||||
var map_PartialObjectMetadataList = map[string]string{
|
||||
"": "PartialObjectMetadataList contains a list of objects containing only their metadata",
|
||||
"items": "items contains each of the included items.",
|
||||
"": "PartialObjectMetadataList contains a list of objects containing only their metadata",
|
||||
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
"items": "items contains each of the included items.",
|
||||
}
|
||||
|
||||
func (PartialObjectMetadataList) SwaggerDoc() map[string]string {
|
||||
|
@ -2269,6 +2269,10 @@ func TestGetPartialObjectMetadata(t *testing.T) {
|
||||
list: true,
|
||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadataList;v=v1beta1;g=meta.k8s.io",
|
||||
expected: &metav1beta1.PartialObjectMetadataList{
|
||||
ListMeta: metav1.ListMeta{
|
||||
ResourceVersion: "10",
|
||||
SelfLink: "/test/link",
|
||||
},
|
||||
Items: []*metav1beta1.PartialObjectMetadata{
|
||||
{
|
||||
TypeMeta: metav1.TypeMeta{APIVersion: "meta.k8s.io/v1beta1", Kind: "PartialObjectMetadata"},
|
||||
|
@ -196,6 +196,11 @@ func asV1Beta1PartialObjectMetadataList(result runtime.Object) (runtime.Object,
|
||||
return nil, newNotAcceptableError(fmt.Sprintf("you requested PartialObjectMetadataList, but the requested object is not a list (%T)", result))
|
||||
}
|
||||
list := &metav1beta1.PartialObjectMetadataList{}
|
||||
if li, ok := result.(metav1.ListInterface); ok {
|
||||
list.SelfLink = li.GetSelfLink()
|
||||
list.ResourceVersion = li.GetResourceVersion()
|
||||
list.Continue = li.GetContinue()
|
||||
}
|
||||
err := meta.EachListItem(result, func(obj runtime.Object) error {
|
||||
m, err := meta.Accessor(obj)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user