mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
make codegen
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
This commit is contained in:
parent
676d989713
commit
ac3b7643ad
@ -7,7 +7,3 @@ API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,StatusCause
|
||||
API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Time,Time
|
||||
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentEncoding
|
||||
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentType
|
||||
API rule violation: names_match,k8s.io/code-generator/examples/apiserver/apis/core/v1,TestTypeStatus,Blah
|
||||
API rule violation: names_match,k8s.io/code-generator/examples/apiserver/apis/example/v1,TestTypeStatus,Blah
|
||||
API rule violation: names_match,k8s.io/code-generator/examples/apiserver/apis/example2/v1,TestTypeStatus,Blah
|
||||
API rule violation: names_match,k8s.io/code-generator/examples/apiserver/apis/example3.io/v1,TestTypeStatus,Blah
|
||||
|
@ -22,7 +22,6 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
examplev1 "k8s.io/code-generator/examples/HyphenGroup/apis/example/v1"
|
||||
)
|
||||
|
||||
// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use
|
||||
@ -30,7 +29,7 @@ import (
|
||||
type ClusterTestTypeApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Status *examplev1.ClusterTestTypeStatus `json:"status,omitempty"`
|
||||
Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with
|
||||
@ -204,8 +203,8 @@ func (b *ClusterTestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationEx
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value examplev1.ClusterTestTypeStatus) *ClusterTestTypeApplyConfiguration {
|
||||
b.Status = &value
|
||||
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeStatusApplyConfiguration) *ClusterTestTypeApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use
|
||||
// with apply.
|
||||
type ClusterTestTypeStatusApplyConfiguration struct {
|
||||
Blah *string `json:"blah,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with
|
||||
// apply.
|
||||
func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration {
|
||||
return &ClusterTestTypeStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Blah field is set to the value of the last call.
|
||||
func (b *ClusterTestTypeStatusApplyConfiguration) WithBlah(value string) *ClusterTestTypeStatusApplyConfiguration {
|
||||
b.Blah = &value
|
||||
return b
|
||||
}
|
@ -22,7 +22,6 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
examplev1 "k8s.io/code-generator/examples/HyphenGroup/apis/example/v1"
|
||||
)
|
||||
|
||||
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
||||
@ -30,7 +29,7 @@ import (
|
||||
type TestTypeApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Status *examplev1.TestTypeStatus `json:"status,omitempty"`
|
||||
Status *TestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// TestType constructs a declarative configuration of the TestType type for use with
|
||||
@ -205,8 +204,8 @@ func (b *TestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationExists()
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *TestTypeApplyConfiguration) WithStatus(value examplev1.TestTypeStatus) *TestTypeApplyConfiguration {
|
||||
b.Status = &value
|
||||
func (b *TestTypeApplyConfiguration) WithStatus(value *TestTypeStatusApplyConfiguration) *TestTypeApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// TestTypeStatusApplyConfiguration represents a declarative configuration of the TestTypeStatus type for use
|
||||
// with apply.
|
||||
type TestTypeStatusApplyConfiguration struct {
|
||||
Blah *string `json:"blah,omitempty"`
|
||||
}
|
||||
|
||||
// TestTypeStatusApplyConfiguration constructs a declarative configuration of the TestTypeStatus type for use with
|
||||
// apply.
|
||||
func TestTypeStatus() *TestTypeStatusApplyConfiguration {
|
||||
return &TestTypeStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Blah field is set to the value of the last call.
|
||||
func (b *TestTypeStatusApplyConfiguration) WithBlah(value string) *TestTypeStatusApplyConfiguration {
|
||||
b.Blah = &value
|
||||
return b
|
||||
}
|
@ -34,8 +34,12 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
// Group=example-group.hyphens.code-generator.k8s.io, Version=v1
|
||||
case v1.SchemeGroupVersion.WithKind("ClusterTestType"):
|
||||
return &examplev1.ClusterTestTypeApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("ClusterTestTypeStatus"):
|
||||
return &examplev1.ClusterTestTypeStatusApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("TestType"):
|
||||
return &examplev1.TestTypeApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("TestTypeStatus"):
|
||||
return &examplev1.TestTypeStatusApplyConfiguration{}
|
||||
|
||||
}
|
||||
return nil
|
||||
|
@ -22,7 +22,6 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
examplev1 "k8s.io/code-generator/examples/MixedCase/apis/example/v1"
|
||||
)
|
||||
|
||||
// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use
|
||||
@ -30,7 +29,7 @@ import (
|
||||
type ClusterTestTypeApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Status *examplev1.ClusterTestTypeStatus `json:"status,omitempty"`
|
||||
Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with
|
||||
@ -204,8 +203,8 @@ func (b *ClusterTestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationEx
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value examplev1.ClusterTestTypeStatus) *ClusterTestTypeApplyConfiguration {
|
||||
b.Status = &value
|
||||
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeStatusApplyConfiguration) *ClusterTestTypeApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use
|
||||
// with apply.
|
||||
type ClusterTestTypeStatusApplyConfiguration struct {
|
||||
Blah *string `json:"blah,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with
|
||||
// apply.
|
||||
func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration {
|
||||
return &ClusterTestTypeStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Blah field is set to the value of the last call.
|
||||
func (b *ClusterTestTypeStatusApplyConfiguration) WithBlah(value string) *ClusterTestTypeStatusApplyConfiguration {
|
||||
b.Blah = &value
|
||||
return b
|
||||
}
|
@ -22,7 +22,6 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
examplev1 "k8s.io/code-generator/examples/MixedCase/apis/example/v1"
|
||||
)
|
||||
|
||||
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
||||
@ -30,7 +29,7 @@ import (
|
||||
type TestTypeApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Status *examplev1.TestTypeStatus `json:"status,omitempty"`
|
||||
Status *TestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// TestType constructs a declarative configuration of the TestType type for use with
|
||||
@ -205,8 +204,8 @@ func (b *TestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationExists()
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *TestTypeApplyConfiguration) WithStatus(value examplev1.TestTypeStatus) *TestTypeApplyConfiguration {
|
||||
b.Status = &value
|
||||
func (b *TestTypeApplyConfiguration) WithStatus(value *TestTypeStatusApplyConfiguration) *TestTypeApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// TestTypeStatusApplyConfiguration represents a declarative configuration of the TestTypeStatus type for use
|
||||
// with apply.
|
||||
type TestTypeStatusApplyConfiguration struct {
|
||||
Blah *string `json:"blah,omitempty"`
|
||||
}
|
||||
|
||||
// TestTypeStatusApplyConfiguration constructs a declarative configuration of the TestTypeStatus type for use with
|
||||
// apply.
|
||||
func TestTypeStatus() *TestTypeStatusApplyConfiguration {
|
||||
return &TestTypeStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Blah field is set to the value of the last call.
|
||||
func (b *TestTypeStatusApplyConfiguration) WithBlah(value string) *TestTypeStatusApplyConfiguration {
|
||||
b.Blah = &value
|
||||
return b
|
||||
}
|
@ -34,8 +34,12 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
// Group=example.crd.code-generator.k8s.io, Version=v1
|
||||
case v1.SchemeGroupVersion.WithKind("ClusterTestType"):
|
||||
return &examplev1.ClusterTestTypeApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("ClusterTestTypeStatus"):
|
||||
return &examplev1.ClusterTestTypeStatusApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("TestType"):
|
||||
return &examplev1.TestTypeApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("TestTypeStatus"):
|
||||
return &examplev1.TestTypeStatusApplyConfiguration{}
|
||||
|
||||
}
|
||||
return nil
|
||||
|
@ -41,22 +41,24 @@ var testtypesKind = v1.SchemeGroupVersion.WithKind("TestType")
|
||||
|
||||
// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any.
|
||||
func (c *FakeTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &v1.TestType{})
|
||||
Invokes(testing.NewGetActionWithOptions(testtypesResource, c.ns, name, options), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of TestTypes that match those selectors.
|
||||
func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) {
|
||||
emptyResult := &v1.TestTypeList{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(testtypesResource, testtypesKind, c.ns, opts), &v1.TestTypeList{})
|
||||
Invokes(testing.NewListActionWithOptions(testtypesResource, testtypesKind, c.ns, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
@ -75,40 +77,43 @@ func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (resu
|
||||
// Watch returns a watch.Interface that watches the requested testTypes.
|
||||
func (c *FakeTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(testtypesResource, c.ns, opts))
|
||||
InvokesWatch(testing.NewWatchActionWithOptions(testtypesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||
func (c *FakeTestTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(testtypesResource, c.ns, testType), &v1.TestType{})
|
||||
Invokes(testing.NewCreateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||
func (c *FakeTestTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(testtypesResource, c.ns, testType), &v1.TestType{})
|
||||
Invokes(testing.NewUpdateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeTestTypes) UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (*v1.TestType, error) {
|
||||
func (c *FakeTestTypes) UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(testtypesResource, "status", c.ns, testType), &v1.TestType{})
|
||||
Invokes(testing.NewUpdateSubresourceActionWithOptions(testtypesResource, "status", c.ns, testType, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
@ -123,7 +128,7 @@ func (c *FakeTestTypes) Delete(ctx context.Context, name string, opts metav1.Del
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(testtypesResource, c.ns, listOpts)
|
||||
action := testing.NewDeleteCollectionActionWithOptions(testtypesResource, c.ns, opts, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1.TestTypeList{})
|
||||
return err
|
||||
@ -131,11 +136,12 @@ func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.Delete
|
||||
|
||||
// Patch applies the patch and returns the patched testType.
|
||||
func (c *FakeTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, pt, data, subresources...), &v1.TestType{})
|
||||
Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
@ -20,12 +20,11 @@ package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
v1 "k8s.io/code-generator/examples/apiserver/apis/core/v1"
|
||||
scheme "k8s.io/code-generator/examples/apiserver/clientset/versioned/scheme"
|
||||
)
|
||||
@ -40,6 +39,7 @@ type TestTypesGetter interface {
|
||||
type TestTypeInterface interface {
|
||||
Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (*v1.TestType, error)
|
||||
Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (*v1.TestType, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (*v1.TestType, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
@ -52,144 +52,18 @@ type TestTypeInterface interface {
|
||||
|
||||
// testTypes implements TestTypeInterface
|
||||
type testTypes struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
*gentype.ClientWithList[*v1.TestType, *v1.TestTypeList]
|
||||
}
|
||||
|
||||
// newTestTypes returns a TestTypes
|
||||
func newTestTypes(c *CoreV1Client, namespace string) *testTypes {
|
||||
return &testTypes{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
gentype.NewClientWithList[*v1.TestType, *v1.TestTypeList](
|
||||
"testtypes",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *v1.TestType { return &v1.TestType{} },
|
||||
func() *v1.TestTypeList { return &v1.TestTypeList{} }),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any.
|
||||
func (c *testTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) {
|
||||
result = &v1.TestType{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of TestTypes that match those selectors.
|
||||
func (c *testTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1.TestTypeList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested testTypes.
|
||||
func (c *testTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||
func (c *testTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) {
|
||||
result = &v1.TestType{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(testType).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||
func (c *testTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||
result = &v1.TestType{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
Name(testType.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(testType).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *testTypes) UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||
result = &v1.TestType{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
Name(testType.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(testType).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the testType and deletes it. Returns an error if one occurs.
|
||||
func (c *testTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *testTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched testType.
|
||||
func (c *testTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) {
|
||||
result = &v1.TestType{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
v1 "k8s.io/code-generator/examples/apiserver/apis/core/v1"
|
||||
)
|
||||
@ -38,25 +38,17 @@ type TestTypeLister interface {
|
||||
|
||||
// testTypeLister implements the TestTypeLister interface.
|
||||
type testTypeLister struct {
|
||||
indexer cache.Indexer
|
||||
listers.ResourceIndexer[*v1.TestType]
|
||||
}
|
||||
|
||||
// NewTestTypeLister returns a new TestTypeLister.
|
||||
func NewTestTypeLister(indexer cache.Indexer) TestTypeLister {
|
||||
return &testTypeLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all TestTypes in the indexer.
|
||||
func (s *testTypeLister) List(selector labels.Selector) (ret []*v1.TestType, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.TestType))
|
||||
})
|
||||
return ret, err
|
||||
return &testTypeLister{listers.New[*v1.TestType](indexer, v1.Resource("testtype"))}
|
||||
}
|
||||
|
||||
// TestTypes returns an object that can list and get TestTypes.
|
||||
func (s *testTypeLister) TestTypes(namespace string) TestTypeNamespaceLister {
|
||||
return testTypeNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
return testTypeNamespaceLister{listers.NewNamespaced[*v1.TestType](s.ResourceIndexer, namespace)}
|
||||
}
|
||||
|
||||
// TestTypeNamespaceLister helps list and get TestTypes.
|
||||
@ -74,26 +66,5 @@ type TestTypeNamespaceLister interface {
|
||||
// testTypeNamespaceLister implements the TestTypeNamespaceLister
|
||||
// interface.
|
||||
type testTypeNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all TestTypes in the indexer for a given namespace.
|
||||
func (s testTypeNamespaceLister) List(selector labels.Selector) (ret []*v1.TestType, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.TestType))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the TestType from the indexer for a given namespace and name.
|
||||
func (s testTypeNamespaceLister) Get(name string) (*v1.TestType, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1.Resource("testtype"), name)
|
||||
}
|
||||
return obj.(*v1.TestType), nil
|
||||
listers.ResourceIndexer[*v1.TestType]
|
||||
}
|
||||
|
@ -2731,7 +2731,7 @@ func schema_apiserver_apis_core_v1_TestTypeStatus(ref common.ReferenceCallback)
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"Blah": {
|
||||
"blah": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
@ -2739,7 +2739,7 @@ func schema_apiserver_apis_core_v1_TestTypeStatus(ref common.ReferenceCallback)
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"Blah"},
|
||||
Required: []string{"blah"},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -2841,7 +2841,7 @@ func schema_apiserver_apis_example_v1_TestTypeStatus(ref common.ReferenceCallbac
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"Blah": {
|
||||
"blah": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
@ -2849,7 +2849,7 @@ func schema_apiserver_apis_example_v1_TestTypeStatus(ref common.ReferenceCallbac
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"Blah"},
|
||||
Required: []string{"blah"},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -2951,7 +2951,7 @@ func schema_apiserver_apis_example2_v1_TestTypeStatus(ref common.ReferenceCallba
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"Blah": {
|
||||
"blah": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
@ -2959,7 +2959,7 @@ func schema_apiserver_apis_example2_v1_TestTypeStatus(ref common.ReferenceCallba
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"Blah"},
|
||||
Required: []string{"blah"},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -3061,7 +3061,7 @@ func schema_apiserver_apis_example3io_v1_TestTypeStatus(ref common.ReferenceCall
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"Blah": {
|
||||
"blah": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
@ -3069,7 +3069,7 @@ func schema_apiserver_apis_example3io_v1_TestTypeStatus(ref common.ReferenceCall
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"Blah"},
|
||||
Required: []string{"blah"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
examplev1 "k8s.io/code-generator/examples/crd/apis/example/v1"
|
||||
)
|
||||
|
||||
// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use
|
||||
@ -30,7 +29,7 @@ import (
|
||||
type ClusterTestTypeApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Status *examplev1.ClusterTestTypeStatus `json:"status,omitempty"`
|
||||
Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with
|
||||
@ -204,8 +203,8 @@ func (b *ClusterTestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationEx
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value examplev1.ClusterTestTypeStatus) *ClusterTestTypeApplyConfiguration {
|
||||
b.Status = &value
|
||||
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeStatusApplyConfiguration) *ClusterTestTypeApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use
|
||||
// with apply.
|
||||
type ClusterTestTypeStatusApplyConfiguration struct {
|
||||
Blah *string `json:"blah,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with
|
||||
// apply.
|
||||
func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration {
|
||||
return &ClusterTestTypeStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Blah field is set to the value of the last call.
|
||||
func (b *ClusterTestTypeStatusApplyConfiguration) WithBlah(value string) *ClusterTestTypeStatusApplyConfiguration {
|
||||
b.Blah = &value
|
||||
return b
|
||||
}
|
@ -22,7 +22,6 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
examplev1 "k8s.io/code-generator/examples/crd/apis/example/v1"
|
||||
)
|
||||
|
||||
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
||||
@ -30,7 +29,7 @@ import (
|
||||
type TestTypeApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Status *examplev1.TestTypeStatus `json:"status,omitempty"`
|
||||
Status *TestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// TestType constructs a declarative configuration of the TestType type for use with
|
||||
@ -205,8 +204,8 @@ func (b *TestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationExists()
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *TestTypeApplyConfiguration) WithStatus(value examplev1.TestTypeStatus) *TestTypeApplyConfiguration {
|
||||
b.Status = &value
|
||||
func (b *TestTypeApplyConfiguration) WithStatus(value *TestTypeStatusApplyConfiguration) *TestTypeApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// TestTypeStatusApplyConfiguration represents a declarative configuration of the TestTypeStatus type for use
|
||||
// with apply.
|
||||
type TestTypeStatusApplyConfiguration struct {
|
||||
Blah *string `json:"blah,omitempty"`
|
||||
}
|
||||
|
||||
// TestTypeStatusApplyConfiguration constructs a declarative configuration of the TestTypeStatus type for use with
|
||||
// apply.
|
||||
func TestTypeStatus() *TestTypeStatusApplyConfiguration {
|
||||
return &TestTypeStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Blah field is set to the value of the last call.
|
||||
func (b *TestTypeStatusApplyConfiguration) WithBlah(value string) *TestTypeStatusApplyConfiguration {
|
||||
b.Blah = &value
|
||||
return b
|
||||
}
|
@ -22,7 +22,6 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
example2v1 "k8s.io/code-generator/examples/crd/apis/example2/v1"
|
||||
)
|
||||
|
||||
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
||||
@ -30,7 +29,7 @@ import (
|
||||
type TestTypeApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Status *example2v1.TestTypeStatus `json:"status,omitempty"`
|
||||
Status *TestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// TestType constructs a declarative configuration of the TestType type for use with
|
||||
@ -205,8 +204,8 @@ func (b *TestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationExists()
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *TestTypeApplyConfiguration) WithStatus(value example2v1.TestTypeStatus) *TestTypeApplyConfiguration {
|
||||
b.Status = &value
|
||||
func (b *TestTypeApplyConfiguration) WithStatus(value *TestTypeStatusApplyConfiguration) *TestTypeApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// TestTypeStatusApplyConfiguration represents a declarative configuration of the TestTypeStatus type for use
|
||||
// with apply.
|
||||
type TestTypeStatusApplyConfiguration struct {
|
||||
Blah *string `json:"blah,omitempty"`
|
||||
}
|
||||
|
||||
// TestTypeStatusApplyConfiguration constructs a declarative configuration of the TestTypeStatus type for use with
|
||||
// apply.
|
||||
func TestTypeStatus() *TestTypeStatusApplyConfiguration {
|
||||
return &TestTypeStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Blah field is set to the value of the last call.
|
||||
func (b *TestTypeStatusApplyConfiguration) WithBlah(value string) *TestTypeStatusApplyConfiguration {
|
||||
b.Blah = &value
|
||||
return b
|
||||
}
|
@ -36,12 +36,18 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
// Group=example.crd.code-generator.k8s.io, Version=v1
|
||||
case v1.SchemeGroupVersion.WithKind("ClusterTestType"):
|
||||
return &examplev1.ClusterTestTypeApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("ClusterTestTypeStatus"):
|
||||
return &examplev1.ClusterTestTypeStatusApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("TestType"):
|
||||
return &examplev1.TestTypeApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("TestTypeStatus"):
|
||||
return &examplev1.TestTypeStatusApplyConfiguration{}
|
||||
|
||||
// Group=example.test.crd.code-generator.k8s.io, Version=v1
|
||||
case example2v1.SchemeGroupVersion.WithKind("TestType"):
|
||||
return &applyconfigurationexample2v1.TestTypeApplyConfiguration{}
|
||||
case example2v1.SchemeGroupVersion.WithKind("TestTypeStatus"):
|
||||
return &applyconfigurationexample2v1.TestTypeStatusApplyConfiguration{}
|
||||
|
||||
}
|
||||
return nil
|
||||
|
@ -22,18 +22,17 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
apiv1 "k8s.io/code-generator/examples/single/api/v1"
|
||||
)
|
||||
|
||||
// ClusterTestTypeApplyConfiguration represents an declarative configuration of the ClusterTestType type for use
|
||||
// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use
|
||||
// with apply.
|
||||
type ClusterTestTypeApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Status *apiv1.ClusterTestTypeStatus `json:"status,omitempty"`
|
||||
Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterTestType constructs an declarative configuration of the ClusterTestType type for use with
|
||||
// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with
|
||||
// apply.
|
||||
func ClusterTestType(name string) *ClusterTestTypeApplyConfiguration {
|
||||
b := &ClusterTestTypeApplyConfiguration{}
|
||||
@ -204,7 +203,13 @@ func (b *ClusterTestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationEx
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value apiv1.ClusterTestTypeStatus) *ClusterTestTypeApplyConfiguration {
|
||||
b.Status = &value
|
||||
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeStatusApplyConfiguration) *ClusterTestTypeApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||
func (b *ClusterTestTypeApplyConfiguration) GetName() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.Name
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use
|
||||
// with apply.
|
||||
type ClusterTestTypeStatusApplyConfiguration struct {
|
||||
Blah *string `json:"blah,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with
|
||||
// apply.
|
||||
func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration {
|
||||
return &ClusterTestTypeStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Blah field is set to the value of the last call.
|
||||
func (b *ClusterTestTypeStatusApplyConfiguration) WithBlah(value string) *ClusterTestTypeStatusApplyConfiguration {
|
||||
b.Blah = &value
|
||||
return b
|
||||
}
|
@ -22,18 +22,17 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
apiv1 "k8s.io/code-generator/examples/single/api/v1"
|
||||
)
|
||||
|
||||
// TestTypeApplyConfiguration represents an declarative configuration of the TestType type for use
|
||||
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
||||
// with apply.
|
||||
type TestTypeApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Status *apiv1.TestTypeStatus `json:"status,omitempty"`
|
||||
Status *TestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// TestType constructs an declarative configuration of the TestType type for use with
|
||||
// TestType constructs a declarative configuration of the TestType type for use with
|
||||
// apply.
|
||||
func TestType(name, namespace string) *TestTypeApplyConfiguration {
|
||||
b := &TestTypeApplyConfiguration{}
|
||||
@ -205,7 +204,13 @@ func (b *TestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationExists()
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *TestTypeApplyConfiguration) WithStatus(value apiv1.TestTypeStatus) *TestTypeApplyConfiguration {
|
||||
b.Status = &value
|
||||
func (b *TestTypeApplyConfiguration) WithStatus(value *TestTypeStatusApplyConfiguration) *TestTypeApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||
func (b *TestTypeApplyConfiguration) GetName() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.Name
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// TestTypeStatusApplyConfiguration represents a declarative configuration of the TestTypeStatus type for use
|
||||
// with apply.
|
||||
type TestTypeStatusApplyConfiguration struct {
|
||||
Blah *string `json:"blah,omitempty"`
|
||||
}
|
||||
|
||||
// TestTypeStatusApplyConfiguration constructs a declarative configuration of the TestTypeStatus type for use with
|
||||
// apply.
|
||||
func TestTypeStatus() *TestTypeStatusApplyConfiguration {
|
||||
return &TestTypeStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Blah field is set to the value of the last call.
|
||||
func (b *TestTypeStatusApplyConfiguration) WithBlah(value string) *TestTypeStatusApplyConfiguration {
|
||||
b.Blah = &value
|
||||
return b
|
||||
}
|
@ -19,9 +19,12 @@ limitations under the License.
|
||||
package applyconfiguration
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
testing "k8s.io/client-go/testing"
|
||||
v1 "k8s.io/code-generator/examples/single/api/v1"
|
||||
apiv1 "k8s.io/code-generator/examples/single/applyconfiguration/api/v1"
|
||||
internal "k8s.io/code-generator/examples/single/applyconfiguration/internal"
|
||||
)
|
||||
|
||||
// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no
|
||||
@ -31,9 +34,17 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
// Group=example.crd.code-generator.k8s.io, Version=v1
|
||||
case v1.SchemeGroupVersion.WithKind("ClusterTestType"):
|
||||
return &apiv1.ClusterTestTypeApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("ClusterTestTypeStatus"):
|
||||
return &apiv1.ClusterTestTypeStatusApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("TestType"):
|
||||
return &apiv1.TestTypeApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("TestTypeStatus"):
|
||||
return &apiv1.TestTypeStatusApplyConfiguration{}
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewTypeConverter(scheme *runtime.Scheme) *testing.TypeConverter {
|
||||
return &testing.TypeConverter{Scheme: scheme, TypeResolver: internal.Parser()}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
"k8s.io/client-go/discovery"
|
||||
fakediscovery "k8s.io/client-go/discovery/fake"
|
||||
"k8s.io/client-go/testing"
|
||||
applyconfiguration "k8s.io/code-generator/examples/single/applyconfiguration"
|
||||
clientset "k8s.io/code-generator/examples/single/clientset/versioned"
|
||||
examplev1 "k8s.io/code-generator/examples/single/clientset/versioned/typed/api/v1"
|
||||
fakeexamplev1 "k8s.io/code-generator/examples/single/clientset/versioned/typed/api/v1/fake"
|
||||
@ -31,8 +32,12 @@ import (
|
||||
|
||||
// NewSimpleClientset returns a clientset that will respond with the provided objects.
|
||||
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
|
||||
// without applying any validations and/or defaults. It shouldn't be considered a replacement
|
||||
// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement
|
||||
// for a real clientset and is mostly useful in simple unit tests.
|
||||
//
|
||||
// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves
|
||||
// server side apply testing. NewClientset is only available when apply configurations are generated (e.g.
|
||||
// via --with-applyconfig).
|
||||
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
|
||||
for _, obj := range objects {
|
||||
@ -74,6 +79,38 @@ func (c *Clientset) Tracker() testing.ObjectTracker {
|
||||
return c.tracker
|
||||
}
|
||||
|
||||
// NewClientset returns a clientset that will respond with the provided objects.
|
||||
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
|
||||
// without applying any validations and/or defaults. It shouldn't be considered a replacement
|
||||
// for a real clientset and is mostly useful in simple unit tests.
|
||||
func NewClientset(objects ...runtime.Object) *Clientset {
|
||||
o := testing.NewFieldManagedObjectTracker(
|
||||
scheme,
|
||||
codecs.UniversalDecoder(),
|
||||
applyconfiguration.NewTypeConverter(scheme),
|
||||
)
|
||||
for _, obj := range objects {
|
||||
if err := o.Add(obj); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
cs := &Clientset{tracker: o}
|
||||
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
||||
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||
gvr := action.GetResource()
|
||||
ns := action.GetNamespace()
|
||||
watch, err := o.Watch(gvr, ns)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
return true, watch, nil
|
||||
})
|
||||
|
||||
return cs
|
||||
}
|
||||
|
||||
var (
|
||||
_ clientset.Interface = &Clientset{}
|
||||
_ testing.FakeClient = &Clientset{}
|
||||
|
@ -20,15 +20,12 @@ package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
json "encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
v1 "k8s.io/code-generator/examples/single/api/v1"
|
||||
apiv1 "k8s.io/code-generator/examples/single/applyconfiguration/api/v1"
|
||||
scheme "k8s.io/code-generator/examples/single/clientset/versioned/scheme"
|
||||
@ -44,6 +41,7 @@ type ClusterTestTypesGetter interface {
|
||||
type ClusterTestTypeInterface interface {
|
||||
Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (*v1.ClusterTestType, error)
|
||||
Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
@ -52,6 +50,7 @@ type ClusterTestTypeInterface interface {
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterTestType, err error)
|
||||
Apply(ctx context.Context, clusterTestType *apiv1.ClusterTestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterTestType, err error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
ApplyStatus(ctx context.Context, clusterTestType *apiv1.ClusterTestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterTestType, err error)
|
||||
GetScale(ctx context.Context, clusterTestTypeName string, options metav1.GetOptions) (*autoscalingv1.Scale, error)
|
||||
UpdateScale(ctx context.Context, clusterTestTypeName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error)
|
||||
@ -61,195 +60,26 @@ type ClusterTestTypeInterface interface {
|
||||
|
||||
// clusterTestTypes implements ClusterTestTypeInterface
|
||||
type clusterTestTypes struct {
|
||||
client rest.Interface
|
||||
*gentype.ClientWithListAndApply[*v1.ClusterTestType, *v1.ClusterTestTypeList, *apiv1.ClusterTestTypeApplyConfiguration]
|
||||
}
|
||||
|
||||
// newClusterTestTypes returns a ClusterTestTypes
|
||||
func newClusterTestTypes(c *ExampleV1Client) *clusterTestTypes {
|
||||
return &clusterTestTypes{
|
||||
client: c.RESTClient(),
|
||||
gentype.NewClientWithListAndApply[*v1.ClusterTestType, *v1.ClusterTestTypeList, *apiv1.ClusterTestTypeApplyConfiguration](
|
||||
"clustertesttypes",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *v1.ClusterTestType { return &v1.ClusterTestType{} },
|
||||
func() *v1.ClusterTestTypeList { return &v1.ClusterTestTypeList{} }),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any.
|
||||
func (c *clusterTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterTestType, err error) {
|
||||
result = &v1.ClusterTestType{}
|
||||
err = c.client.Get().
|
||||
Resource("clustertesttypes").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors.
|
||||
func (c *clusterTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterTestTypeList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1.ClusterTestTypeList{}
|
||||
err = c.client.Get().
|
||||
Resource("clustertesttypes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusterTestTypes.
|
||||
func (c *clusterTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("clustertesttypes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any.
|
||||
func (c *clusterTestTypes) Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (result *v1.ClusterTestType, err error) {
|
||||
result = &v1.ClusterTestType{}
|
||||
err = c.client.Post().
|
||||
Resource("clustertesttypes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterTestType).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any.
|
||||
func (c *clusterTestTypes) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) {
|
||||
result = &v1.ClusterTestType{}
|
||||
err = c.client.Put().
|
||||
Resource("clustertesttypes").
|
||||
Name(clusterTestType.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterTestType).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *clusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) {
|
||||
result = &v1.ClusterTestType{}
|
||||
err = c.client.Put().
|
||||
Resource("clustertesttypes").
|
||||
Name(clusterTestType.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterTestType).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterTestType and deletes it. Returns an error if one occurs.
|
||||
func (c *clusterTestTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("clustertesttypes").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *clusterTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Resource("clustertesttypes").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterTestType.
|
||||
func (c *clusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterTestType, err error) {
|
||||
result = &v1.ClusterTestType{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("clustertesttypes").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Apply takes the given apply declarative configuration, applies it and returns the applied clusterTestType.
|
||||
func (c *clusterTestTypes) Apply(ctx context.Context, clusterTestType *apiv1.ClusterTestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterTestType, err error) {
|
||||
if clusterTestType == nil {
|
||||
return nil, fmt.Errorf("clusterTestType provided to Apply must not be nil")
|
||||
}
|
||||
patchOpts := opts.ToPatchOptions()
|
||||
data, err := json.Marshal(clusterTestType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
name := clusterTestType.Name
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("clusterTestType.Name must be provided to Apply")
|
||||
}
|
||||
result = &v1.ClusterTestType{}
|
||||
err = c.client.Patch(types.ApplyPatchType).
|
||||
Resource("clustertesttypes").
|
||||
Name(*name).
|
||||
VersionedParams(&patchOpts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// ApplyStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
func (c *clusterTestTypes) ApplyStatus(ctx context.Context, clusterTestType *apiv1.ClusterTestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterTestType, err error) {
|
||||
if clusterTestType == nil {
|
||||
return nil, fmt.Errorf("clusterTestType provided to Apply must not be nil")
|
||||
}
|
||||
patchOpts := opts.ToPatchOptions()
|
||||
data, err := json.Marshal(clusterTestType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
name := clusterTestType.Name
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("clusterTestType.Name must be provided to Apply")
|
||||
}
|
||||
|
||||
result = &v1.ClusterTestType{}
|
||||
err = c.client.Patch(types.ApplyPatchType).
|
||||
Resource("clustertesttypes").
|
||||
Name(*name).
|
||||
SubResource("status").
|
||||
VersionedParams(&patchOpts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// GetScale takes name of the clusterTestType, and returns the corresponding autoscalingv1.Scale object, and an error if there is any.
|
||||
func (c *clusterTestTypes) GetScale(ctx context.Context, clusterTestTypeName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||
result = &autoscalingv1.Scale{}
|
||||
err = c.client.Get().
|
||||
err = c.GetClient().Get().
|
||||
Resource("clustertesttypes").
|
||||
Name(clusterTestTypeName).
|
||||
SubResource("scale").
|
||||
@ -262,7 +92,7 @@ func (c *clusterTestTypes) GetScale(ctx context.Context, clusterTestTypeName str
|
||||
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||
func (c *clusterTestTypes) UpdateScale(ctx context.Context, clusterTestTypeName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
|
||||
result = &autoscalingv1.Scale{}
|
||||
err = c.client.Put().
|
||||
err = c.GetClient().Put().
|
||||
Resource("clustertesttypes").
|
||||
Name(clusterTestTypeName).
|
||||
SubResource("scale").
|
||||
|
@ -44,20 +44,22 @@ var clustertesttypesKind = v1.SchemeGroupVersion.WithKind("ClusterTestType")
|
||||
|
||||
// Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any.
|
||||
func (c *FakeClusterTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterTestType, err error) {
|
||||
emptyResult := &v1.ClusterTestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(clustertesttypesResource, name), &v1.ClusterTestType{})
|
||||
Invokes(testing.NewRootGetActionWithOptions(clustertesttypesResource, name, options), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterTestType), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors.
|
||||
func (c *FakeClusterTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterTestTypeList, err error) {
|
||||
emptyResult := &v1.ClusterTestTypeList{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(clustertesttypesResource, clustertesttypesKind, opts), &v1.ClusterTestTypeList{})
|
||||
Invokes(testing.NewRootListActionWithOptions(clustertesttypesResource, clustertesttypesKind, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
@ -76,36 +78,39 @@ func (c *FakeClusterTestTypes) List(ctx context.Context, opts metav1.ListOptions
|
||||
// Watch returns a watch.Interface that watches the requested clusterTestTypes.
|
||||
func (c *FakeClusterTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(clustertesttypesResource, opts))
|
||||
InvokesWatch(testing.NewRootWatchActionWithOptions(clustertesttypesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any.
|
||||
func (c *FakeClusterTestTypes) Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (result *v1.ClusterTestType, err error) {
|
||||
emptyResult := &v1.ClusterTestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(clustertesttypesResource, clusterTestType), &v1.ClusterTestType{})
|
||||
Invokes(testing.NewRootCreateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterTestType), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any.
|
||||
func (c *FakeClusterTestTypes) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) {
|
||||
emptyResult := &v1.ClusterTestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(clustertesttypesResource, clusterTestType), &v1.ClusterTestType{})
|
||||
Invokes(testing.NewRootUpdateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterTestType), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error) {
|
||||
func (c *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) {
|
||||
emptyResult := &v1.ClusterTestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateSubresourceAction(clustertesttypesResource, "status", clusterTestType), &v1.ClusterTestType{})
|
||||
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clustertesttypesResource, "status", clusterTestType, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterTestType), err
|
||||
}
|
||||
@ -119,7 +124,7 @@ func (c *FakeClusterTestTypes) Delete(ctx context.Context, name string, opts met
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(clustertesttypesResource, listOpts)
|
||||
action := testing.NewRootDeleteCollectionActionWithOptions(clustertesttypesResource, opts, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1.ClusterTestTypeList{})
|
||||
return err
|
||||
@ -127,10 +132,11 @@ func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts metav1
|
||||
|
||||
// Patch applies the patch and returns the patched clusterTestType.
|
||||
func (c *FakeClusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterTestType, err error) {
|
||||
emptyResult := &v1.ClusterTestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(clustertesttypesResource, name, pt, data, subresources...), &v1.ClusterTestType{})
|
||||
Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertesttypesResource, name, pt, data, opts, subresources...), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterTestType), err
|
||||
}
|
||||
@ -148,10 +154,11 @@ func (c *FakeClusterTestTypes) Apply(ctx context.Context, clusterTestType *apiv1
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("clusterTestType.Name must be provided to Apply")
|
||||
}
|
||||
emptyResult := &v1.ClusterTestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(clustertesttypesResource, *name, types.ApplyPatchType, data), &v1.ClusterTestType{})
|
||||
Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertesttypesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterTestType), err
|
||||
}
|
||||
@ -170,30 +177,33 @@ func (c *FakeClusterTestTypes) ApplyStatus(ctx context.Context, clusterTestType
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("clusterTestType.Name must be provided to Apply")
|
||||
}
|
||||
emptyResult := &v1.ClusterTestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(clustertesttypesResource, *name, types.ApplyPatchType, data, "status"), &v1.ClusterTestType{})
|
||||
Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertesttypesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterTestType), err
|
||||
}
|
||||
|
||||
// GetScale takes name of the clusterTestType, and returns the corresponding scale object, and an error if there is any.
|
||||
func (c *FakeClusterTestTypes) GetScale(ctx context.Context, clusterTestTypeName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||
emptyResult := &autoscalingv1.Scale{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetSubresourceAction(clustertesttypesResource, "scale", clusterTestTypeName), &autoscalingv1.Scale{})
|
||||
Invokes(testing.NewRootGetSubresourceActionWithOptions(clustertesttypesResource, "scale", clusterTestTypeName, options), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*autoscalingv1.Scale), err
|
||||
}
|
||||
|
||||
// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||
func (c *FakeClusterTestTypes) UpdateScale(ctx context.Context, clusterTestTypeName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
|
||||
emptyResult := &autoscalingv1.Scale{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateSubresourceAction(clustertesttypesResource, "scale", scale), &autoscalingv1.Scale{})
|
||||
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clustertesttypesResource, "scale", scale, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*autoscalingv1.Scale), err
|
||||
}
|
||||
|
@ -44,22 +44,24 @@ var testtypesKind = v1.SchemeGroupVersion.WithKind("TestType")
|
||||
|
||||
// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any.
|
||||
func (c *FakeTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &v1.TestType{})
|
||||
Invokes(testing.NewGetActionWithOptions(testtypesResource, c.ns, name, options), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of TestTypes that match those selectors.
|
||||
func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) {
|
||||
emptyResult := &v1.TestTypeList{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(testtypesResource, testtypesKind, c.ns, opts), &v1.TestTypeList{})
|
||||
Invokes(testing.NewListActionWithOptions(testtypesResource, testtypesKind, c.ns, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
@ -78,40 +80,43 @@ func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (resu
|
||||
// Watch returns a watch.Interface that watches the requested testTypes.
|
||||
func (c *FakeTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(testtypesResource, c.ns, opts))
|
||||
InvokesWatch(testing.NewWatchActionWithOptions(testtypesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||
func (c *FakeTestTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(testtypesResource, c.ns, testType), &v1.TestType{})
|
||||
Invokes(testing.NewCreateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||
func (c *FakeTestTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(testtypesResource, c.ns, testType), &v1.TestType{})
|
||||
Invokes(testing.NewUpdateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeTestTypes) UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (*v1.TestType, error) {
|
||||
func (c *FakeTestTypes) UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(testtypesResource, "status", c.ns, testType), &v1.TestType{})
|
||||
Invokes(testing.NewUpdateSubresourceActionWithOptions(testtypesResource, "status", c.ns, testType, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
@ -126,7 +131,7 @@ func (c *FakeTestTypes) Delete(ctx context.Context, name string, opts metav1.Del
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(testtypesResource, c.ns, listOpts)
|
||||
action := testing.NewDeleteCollectionActionWithOptions(testtypesResource, c.ns, opts, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1.TestTypeList{})
|
||||
return err
|
||||
@ -134,11 +139,12 @@ func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.Delete
|
||||
|
||||
// Patch applies the patch and returns the patched testType.
|
||||
func (c *FakeTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, pt, data, subresources...), &v1.TestType{})
|
||||
Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
@ -156,11 +162,12 @@ func (c *FakeTestTypes) Apply(ctx context.Context, testType *apiv1.TestTypeApply
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("testType.Name must be provided to Apply")
|
||||
}
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, *name, types.ApplyPatchType, data), &v1.TestType{})
|
||||
Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
@ -179,11 +186,12 @@ func (c *FakeTestTypes) ApplyStatus(ctx context.Context, testType *apiv1.TestTyp
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("testType.Name must be provided to Apply")
|
||||
}
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.TestType{})
|
||||
Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
@ -20,14 +20,11 @@ package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
json "encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
v1 "k8s.io/code-generator/examples/single/api/v1"
|
||||
apiv1 "k8s.io/code-generator/examples/single/applyconfiguration/api/v1"
|
||||
scheme "k8s.io/code-generator/examples/single/clientset/versioned/scheme"
|
||||
@ -43,6 +40,7 @@ type TestTypesGetter interface {
|
||||
type TestTypeInterface interface {
|
||||
Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (*v1.TestType, error)
|
||||
Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (*v1.TestType, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (*v1.TestType, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
@ -51,206 +49,25 @@ type TestTypeInterface interface {
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error)
|
||||
Apply(ctx context.Context, testType *apiv1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
ApplyStatus(ctx context.Context, testType *apiv1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error)
|
||||
TestTypeExpansion
|
||||
}
|
||||
|
||||
// testTypes implements TestTypeInterface
|
||||
type testTypes struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
*gentype.ClientWithListAndApply[*v1.TestType, *v1.TestTypeList, *apiv1.TestTypeApplyConfiguration]
|
||||
}
|
||||
|
||||
// newTestTypes returns a TestTypes
|
||||
func newTestTypes(c *ExampleV1Client, namespace string) *testTypes {
|
||||
return &testTypes{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
gentype.NewClientWithListAndApply[*v1.TestType, *v1.TestTypeList, *apiv1.TestTypeApplyConfiguration](
|
||||
"testtypes",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *v1.TestType { return &v1.TestType{} },
|
||||
func() *v1.TestTypeList { return &v1.TestTypeList{} }),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any.
|
||||
func (c *testTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) {
|
||||
result = &v1.TestType{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of TestTypes that match those selectors.
|
||||
func (c *testTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1.TestTypeList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested testTypes.
|
||||
func (c *testTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||
func (c *testTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) {
|
||||
result = &v1.TestType{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(testType).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||
func (c *testTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||
result = &v1.TestType{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
Name(testType.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(testType).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *testTypes) UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||
result = &v1.TestType{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
Name(testType.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(testType).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the testType and deletes it. Returns an error if one occurs.
|
||||
func (c *testTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *testTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched testType.
|
||||
func (c *testTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) {
|
||||
result = &v1.TestType{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Apply takes the given apply declarative configuration, applies it and returns the applied testType.
|
||||
func (c *testTypes) Apply(ctx context.Context, testType *apiv1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error) {
|
||||
if testType == nil {
|
||||
return nil, fmt.Errorf("testType provided to Apply must not be nil")
|
||||
}
|
||||
patchOpts := opts.ToPatchOptions()
|
||||
data, err := json.Marshal(testType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
name := testType.Name
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("testType.Name must be provided to Apply")
|
||||
}
|
||||
result = &v1.TestType{}
|
||||
err = c.client.Patch(types.ApplyPatchType).
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
Name(*name).
|
||||
VersionedParams(&patchOpts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// ApplyStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
func (c *testTypes) ApplyStatus(ctx context.Context, testType *apiv1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error) {
|
||||
if testType == nil {
|
||||
return nil, fmt.Errorf("testType provided to Apply must not be nil")
|
||||
}
|
||||
patchOpts := opts.ToPatchOptions()
|
||||
data, err := json.Marshal(testType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
name := testType.Name
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("testType.Name must be provided to Apply")
|
||||
}
|
||||
|
||||
result = &v1.TestType{}
|
||||
err = c.client.Patch(types.ApplyPatchType).
|
||||
Namespace(c.ns).
|
||||
Resource("testtypes").
|
||||
Name(*name).
|
||||
SubResource("status").
|
||||
VersionedParams(&patchOpts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
v1 "k8s.io/code-generator/examples/single/api/v1"
|
||||
)
|
||||
@ -39,30 +39,10 @@ type ClusterTestTypeLister interface {
|
||||
|
||||
// clusterTestTypeLister implements the ClusterTestTypeLister interface.
|
||||
type clusterTestTypeLister struct {
|
||||
indexer cache.Indexer
|
||||
listers.ResourceIndexer[*v1.ClusterTestType]
|
||||
}
|
||||
|
||||
// NewClusterTestTypeLister returns a new ClusterTestTypeLister.
|
||||
func NewClusterTestTypeLister(indexer cache.Indexer) ClusterTestTypeLister {
|
||||
return &clusterTestTypeLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all ClusterTestTypes in the indexer.
|
||||
func (s *clusterTestTypeLister) List(selector labels.Selector) (ret []*v1.ClusterTestType, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.ClusterTestType))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the ClusterTestType from the index for a given name.
|
||||
func (s *clusterTestTypeLister) Get(name string) (*v1.ClusterTestType, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1.Resource("clustertesttype"), name)
|
||||
}
|
||||
return obj.(*v1.ClusterTestType), nil
|
||||
return &clusterTestTypeLister{listers.New[*v1.ClusterTestType](indexer, v1.Resource("clustertesttype"))}
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
v1 "k8s.io/code-generator/examples/single/api/v1"
|
||||
)
|
||||
@ -38,25 +38,17 @@ type TestTypeLister interface {
|
||||
|
||||
// testTypeLister implements the TestTypeLister interface.
|
||||
type testTypeLister struct {
|
||||
indexer cache.Indexer
|
||||
listers.ResourceIndexer[*v1.TestType]
|
||||
}
|
||||
|
||||
// NewTestTypeLister returns a new TestTypeLister.
|
||||
func NewTestTypeLister(indexer cache.Indexer) TestTypeLister {
|
||||
return &testTypeLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all TestTypes in the indexer.
|
||||
func (s *testTypeLister) List(selector labels.Selector) (ret []*v1.TestType, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.TestType))
|
||||
})
|
||||
return ret, err
|
||||
return &testTypeLister{listers.New[*v1.TestType](indexer, v1.Resource("testtype"))}
|
||||
}
|
||||
|
||||
// TestTypes returns an object that can list and get TestTypes.
|
||||
func (s *testTypeLister) TestTypes(namespace string) TestTypeNamespaceLister {
|
||||
return testTypeNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
return testTypeNamespaceLister{listers.NewNamespaced[*v1.TestType](s.ResourceIndexer, namespace)}
|
||||
}
|
||||
|
||||
// TestTypeNamespaceLister helps list and get TestTypes.
|
||||
@ -74,26 +66,5 @@ type TestTypeNamespaceLister interface {
|
||||
// testTypeNamespaceLister implements the TestTypeNamespaceLister
|
||||
// interface.
|
||||
type testTypeNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all TestTypes in the indexer for a given namespace.
|
||||
func (s testTypeNamespaceLister) List(selector labels.Selector) (ret []*v1.TestType, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.TestType))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the TestType from the indexer for a given namespace and name.
|
||||
func (s testTypeNamespaceLister) Get(name string) (*v1.TestType, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1.Resource("testtype"), name)
|
||||
}
|
||||
return obj.(*v1.TestType), nil
|
||||
listers.ResourceIndexer[*v1.TestType]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user