mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 20:42:26 +00:00
Set list meta on PartialObjectMetadataList during transform
This commit is contained in:
parent
efde94a0bc
commit
6801ce990a
@ -38,6 +38,7 @@ func (PartialObjectMetadata) SwaggerDoc() map[string]string {
|
|||||||
|
|
||||||
var map_PartialObjectMetadataList = map[string]string{
|
var map_PartialObjectMetadataList = map[string]string{
|
||||||
"": "PartialObjectMetadataList contains a list of objects containing only their metadata",
|
"": "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.",
|
"items": "items contains each of the included items.",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2269,6 +2269,10 @@ func TestGetPartialObjectMetadata(t *testing.T) {
|
|||||||
list: true,
|
list: true,
|
||||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadataList;v=v1beta1;g=meta.k8s.io",
|
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadataList;v=v1beta1;g=meta.k8s.io",
|
||||||
expected: &metav1beta1.PartialObjectMetadataList{
|
expected: &metav1beta1.PartialObjectMetadataList{
|
||||||
|
ListMeta: metav1.ListMeta{
|
||||||
|
ResourceVersion: "10",
|
||||||
|
SelfLink: "/test/link",
|
||||||
|
},
|
||||||
Items: []*metav1beta1.PartialObjectMetadata{
|
Items: []*metav1beta1.PartialObjectMetadata{
|
||||||
{
|
{
|
||||||
TypeMeta: metav1.TypeMeta{APIVersion: "meta.k8s.io/v1beta1", Kind: "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))
|
return nil, newNotAcceptableError(fmt.Sprintf("you requested PartialObjectMetadataList, but the requested object is not a list (%T)", result))
|
||||||
}
|
}
|
||||||
list := &metav1beta1.PartialObjectMetadataList{}
|
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 {
|
err := meta.EachListItem(result, func(obj runtime.Object) error {
|
||||||
m, err := meta.Accessor(obj)
|
m, err := meta.Accessor(obj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user