Aggregated API endpoints now must implement rest.SingularNameProvider

This was a change in the interface requirements introduced in Kube 1.27.
This commit is contained in:
Ryan Richard
2023-05-10 16:50:50 -07:00
parent 8c3395481b
commit bc9afc4554
7 changed files with 42 additions and 21 deletions
@@ -1,4 +1,4 @@
// Copyright 2022 the Pinniped contributors. All Rights Reserved.
// Copyright 2022-2023 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Package clientsecretrequest provides REST functionality for the CredentialRequest resource.
@@ -77,6 +77,7 @@ var _ interface {
rest.Scoper
rest.Storage
rest.CategoriesProvider
rest.SingularNameProvider
rest.Lister
rest.TableConvertor
} = (*REST)(nil)
@@ -114,6 +115,10 @@ func (*REST) Categories() []string {
return []string{"pinniped"}
}
func (*REST) GetSingularName() string {
return "oidcclientsecretrequest"
}
func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
t := trace.FromContext(ctx).Nest("create",
trace.Field{Key: "kind", Value: "OIDCClientSecretRequest"},
@@ -1,4 +1,4 @@
// Copyright 2022 the Pinniped contributors. All Rights Reserved.
// Copyright 2022-2023 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package clientsecretrequest
@@ -50,6 +50,7 @@ func TestNew(t *testing.T) {
require.NotNil(t, r)
require.True(t, r.NamespaceScoped())
require.Equal(t, []string{"pinniped"}, r.Categories())
require.Equal(t, "oidcclientsecretrequest", r.GetSingularName())
require.IsType(t, &clientsecretapi.OIDCClientSecretRequest{}, r.New())
require.IsType(t, &clientsecretapi.OIDCClientSecretRequestList{}, r.NewList())
+6 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2020-2022 the Pinniped contributors. All Rights Reserved.
// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Package credentialrequest provides REST functionality for the CredentialRequest resource.
@@ -52,6 +52,7 @@ var _ interface {
rest.Scoper
rest.Storage
rest.CategoriesProvider
rest.SingularNameProvider
rest.Lister
} = (*REST)(nil)
@@ -86,6 +87,10 @@ func (*REST) Categories() []string {
return []string{"pinniped"}
}
func (*REST) GetSingularName() string {
return "tokencredentialrequest"
}
func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
t := trace.FromContext(ctx).Nest("create", trace.Field{
Key: "kind",
@@ -1,4 +1,4 @@
// Copyright 2020-2022 the Pinniped contributors. All Rights Reserved.
// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package credentialrequest
@@ -36,6 +36,7 @@ func TestNew(t *testing.T) {
require.NotNil(t, r)
require.False(t, r.NamespaceScoped())
require.Equal(t, []string{"pinniped"}, r.Categories())
require.Equal(t, "tokencredentialrequest", r.GetSingularName())
require.IsType(t, &loginapi.TokenCredentialRequest{}, r.New())
require.IsType(t, &loginapi.TokenCredentialRequestList{}, r.NewList())
+6 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2021-2022 the Pinniped contributors. All Rights Reserved.
// Copyright 2021-2023 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package whoamirequest
@@ -38,6 +38,7 @@ var _ interface {
rest.Scoper
rest.Storage
rest.CategoriesProvider
rest.SingularNameProvider
rest.Lister
} = (*REST)(nil)
@@ -72,6 +73,10 @@ func (*REST) Categories() []string {
return []string{"pinniped"}
}
func (*REST) GetSingularName() string {
return "whoamirequest"
}
func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
whoAmIRequest, ok := obj.(*identityapi.WhoAmIRequest)
if !ok {
+2 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2021 the Pinniped contributors. All Rights Reserved.
// Copyright 2021-2023 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package whoamirequest
@@ -25,6 +25,7 @@ func TestNew(t *testing.T) {
require.NotNil(t, r)
require.False(t, r.NamespaceScoped())
require.Equal(t, []string{"pinniped"}, r.Categories())
require.Equal(t, "whoamirequest", r.GetSingularName())
require.IsType(t, &identityapi.WhoAmIRequest{}, r.New())
require.IsType(t, &identityapi.WhoAmIRequestList{}, r.NewList())