Run codegen

Signed-off-by: Stephen Kitt <skitt@redhat.com>
This commit is contained in:
Stephen Kitt
2024-08-01 12:10:10 +02:00
parent b0ce65df9b
commit be03bcf324
243 changed files with 3753 additions and 21657 deletions

View File

@@ -29,7 +29,7 @@ type FakeCrV1 struct {
} }
func (c *FakeCrV1) Examples(namespace string) v1.ExampleInterface { func (c *FakeCrV1) Examples(namespace string) v1.ExampleInterface {
return &FakeExamples{c, namespace} return newFakeExamples(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,142 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/apiextensions-apiserver/examples/client-go/pkg/apis/cr/v1" v1 "k8s.io/apiextensions-apiserver/examples/client-go/pkg/apis/cr/v1"
crv1 "k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/applyconfiguration/cr/v1" crv1 "k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/applyconfiguration/cr/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" typedcrv1 "k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/clientset/versioned/typed/cr/v1"
labels "k8s.io/apimachinery/pkg/labels" gentype "k8s.io/client-go/gentype"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
) )
// FakeExamples implements ExampleInterface // fakeExamples implements ExampleInterface
type FakeExamples struct { type fakeExamples struct {
*gentype.FakeClientWithListAndApply[*v1.Example, *v1.ExampleList, *crv1.ExampleApplyConfiguration]
Fake *FakeCrV1 Fake *FakeCrV1
ns string
} }
var examplesResource = v1.SchemeGroupVersion.WithResource("examples") func newFakeExamples(fake *FakeCrV1, namespace string) typedcrv1.ExampleInterface {
return &fakeExamples{
var examplesKind = v1.SchemeGroupVersion.WithKind("Example") gentype.NewFakeClientWithListAndApply[*v1.Example, *v1.ExampleList, *crv1.ExampleApplyConfiguration](
fake.Fake,
// Get takes name of the example, and returns the corresponding example object, and an error if there is any. namespace,
func (c *FakeExamples) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Example, err error) { v1.SchemeGroupVersion.WithResource("examples"),
emptyResult := &v1.Example{} v1.SchemeGroupVersion.WithKind("Example"),
obj, err := c.Fake. func() *v1.Example { return &v1.Example{} },
Invokes(testing.NewGetActionWithOptions(examplesResource, c.ns, name, options), emptyResult) func() *v1.ExampleList { return &v1.ExampleList{} },
func(dst, src *v1.ExampleList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.ExampleList) []*v1.Example { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.ExampleList, items []*v1.Example) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.Example), err
}
// List takes label and field selectors, and returns the list of Examples that match those selectors.
func (c *FakeExamples) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ExampleList, err error) {
emptyResult := &v1.ExampleList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(examplesResource, examplesKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ExampleList{ListMeta: obj.(*v1.ExampleList).ListMeta}
for _, item := range obj.(*v1.ExampleList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested examples.
func (c *FakeExamples) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(examplesResource, c.ns, opts))
}
// Create takes the representation of a example and creates it. Returns the server's representation of the example, and an error, if there is any.
func (c *FakeExamples) Create(ctx context.Context, example *v1.Example, opts metav1.CreateOptions) (result *v1.Example, err error) {
emptyResult := &v1.Example{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(examplesResource, c.ns, example, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Example), err
}
// Update takes the representation of a example and updates it. Returns the server's representation of the example, and an error, if there is any.
func (c *FakeExamples) Update(ctx context.Context, example *v1.Example, opts metav1.UpdateOptions) (result *v1.Example, err error) {
emptyResult := &v1.Example{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(examplesResource, c.ns, example, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Example), err
}
// Delete takes name of the example and deletes it. Returns an error if one occurs.
func (c *FakeExamples) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(examplesResource, c.ns, name, opts), &v1.Example{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeExamples) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(examplesResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.ExampleList{})
return err
}
// Patch applies the patch and returns the patched example.
func (c *FakeExamples) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Example, err error) {
emptyResult := &v1.Example{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(examplesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Example), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied example.
func (c *FakeExamples) Apply(ctx context.Context, example *crv1.ExampleApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Example, err error) {
if example == nil {
return nil, fmt.Errorf("example provided to Apply must not be nil")
}
data, err := json.Marshal(example)
if err != nil {
return nil, err
}
name := example.Name
if name == nil {
return nil, fmt.Errorf("example.Name must be provided to Apply")
}
emptyResult := &v1.Example{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(examplesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Example), err
} }

View File

@@ -29,7 +29,7 @@ type FakeApiextensionsV1 struct {
} }
func (c *FakeApiextensionsV1) CustomResourceDefinitions() v1.CustomResourceDefinitionInterface { func (c *FakeApiextensionsV1) CustomResourceDefinitions() v1.CustomResourceDefinitionInterface {
return &FakeCustomResourceDefinitions{c} return newFakeCustomResourceDefinitions(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,168 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" typedapiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1"
labels "k8s.io/apimachinery/pkg/labels" gentype "k8s.io/client-go/gentype"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
) )
// FakeCustomResourceDefinitions implements CustomResourceDefinitionInterface // fakeCustomResourceDefinitions implements CustomResourceDefinitionInterface
type FakeCustomResourceDefinitions struct { type fakeCustomResourceDefinitions struct {
*gentype.FakeClientWithListAndApply[*v1.CustomResourceDefinition, *v1.CustomResourceDefinitionList, *apiextensionsv1.CustomResourceDefinitionApplyConfiguration]
Fake *FakeApiextensionsV1 Fake *FakeApiextensionsV1
} }
var customresourcedefinitionsResource = v1.SchemeGroupVersion.WithResource("customresourcedefinitions") func newFakeCustomResourceDefinitions(fake *FakeApiextensionsV1) typedapiextensionsv1.CustomResourceDefinitionInterface {
return &fakeCustomResourceDefinitions{
var customresourcedefinitionsKind = v1.SchemeGroupVersion.WithKind("CustomResourceDefinition") gentype.NewFakeClientWithListAndApply[*v1.CustomResourceDefinition, *v1.CustomResourceDefinitionList, *apiextensionsv1.CustomResourceDefinitionApplyConfiguration](
fake.Fake,
// Get takes name of the customResourceDefinition, and returns the corresponding customResourceDefinition object, and an error if there is any. "",
func (c *FakeCustomResourceDefinitions) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CustomResourceDefinition, err error) { v1.SchemeGroupVersion.WithResource("customresourcedefinitions"),
emptyResult := &v1.CustomResourceDefinition{} v1.SchemeGroupVersion.WithKind("CustomResourceDefinition"),
obj, err := c.Fake. func() *v1.CustomResourceDefinition { return &v1.CustomResourceDefinition{} },
Invokes(testing.NewRootGetActionWithOptions(customresourcedefinitionsResource, name, options), emptyResult) func() *v1.CustomResourceDefinitionList { return &v1.CustomResourceDefinitionList{} },
if obj == nil { func(dst, src *v1.CustomResourceDefinitionList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1.CustomResourceDefinitionList) []*v1.CustomResourceDefinition {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1.CustomResourceDefinitionList, items []*v1.CustomResourceDefinition) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.CustomResourceDefinition), err
}
// List takes label and field selectors, and returns the list of CustomResourceDefinitions that match those selectors.
func (c *FakeCustomResourceDefinitions) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CustomResourceDefinitionList, err error) {
emptyResult := &v1.CustomResourceDefinitionList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(customresourcedefinitionsResource, customresourcedefinitionsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.CustomResourceDefinitionList{ListMeta: obj.(*v1.CustomResourceDefinitionList).ListMeta}
for _, item := range obj.(*v1.CustomResourceDefinitionList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested customResourceDefinitions.
func (c *FakeCustomResourceDefinitions) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(customresourcedefinitionsResource, opts))
}
// Create takes the representation of a customResourceDefinition and creates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any.
func (c *FakeCustomResourceDefinitions) Create(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.CreateOptions) (result *v1.CustomResourceDefinition, err error) {
emptyResult := &v1.CustomResourceDefinition{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(customresourcedefinitionsResource, customResourceDefinition, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CustomResourceDefinition), err
}
// Update takes the representation of a customResourceDefinition and updates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any.
func (c *FakeCustomResourceDefinitions) Update(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.UpdateOptions) (result *v1.CustomResourceDefinition, err error) {
emptyResult := &v1.CustomResourceDefinition{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(customresourcedefinitionsResource, customResourceDefinition, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CustomResourceDefinition), 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 *FakeCustomResourceDefinitions) UpdateStatus(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.UpdateOptions) (result *v1.CustomResourceDefinition, err error) {
emptyResult := &v1.CustomResourceDefinition{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(customresourcedefinitionsResource, "status", customResourceDefinition, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CustomResourceDefinition), err
}
// Delete takes name of the customResourceDefinition and deletes it. Returns an error if one occurs.
func (c *FakeCustomResourceDefinitions) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(customresourcedefinitionsResource, name, opts), &v1.CustomResourceDefinition{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeCustomResourceDefinitions) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(customresourcedefinitionsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.CustomResourceDefinitionList{})
return err
}
// Patch applies the patch and returns the patched customResourceDefinition.
func (c *FakeCustomResourceDefinitions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CustomResourceDefinition, err error) {
emptyResult := &v1.CustomResourceDefinition{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(customresourcedefinitionsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CustomResourceDefinition), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied customResourceDefinition.
func (c *FakeCustomResourceDefinitions) Apply(ctx context.Context, customResourceDefinition *apiextensionsv1.CustomResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CustomResourceDefinition, err error) {
if customResourceDefinition == nil {
return nil, fmt.Errorf("customResourceDefinition provided to Apply must not be nil")
}
data, err := json.Marshal(customResourceDefinition)
if err != nil {
return nil, err
}
name := customResourceDefinition.Name
if name == nil {
return nil, fmt.Errorf("customResourceDefinition.Name must be provided to Apply")
}
emptyResult := &v1.CustomResourceDefinition{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(customresourcedefinitionsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CustomResourceDefinition), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeCustomResourceDefinitions) ApplyStatus(ctx context.Context, customResourceDefinition *apiextensionsv1.CustomResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CustomResourceDefinition, err error) {
if customResourceDefinition == nil {
return nil, fmt.Errorf("customResourceDefinition provided to Apply must not be nil")
}
data, err := json.Marshal(customResourceDefinition)
if err != nil {
return nil, err
}
name := customResourceDefinition.Name
if name == nil {
return nil, fmt.Errorf("customResourceDefinition.Name must be provided to Apply")
}
emptyResult := &v1.CustomResourceDefinition{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(customresourcedefinitionsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CustomResourceDefinition), err
} }

View File

@@ -29,7 +29,7 @@ type FakeApiextensionsV1beta1 struct {
} }
func (c *FakeApiextensionsV1beta1) CustomResourceDefinitions() v1beta1.CustomResourceDefinitionInterface { func (c *FakeApiextensionsV1beta1) CustomResourceDefinitions() v1beta1.CustomResourceDefinitionInterface {
return &FakeCustomResourceDefinitions{c} return newFakeCustomResourceDefinitions(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,168 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" v1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" typedapiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1"
labels "k8s.io/apimachinery/pkg/labels" gentype "k8s.io/client-go/gentype"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
) )
// FakeCustomResourceDefinitions implements CustomResourceDefinitionInterface // fakeCustomResourceDefinitions implements CustomResourceDefinitionInterface
type FakeCustomResourceDefinitions struct { type fakeCustomResourceDefinitions struct {
*gentype.FakeClientWithListAndApply[*v1beta1.CustomResourceDefinition, *v1beta1.CustomResourceDefinitionList, *apiextensionsv1beta1.CustomResourceDefinitionApplyConfiguration]
Fake *FakeApiextensionsV1beta1 Fake *FakeApiextensionsV1beta1
} }
var customresourcedefinitionsResource = v1beta1.SchemeGroupVersion.WithResource("customresourcedefinitions") func newFakeCustomResourceDefinitions(fake *FakeApiextensionsV1beta1) typedapiextensionsv1beta1.CustomResourceDefinitionInterface {
return &fakeCustomResourceDefinitions{
var customresourcedefinitionsKind = v1beta1.SchemeGroupVersion.WithKind("CustomResourceDefinition") gentype.NewFakeClientWithListAndApply[*v1beta1.CustomResourceDefinition, *v1beta1.CustomResourceDefinitionList, *apiextensionsv1beta1.CustomResourceDefinitionApplyConfiguration](
fake.Fake,
// Get takes name of the customResourceDefinition, and returns the corresponding customResourceDefinition object, and an error if there is any. "",
func (c *FakeCustomResourceDefinitions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.CustomResourceDefinition, err error) { v1beta1.SchemeGroupVersion.WithResource("customresourcedefinitions"),
emptyResult := &v1beta1.CustomResourceDefinition{} v1beta1.SchemeGroupVersion.WithKind("CustomResourceDefinition"),
obj, err := c.Fake. func() *v1beta1.CustomResourceDefinition { return &v1beta1.CustomResourceDefinition{} },
Invokes(testing.NewRootGetActionWithOptions(customresourcedefinitionsResource, name, options), emptyResult) func() *v1beta1.CustomResourceDefinitionList { return &v1beta1.CustomResourceDefinitionList{} },
if obj == nil { func(dst, src *v1beta1.CustomResourceDefinitionList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1beta1.CustomResourceDefinitionList) []*v1beta1.CustomResourceDefinition {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1beta1.CustomResourceDefinitionList, items []*v1beta1.CustomResourceDefinition) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta1.CustomResourceDefinition), err
}
// List takes label and field selectors, and returns the list of CustomResourceDefinitions that match those selectors.
func (c *FakeCustomResourceDefinitions) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.CustomResourceDefinitionList, err error) {
emptyResult := &v1beta1.CustomResourceDefinitionList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(customresourcedefinitionsResource, customresourcedefinitionsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.CustomResourceDefinitionList{ListMeta: obj.(*v1beta1.CustomResourceDefinitionList).ListMeta}
for _, item := range obj.(*v1beta1.CustomResourceDefinitionList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested customResourceDefinitions.
func (c *FakeCustomResourceDefinitions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(customresourcedefinitionsResource, opts))
}
// Create takes the representation of a customResourceDefinition and creates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any.
func (c *FakeCustomResourceDefinitions) Create(ctx context.Context, customResourceDefinition *v1beta1.CustomResourceDefinition, opts v1.CreateOptions) (result *v1beta1.CustomResourceDefinition, err error) {
emptyResult := &v1beta1.CustomResourceDefinition{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(customresourcedefinitionsResource, customResourceDefinition, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CustomResourceDefinition), err
}
// Update takes the representation of a customResourceDefinition and updates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any.
func (c *FakeCustomResourceDefinitions) Update(ctx context.Context, customResourceDefinition *v1beta1.CustomResourceDefinition, opts v1.UpdateOptions) (result *v1beta1.CustomResourceDefinition, err error) {
emptyResult := &v1beta1.CustomResourceDefinition{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(customresourcedefinitionsResource, customResourceDefinition, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CustomResourceDefinition), 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 *FakeCustomResourceDefinitions) UpdateStatus(ctx context.Context, customResourceDefinition *v1beta1.CustomResourceDefinition, opts v1.UpdateOptions) (result *v1beta1.CustomResourceDefinition, err error) {
emptyResult := &v1beta1.CustomResourceDefinition{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(customresourcedefinitionsResource, "status", customResourceDefinition, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CustomResourceDefinition), err
}
// Delete takes name of the customResourceDefinition and deletes it. Returns an error if one occurs.
func (c *FakeCustomResourceDefinitions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(customresourcedefinitionsResource, name, opts), &v1beta1.CustomResourceDefinition{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeCustomResourceDefinitions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(customresourcedefinitionsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.CustomResourceDefinitionList{})
return err
}
// Patch applies the patch and returns the patched customResourceDefinition.
func (c *FakeCustomResourceDefinitions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.CustomResourceDefinition, err error) {
emptyResult := &v1beta1.CustomResourceDefinition{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(customresourcedefinitionsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CustomResourceDefinition), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied customResourceDefinition.
func (c *FakeCustomResourceDefinitions) Apply(ctx context.Context, customResourceDefinition *apiextensionsv1beta1.CustomResourceDefinitionApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.CustomResourceDefinition, err error) {
if customResourceDefinition == nil {
return nil, fmt.Errorf("customResourceDefinition provided to Apply must not be nil")
}
data, err := json.Marshal(customResourceDefinition)
if err != nil {
return nil, err
}
name := customResourceDefinition.Name
if name == nil {
return nil, fmt.Errorf("customResourceDefinition.Name must be provided to Apply")
}
emptyResult := &v1beta1.CustomResourceDefinition{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(customresourcedefinitionsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CustomResourceDefinition), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeCustomResourceDefinitions) ApplyStatus(ctx context.Context, customResourceDefinition *apiextensionsv1beta1.CustomResourceDefinitionApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.CustomResourceDefinition, err error) {
if customResourceDefinition == nil {
return nil, fmt.Errorf("customResourceDefinition provided to Apply must not be nil")
}
data, err := json.Marshal(customResourceDefinition)
if err != nil {
return nil, err
}
name := customResourceDefinition.Name
if name == nil {
return nil, fmt.Errorf("customResourceDefinition.Name must be provided to Apply")
}
emptyResult := &v1beta1.CustomResourceDefinition{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(customresourcedefinitionsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CustomResourceDefinition), err
} }

View File

@@ -21,6 +21,7 @@ import (
json "encoding/json" json "encoding/json"
"fmt" "fmt"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
@@ -31,7 +32,7 @@ import (
) )
// FakeClient represents a fake client // FakeClient represents a fake client
type FakeClient[T objectWithMeta] struct { type FakeClient[T runtime.Object] struct {
*testing.Fake *testing.Fake
ns string ns string
resource schema.GroupVersionResource resource schema.GroupVersionResource
@@ -40,26 +41,26 @@ type FakeClient[T objectWithMeta] struct {
} }
// FakeClientWithList represents a fake client with support for lists. // FakeClientWithList represents a fake client with support for lists.
type FakeClientWithList[T objectWithMeta, L runtime.Object] struct { type FakeClientWithList[T runtime.Object, L runtime.Object] struct {
*FakeClient[T] *FakeClient[T]
alsoFakeLister[T, L] alsoFakeLister[T, L]
} }
// FakeClientWithApply represents a fake client with support for apply declarative configurations. // FakeClientWithApply represents a fake client with support for apply declarative configurations.
type FakeClientWithApply[T objectWithMeta, C namedObject] struct { type FakeClientWithApply[T runtime.Object, C namedObject] struct {
*FakeClient[T] *FakeClient[T]
alsoFakeApplier[T, C] alsoFakeApplier[T, C]
} }
// FakeClientWithListAndApply represents a fake client with support for lists and apply declarative configurations. // FakeClientWithListAndApply represents a fake client with support for lists and apply declarative configurations.
type FakeClientWithListAndApply[T objectWithMeta, L runtime.Object, C namedObject] struct { type FakeClientWithListAndApply[T runtime.Object, L runtime.Object, C namedObject] struct {
*FakeClient[T] *FakeClient[T]
alsoFakeLister[T, L] alsoFakeLister[T, L]
alsoFakeApplier[T, C] alsoFakeApplier[T, C]
} }
// Helper types for composition // Helper types for composition
type alsoFakeLister[T objectWithMeta, L runtime.Object] struct { type alsoFakeLister[T runtime.Object, L runtime.Object] struct {
client *FakeClient[T] client *FakeClient[T]
newList func() L newList func() L
copyListMeta func(L, L) copyListMeta func(L, L)
@@ -67,13 +68,13 @@ type alsoFakeLister[T objectWithMeta, L runtime.Object] struct {
setItems func(L, []T) setItems func(L, []T)
} }
type alsoFakeApplier[T objectWithMeta, C namedObject] struct { type alsoFakeApplier[T runtime.Object, C namedObject] struct {
client *FakeClient[T] client *FakeClient[T]
} }
// NewFakeClient constructs a fake client, namespaced or not, with no support for lists or apply. // NewFakeClient constructs a fake client, namespaced or not, with no support for lists or apply.
// Non-namespaced clients are constructed by passing an empty namespace (""). // Non-namespaced clients are constructed by passing an empty namespace ("").
func NewFakeClient[T objectWithMeta]( func NewFakeClient[T runtime.Object](
fake *testing.Fake, namespace string, resource schema.GroupVersionResource, kind schema.GroupVersionKind, emptyObjectCreator func() T, fake *testing.Fake, namespace string, resource schema.GroupVersionResource, kind schema.GroupVersionKind, emptyObjectCreator func() T,
) *FakeClient[T] { ) *FakeClient[T] {
return &FakeClient[T]{fake, namespace, resource, kind, emptyObjectCreator} return &FakeClient[T]{fake, namespace, resource, kind, emptyObjectCreator}
@@ -149,7 +150,7 @@ func FromPointerSlice[T any](src []*T) []T {
return result return result
} }
// List takes label and field selectors, and returns the list of ClusterRoles that match those selectors. // List takes label and field selectors, and returns the list of resources that match those selectors.
func (l *alsoFakeLister[T, L]) List(ctx context.Context, opts metav1.ListOptions) (result L, err error) { func (l *alsoFakeLister[T, L]) List(ctx context.Context, opts metav1.ListOptions) (result L, err error) {
emptyResult := l.newList() emptyResult := l.newList()
obj, err := l.client.Fake. obj, err := l.client.Fake.
@@ -160,13 +161,19 @@ func (l *alsoFakeLister[T, L]) List(ctx context.Context, opts metav1.ListOptions
label, _, _ := testing.ExtractFromListOptions(opts) label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil { if label == nil {
label = labels.Everything() // Everything matches
return obj.(L), nil
} }
list := l.newList() list := l.newList()
l.copyListMeta(list, obj.(L)) l.copyListMeta(list, obj.(L))
var items []T var items []T
for _, item := range l.getItems(obj.(L)) { for _, item := range l.getItems(obj.(L)) {
if label.Matches(labels.Set(item.GetLabels())) { itemMeta, err := meta.Accessor(item)
if err != nil {
// No ObjectMeta, nothing can match
continue
}
if label.Matches(labels.Set(itemMeta.GetLabels())) {
items = append(items, item) items = append(items, item)
} }
} }

View File

@@ -29,19 +29,19 @@ type FakeAdmissionregistrationV1 struct {
} }
func (c *FakeAdmissionregistrationV1) MutatingWebhookConfigurations() v1.MutatingWebhookConfigurationInterface { func (c *FakeAdmissionregistrationV1) MutatingWebhookConfigurations() v1.MutatingWebhookConfigurationInterface {
return &FakeMutatingWebhookConfigurations{c} return newFakeMutatingWebhookConfigurations(c)
} }
func (c *FakeAdmissionregistrationV1) ValidatingAdmissionPolicies() v1.ValidatingAdmissionPolicyInterface { func (c *FakeAdmissionregistrationV1) ValidatingAdmissionPolicies() v1.ValidatingAdmissionPolicyInterface {
return &FakeValidatingAdmissionPolicies{c} return newFakeValidatingAdmissionPolicies(c)
} }
func (c *FakeAdmissionregistrationV1) ValidatingAdmissionPolicyBindings() v1.ValidatingAdmissionPolicyBindingInterface { func (c *FakeAdmissionregistrationV1) ValidatingAdmissionPolicyBindings() v1.ValidatingAdmissionPolicyBindingInterface {
return &FakeValidatingAdmissionPolicyBindings{c} return newFakeValidatingAdmissionPolicyBindings(c)
} }
func (c *FakeAdmissionregistrationV1) ValidatingWebhookConfigurations() v1.ValidatingWebhookConfigurationInterface { func (c *FakeAdmissionregistrationV1) ValidatingWebhookConfigurations() v1.ValidatingWebhookConfigurationInterface {
return &FakeValidatingWebhookConfigurations{c} return newFakeValidatingWebhookConfigurations(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,133 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/admissionregistration/v1" v1 "k8s.io/api/admissionregistration/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1" admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
) )
// FakeMutatingWebhookConfigurations implements MutatingWebhookConfigurationInterface // fakeMutatingWebhookConfigurations implements MutatingWebhookConfigurationInterface
type FakeMutatingWebhookConfigurations struct { type fakeMutatingWebhookConfigurations struct {
*gentype.FakeClientWithListAndApply[*v1.MutatingWebhookConfiguration, *v1.MutatingWebhookConfigurationList, *admissionregistrationv1.MutatingWebhookConfigurationApplyConfiguration]
Fake *FakeAdmissionregistrationV1 Fake *FakeAdmissionregistrationV1
} }
var mutatingwebhookconfigurationsResource = v1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations") func newFakeMutatingWebhookConfigurations(fake *FakeAdmissionregistrationV1) typedadmissionregistrationv1.MutatingWebhookConfigurationInterface {
return &fakeMutatingWebhookConfigurations{
var mutatingwebhookconfigurationsKind = v1.SchemeGroupVersion.WithKind("MutatingWebhookConfiguration") gentype.NewFakeClientWithListAndApply[*v1.MutatingWebhookConfiguration, *v1.MutatingWebhookConfigurationList, *admissionregistrationv1.MutatingWebhookConfigurationApplyConfiguration](
fake.Fake,
// Get takes name of the mutatingWebhookConfiguration, and returns the corresponding mutatingWebhookConfiguration object, and an error if there is any. "",
func (c *FakeMutatingWebhookConfigurations) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.MutatingWebhookConfiguration, err error) { v1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"),
emptyResult := &v1.MutatingWebhookConfiguration{} v1.SchemeGroupVersion.WithKind("MutatingWebhookConfiguration"),
obj, err := c.Fake. func() *v1.MutatingWebhookConfiguration { return &v1.MutatingWebhookConfiguration{} },
Invokes(testing.NewRootGetActionWithOptions(mutatingwebhookconfigurationsResource, name, options), emptyResult) func() *v1.MutatingWebhookConfigurationList { return &v1.MutatingWebhookConfigurationList{} },
if obj == nil { func(dst, src *v1.MutatingWebhookConfigurationList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1.MutatingWebhookConfigurationList) []*v1.MutatingWebhookConfiguration {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1.MutatingWebhookConfigurationList, items []*v1.MutatingWebhookConfiguration) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.MutatingWebhookConfiguration), err
}
// List takes label and field selectors, and returns the list of MutatingWebhookConfigurations that match those selectors.
func (c *FakeMutatingWebhookConfigurations) List(ctx context.Context, opts metav1.ListOptions) (result *v1.MutatingWebhookConfigurationList, err error) {
emptyResult := &v1.MutatingWebhookConfigurationList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(mutatingwebhookconfigurationsResource, mutatingwebhookconfigurationsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.MutatingWebhookConfigurationList{ListMeta: obj.(*v1.MutatingWebhookConfigurationList).ListMeta}
for _, item := range obj.(*v1.MutatingWebhookConfigurationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested mutatingWebhookConfigurations.
func (c *FakeMutatingWebhookConfigurations) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(mutatingwebhookconfigurationsResource, opts))
}
// Create takes the representation of a mutatingWebhookConfiguration and creates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any.
func (c *FakeMutatingWebhookConfigurations) Create(ctx context.Context, mutatingWebhookConfiguration *v1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (result *v1.MutatingWebhookConfiguration, err error) {
emptyResult := &v1.MutatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(mutatingwebhookconfigurationsResource, mutatingWebhookConfiguration, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.MutatingWebhookConfiguration), err
}
// Update takes the representation of a mutatingWebhookConfiguration and updates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any.
func (c *FakeMutatingWebhookConfigurations) Update(ctx context.Context, mutatingWebhookConfiguration *v1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (result *v1.MutatingWebhookConfiguration, err error) {
emptyResult := &v1.MutatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(mutatingwebhookconfigurationsResource, mutatingWebhookConfiguration, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.MutatingWebhookConfiguration), err
}
// Delete takes name of the mutatingWebhookConfiguration and deletes it. Returns an error if one occurs.
func (c *FakeMutatingWebhookConfigurations) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(mutatingwebhookconfigurationsResource, name, opts), &v1.MutatingWebhookConfiguration{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeMutatingWebhookConfigurations) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(mutatingwebhookconfigurationsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.MutatingWebhookConfigurationList{})
return err
}
// Patch applies the patch and returns the patched mutatingWebhookConfiguration.
func (c *FakeMutatingWebhookConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.MutatingWebhookConfiguration, err error) {
emptyResult := &v1.MutatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(mutatingwebhookconfigurationsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.MutatingWebhookConfiguration), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied mutatingWebhookConfiguration.
func (c *FakeMutatingWebhookConfigurations) Apply(ctx context.Context, mutatingWebhookConfiguration *admissionregistrationv1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *v1.MutatingWebhookConfiguration, err error) {
if mutatingWebhookConfiguration == nil {
return nil, fmt.Errorf("mutatingWebhookConfiguration provided to Apply must not be nil")
}
data, err := json.Marshal(mutatingWebhookConfiguration)
if err != nil {
return nil, err
}
name := mutatingWebhookConfiguration.Name
if name == nil {
return nil, fmt.Errorf("mutatingWebhookConfiguration.Name must be provided to Apply")
}
emptyResult := &v1.MutatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(mutatingwebhookconfigurationsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.MutatingWebhookConfiguration), err
} }

View File

@@ -19,168 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/admissionregistration/v1" v1 "k8s.io/api/admissionregistration/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1" admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
) )
// FakeValidatingAdmissionPolicies implements ValidatingAdmissionPolicyInterface // fakeValidatingAdmissionPolicies implements ValidatingAdmissionPolicyInterface
type FakeValidatingAdmissionPolicies struct { type fakeValidatingAdmissionPolicies struct {
*gentype.FakeClientWithListAndApply[*v1.ValidatingAdmissionPolicy, *v1.ValidatingAdmissionPolicyList, *admissionregistrationv1.ValidatingAdmissionPolicyApplyConfiguration]
Fake *FakeAdmissionregistrationV1 Fake *FakeAdmissionregistrationV1
} }
var validatingadmissionpoliciesResource = v1.SchemeGroupVersion.WithResource("validatingadmissionpolicies") func newFakeValidatingAdmissionPolicies(fake *FakeAdmissionregistrationV1) typedadmissionregistrationv1.ValidatingAdmissionPolicyInterface {
return &fakeValidatingAdmissionPolicies{
var validatingadmissionpoliciesKind = v1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicy") gentype.NewFakeClientWithListAndApply[*v1.ValidatingAdmissionPolicy, *v1.ValidatingAdmissionPolicyList, *admissionregistrationv1.ValidatingAdmissionPolicyApplyConfiguration](
fake.Fake,
// Get takes name of the validatingAdmissionPolicy, and returns the corresponding validatingAdmissionPolicy object, and an error if there is any. "",
func (c *FakeValidatingAdmissionPolicies) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ValidatingAdmissionPolicy, err error) { v1.SchemeGroupVersion.WithResource("validatingadmissionpolicies"),
emptyResult := &v1.ValidatingAdmissionPolicy{} v1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicy"),
obj, err := c.Fake. func() *v1.ValidatingAdmissionPolicy { return &v1.ValidatingAdmissionPolicy{} },
Invokes(testing.NewRootGetActionWithOptions(validatingadmissionpoliciesResource, name, options), emptyResult) func() *v1.ValidatingAdmissionPolicyList { return &v1.ValidatingAdmissionPolicyList{} },
if obj == nil { func(dst, src *v1.ValidatingAdmissionPolicyList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1.ValidatingAdmissionPolicyList) []*v1.ValidatingAdmissionPolicy {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1.ValidatingAdmissionPolicyList, items []*v1.ValidatingAdmissionPolicy) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.ValidatingAdmissionPolicy), err
}
// List takes label and field selectors, and returns the list of ValidatingAdmissionPolicies that match those selectors.
func (c *FakeValidatingAdmissionPolicies) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ValidatingAdmissionPolicyList, err error) {
emptyResult := &v1.ValidatingAdmissionPolicyList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(validatingadmissionpoliciesResource, validatingadmissionpoliciesKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ValidatingAdmissionPolicyList{ListMeta: obj.(*v1.ValidatingAdmissionPolicyList).ListMeta}
for _, item := range obj.(*v1.ValidatingAdmissionPolicyList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested validatingAdmissionPolicies.
func (c *FakeValidatingAdmissionPolicies) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(validatingadmissionpoliciesResource, opts))
}
// Create takes the representation of a validatingAdmissionPolicy and creates it. Returns the server's representation of the validatingAdmissionPolicy, and an error, if there is any.
func (c *FakeValidatingAdmissionPolicies) Create(ctx context.Context, validatingAdmissionPolicy *v1.ValidatingAdmissionPolicy, opts metav1.CreateOptions) (result *v1.ValidatingAdmissionPolicy, err error) {
emptyResult := &v1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(validatingadmissionpoliciesResource, validatingAdmissionPolicy, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingAdmissionPolicy), err
}
// Update takes the representation of a validatingAdmissionPolicy and updates it. Returns the server's representation of the validatingAdmissionPolicy, and an error, if there is any.
func (c *FakeValidatingAdmissionPolicies) Update(ctx context.Context, validatingAdmissionPolicy *v1.ValidatingAdmissionPolicy, opts metav1.UpdateOptions) (result *v1.ValidatingAdmissionPolicy, err error) {
emptyResult := &v1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(validatingadmissionpoliciesResource, validatingAdmissionPolicy, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingAdmissionPolicy), 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 *FakeValidatingAdmissionPolicies) UpdateStatus(ctx context.Context, validatingAdmissionPolicy *v1.ValidatingAdmissionPolicy, opts metav1.UpdateOptions) (result *v1.ValidatingAdmissionPolicy, err error) {
emptyResult := &v1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(validatingadmissionpoliciesResource, "status", validatingAdmissionPolicy, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingAdmissionPolicy), err
}
// Delete takes name of the validatingAdmissionPolicy and deletes it. Returns an error if one occurs.
func (c *FakeValidatingAdmissionPolicies) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(validatingadmissionpoliciesResource, name, opts), &v1.ValidatingAdmissionPolicy{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeValidatingAdmissionPolicies) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(validatingadmissionpoliciesResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.ValidatingAdmissionPolicyList{})
return err
}
// Patch applies the patch and returns the patched validatingAdmissionPolicy.
func (c *FakeValidatingAdmissionPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ValidatingAdmissionPolicy, err error) {
emptyResult := &v1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpoliciesResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingAdmissionPolicy), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied validatingAdmissionPolicy.
func (c *FakeValidatingAdmissionPolicies) Apply(ctx context.Context, validatingAdmissionPolicy *admissionregistrationv1.ValidatingAdmissionPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ValidatingAdmissionPolicy, err error) {
if validatingAdmissionPolicy == nil {
return nil, fmt.Errorf("validatingAdmissionPolicy provided to Apply must not be nil")
}
data, err := json.Marshal(validatingAdmissionPolicy)
if err != nil {
return nil, err
}
name := validatingAdmissionPolicy.Name
if name == nil {
return nil, fmt.Errorf("validatingAdmissionPolicy.Name must be provided to Apply")
}
emptyResult := &v1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpoliciesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingAdmissionPolicy), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeValidatingAdmissionPolicies) ApplyStatus(ctx context.Context, validatingAdmissionPolicy *admissionregistrationv1.ValidatingAdmissionPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ValidatingAdmissionPolicy, err error) {
if validatingAdmissionPolicy == nil {
return nil, fmt.Errorf("validatingAdmissionPolicy provided to Apply must not be nil")
}
data, err := json.Marshal(validatingAdmissionPolicy)
if err != nil {
return nil, err
}
name := validatingAdmissionPolicy.Name
if name == nil {
return nil, fmt.Errorf("validatingAdmissionPolicy.Name must be provided to Apply")
}
emptyResult := &v1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpoliciesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingAdmissionPolicy), err
} }

View File

@@ -19,133 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/admissionregistration/v1" v1 "k8s.io/api/admissionregistration/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1" admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
) )
// FakeValidatingAdmissionPolicyBindings implements ValidatingAdmissionPolicyBindingInterface // fakeValidatingAdmissionPolicyBindings implements ValidatingAdmissionPolicyBindingInterface
type FakeValidatingAdmissionPolicyBindings struct { type fakeValidatingAdmissionPolicyBindings struct {
*gentype.FakeClientWithListAndApply[*v1.ValidatingAdmissionPolicyBinding, *v1.ValidatingAdmissionPolicyBindingList, *admissionregistrationv1.ValidatingAdmissionPolicyBindingApplyConfiguration]
Fake *FakeAdmissionregistrationV1 Fake *FakeAdmissionregistrationV1
} }
var validatingadmissionpolicybindingsResource = v1.SchemeGroupVersion.WithResource("validatingadmissionpolicybindings") func newFakeValidatingAdmissionPolicyBindings(fake *FakeAdmissionregistrationV1) typedadmissionregistrationv1.ValidatingAdmissionPolicyBindingInterface {
return &fakeValidatingAdmissionPolicyBindings{
var validatingadmissionpolicybindingsKind = v1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicyBinding") gentype.NewFakeClientWithListAndApply[*v1.ValidatingAdmissionPolicyBinding, *v1.ValidatingAdmissionPolicyBindingList, *admissionregistrationv1.ValidatingAdmissionPolicyBindingApplyConfiguration](
fake.Fake,
// Get takes name of the validatingAdmissionPolicyBinding, and returns the corresponding validatingAdmissionPolicyBinding object, and an error if there is any. "",
func (c *FakeValidatingAdmissionPolicyBindings) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ValidatingAdmissionPolicyBinding, err error) { v1.SchemeGroupVersion.WithResource("validatingadmissionpolicybindings"),
emptyResult := &v1.ValidatingAdmissionPolicyBinding{} v1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicyBinding"),
obj, err := c.Fake. func() *v1.ValidatingAdmissionPolicyBinding { return &v1.ValidatingAdmissionPolicyBinding{} },
Invokes(testing.NewRootGetActionWithOptions(validatingadmissionpolicybindingsResource, name, options), emptyResult) func() *v1.ValidatingAdmissionPolicyBindingList { return &v1.ValidatingAdmissionPolicyBindingList{} },
if obj == nil { func(dst, src *v1.ValidatingAdmissionPolicyBindingList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1.ValidatingAdmissionPolicyBindingList) []*v1.ValidatingAdmissionPolicyBinding {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1.ValidatingAdmissionPolicyBindingList, items []*v1.ValidatingAdmissionPolicyBinding) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.ValidatingAdmissionPolicyBinding), err
}
// List takes label and field selectors, and returns the list of ValidatingAdmissionPolicyBindings that match those selectors.
func (c *FakeValidatingAdmissionPolicyBindings) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ValidatingAdmissionPolicyBindingList, err error) {
emptyResult := &v1.ValidatingAdmissionPolicyBindingList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(validatingadmissionpolicybindingsResource, validatingadmissionpolicybindingsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ValidatingAdmissionPolicyBindingList{ListMeta: obj.(*v1.ValidatingAdmissionPolicyBindingList).ListMeta}
for _, item := range obj.(*v1.ValidatingAdmissionPolicyBindingList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested validatingAdmissionPolicyBindings.
func (c *FakeValidatingAdmissionPolicyBindings) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(validatingadmissionpolicybindingsResource, opts))
}
// Create takes the representation of a validatingAdmissionPolicyBinding and creates it. Returns the server's representation of the validatingAdmissionPolicyBinding, and an error, if there is any.
func (c *FakeValidatingAdmissionPolicyBindings) Create(ctx context.Context, validatingAdmissionPolicyBinding *v1.ValidatingAdmissionPolicyBinding, opts metav1.CreateOptions) (result *v1.ValidatingAdmissionPolicyBinding, err error) {
emptyResult := &v1.ValidatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(validatingadmissionpolicybindingsResource, validatingAdmissionPolicyBinding, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingAdmissionPolicyBinding), err
}
// Update takes the representation of a validatingAdmissionPolicyBinding and updates it. Returns the server's representation of the validatingAdmissionPolicyBinding, and an error, if there is any.
func (c *FakeValidatingAdmissionPolicyBindings) Update(ctx context.Context, validatingAdmissionPolicyBinding *v1.ValidatingAdmissionPolicyBinding, opts metav1.UpdateOptions) (result *v1.ValidatingAdmissionPolicyBinding, err error) {
emptyResult := &v1.ValidatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(validatingadmissionpolicybindingsResource, validatingAdmissionPolicyBinding, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingAdmissionPolicyBinding), err
}
// Delete takes name of the validatingAdmissionPolicyBinding and deletes it. Returns an error if one occurs.
func (c *FakeValidatingAdmissionPolicyBindings) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(validatingadmissionpolicybindingsResource, name, opts), &v1.ValidatingAdmissionPolicyBinding{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeValidatingAdmissionPolicyBindings) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(validatingadmissionpolicybindingsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.ValidatingAdmissionPolicyBindingList{})
return err
}
// Patch applies the patch and returns the patched validatingAdmissionPolicyBinding.
func (c *FakeValidatingAdmissionPolicyBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ValidatingAdmissionPolicyBinding, err error) {
emptyResult := &v1.ValidatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpolicybindingsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingAdmissionPolicyBinding), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied validatingAdmissionPolicyBinding.
func (c *FakeValidatingAdmissionPolicyBindings) Apply(ctx context.Context, validatingAdmissionPolicyBinding *admissionregistrationv1.ValidatingAdmissionPolicyBindingApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ValidatingAdmissionPolicyBinding, err error) {
if validatingAdmissionPolicyBinding == nil {
return nil, fmt.Errorf("validatingAdmissionPolicyBinding provided to Apply must not be nil")
}
data, err := json.Marshal(validatingAdmissionPolicyBinding)
if err != nil {
return nil, err
}
name := validatingAdmissionPolicyBinding.Name
if name == nil {
return nil, fmt.Errorf("validatingAdmissionPolicyBinding.Name must be provided to Apply")
}
emptyResult := &v1.ValidatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpolicybindingsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingAdmissionPolicyBinding), err
} }

View File

@@ -19,133 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/admissionregistration/v1" v1 "k8s.io/api/admissionregistration/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1" admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
) )
// FakeValidatingWebhookConfigurations implements ValidatingWebhookConfigurationInterface // fakeValidatingWebhookConfigurations implements ValidatingWebhookConfigurationInterface
type FakeValidatingWebhookConfigurations struct { type fakeValidatingWebhookConfigurations struct {
*gentype.FakeClientWithListAndApply[*v1.ValidatingWebhookConfiguration, *v1.ValidatingWebhookConfigurationList, *admissionregistrationv1.ValidatingWebhookConfigurationApplyConfiguration]
Fake *FakeAdmissionregistrationV1 Fake *FakeAdmissionregistrationV1
} }
var validatingwebhookconfigurationsResource = v1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations") func newFakeValidatingWebhookConfigurations(fake *FakeAdmissionregistrationV1) typedadmissionregistrationv1.ValidatingWebhookConfigurationInterface {
return &fakeValidatingWebhookConfigurations{
var validatingwebhookconfigurationsKind = v1.SchemeGroupVersion.WithKind("ValidatingWebhookConfiguration") gentype.NewFakeClientWithListAndApply[*v1.ValidatingWebhookConfiguration, *v1.ValidatingWebhookConfigurationList, *admissionregistrationv1.ValidatingWebhookConfigurationApplyConfiguration](
fake.Fake,
// Get takes name of the validatingWebhookConfiguration, and returns the corresponding validatingWebhookConfiguration object, and an error if there is any. "",
func (c *FakeValidatingWebhookConfigurations) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ValidatingWebhookConfiguration, err error) { v1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations"),
emptyResult := &v1.ValidatingWebhookConfiguration{} v1.SchemeGroupVersion.WithKind("ValidatingWebhookConfiguration"),
obj, err := c.Fake. func() *v1.ValidatingWebhookConfiguration { return &v1.ValidatingWebhookConfiguration{} },
Invokes(testing.NewRootGetActionWithOptions(validatingwebhookconfigurationsResource, name, options), emptyResult) func() *v1.ValidatingWebhookConfigurationList { return &v1.ValidatingWebhookConfigurationList{} },
if obj == nil { func(dst, src *v1.ValidatingWebhookConfigurationList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1.ValidatingWebhookConfigurationList) []*v1.ValidatingWebhookConfiguration {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1.ValidatingWebhookConfigurationList, items []*v1.ValidatingWebhookConfiguration) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.ValidatingWebhookConfiguration), err
}
// List takes label and field selectors, and returns the list of ValidatingWebhookConfigurations that match those selectors.
func (c *FakeValidatingWebhookConfigurations) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ValidatingWebhookConfigurationList, err error) {
emptyResult := &v1.ValidatingWebhookConfigurationList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(validatingwebhookconfigurationsResource, validatingwebhookconfigurationsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ValidatingWebhookConfigurationList{ListMeta: obj.(*v1.ValidatingWebhookConfigurationList).ListMeta}
for _, item := range obj.(*v1.ValidatingWebhookConfigurationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested validatingWebhookConfigurations.
func (c *FakeValidatingWebhookConfigurations) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(validatingwebhookconfigurationsResource, opts))
}
// Create takes the representation of a validatingWebhookConfiguration and creates it. Returns the server's representation of the validatingWebhookConfiguration, and an error, if there is any.
func (c *FakeValidatingWebhookConfigurations) Create(ctx context.Context, validatingWebhookConfiguration *v1.ValidatingWebhookConfiguration, opts metav1.CreateOptions) (result *v1.ValidatingWebhookConfiguration, err error) {
emptyResult := &v1.ValidatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(validatingwebhookconfigurationsResource, validatingWebhookConfiguration, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingWebhookConfiguration), err
}
// Update takes the representation of a validatingWebhookConfiguration and updates it. Returns the server's representation of the validatingWebhookConfiguration, and an error, if there is any.
func (c *FakeValidatingWebhookConfigurations) Update(ctx context.Context, validatingWebhookConfiguration *v1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (result *v1.ValidatingWebhookConfiguration, err error) {
emptyResult := &v1.ValidatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(validatingwebhookconfigurationsResource, validatingWebhookConfiguration, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingWebhookConfiguration), err
}
// Delete takes name of the validatingWebhookConfiguration and deletes it. Returns an error if one occurs.
func (c *FakeValidatingWebhookConfigurations) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(validatingwebhookconfigurationsResource, name, opts), &v1.ValidatingWebhookConfiguration{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeValidatingWebhookConfigurations) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(validatingwebhookconfigurationsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.ValidatingWebhookConfigurationList{})
return err
}
// Patch applies the patch and returns the patched validatingWebhookConfiguration.
func (c *FakeValidatingWebhookConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ValidatingWebhookConfiguration, err error) {
emptyResult := &v1.ValidatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingwebhookconfigurationsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingWebhookConfiguration), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied validatingWebhookConfiguration.
func (c *FakeValidatingWebhookConfigurations) Apply(ctx context.Context, validatingWebhookConfiguration *admissionregistrationv1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ValidatingWebhookConfiguration, err error) {
if validatingWebhookConfiguration == nil {
return nil, fmt.Errorf("validatingWebhookConfiguration provided to Apply must not be nil")
}
data, err := json.Marshal(validatingWebhookConfiguration)
if err != nil {
return nil, err
}
name := validatingWebhookConfiguration.Name
if name == nil {
return nil, fmt.Errorf("validatingWebhookConfiguration.Name must be provided to Apply")
}
emptyResult := &v1.ValidatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingwebhookconfigurationsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ValidatingWebhookConfiguration), err
} }

View File

@@ -29,19 +29,19 @@ type FakeAdmissionregistrationV1alpha1 struct {
} }
func (c *FakeAdmissionregistrationV1alpha1) MutatingAdmissionPolicies() v1alpha1.MutatingAdmissionPolicyInterface { func (c *FakeAdmissionregistrationV1alpha1) MutatingAdmissionPolicies() v1alpha1.MutatingAdmissionPolicyInterface {
return &FakeMutatingAdmissionPolicies{c} return newFakeMutatingAdmissionPolicies(c)
} }
func (c *FakeAdmissionregistrationV1alpha1) MutatingAdmissionPolicyBindings() v1alpha1.MutatingAdmissionPolicyBindingInterface { func (c *FakeAdmissionregistrationV1alpha1) MutatingAdmissionPolicyBindings() v1alpha1.MutatingAdmissionPolicyBindingInterface {
return &FakeMutatingAdmissionPolicyBindings{c} return newFakeMutatingAdmissionPolicyBindings(c)
} }
func (c *FakeAdmissionregistrationV1alpha1) ValidatingAdmissionPolicies() v1alpha1.ValidatingAdmissionPolicyInterface { func (c *FakeAdmissionregistrationV1alpha1) ValidatingAdmissionPolicies() v1alpha1.ValidatingAdmissionPolicyInterface {
return &FakeValidatingAdmissionPolicies{c} return newFakeValidatingAdmissionPolicies(c)
} }
func (c *FakeAdmissionregistrationV1alpha1) ValidatingAdmissionPolicyBindings() v1alpha1.ValidatingAdmissionPolicyBindingInterface { func (c *FakeAdmissionregistrationV1alpha1) ValidatingAdmissionPolicyBindings() v1alpha1.ValidatingAdmissionPolicyBindingInterface {
return &FakeValidatingAdmissionPolicyBindings{c} return newFakeValidatingAdmissionPolicyBindings(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,133 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1alpha1 "k8s.io/api/admissionregistration/v1alpha1" v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1" admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedadmissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
) )
// FakeMutatingAdmissionPolicies implements MutatingAdmissionPolicyInterface // fakeMutatingAdmissionPolicies implements MutatingAdmissionPolicyInterface
type FakeMutatingAdmissionPolicies struct { type fakeMutatingAdmissionPolicies struct {
*gentype.FakeClientWithListAndApply[*v1alpha1.MutatingAdmissionPolicy, *v1alpha1.MutatingAdmissionPolicyList, *admissionregistrationv1alpha1.MutatingAdmissionPolicyApplyConfiguration]
Fake *FakeAdmissionregistrationV1alpha1 Fake *FakeAdmissionregistrationV1alpha1
} }
var mutatingadmissionpoliciesResource = v1alpha1.SchemeGroupVersion.WithResource("mutatingadmissionpolicies") func newFakeMutatingAdmissionPolicies(fake *FakeAdmissionregistrationV1alpha1) typedadmissionregistrationv1alpha1.MutatingAdmissionPolicyInterface {
return &fakeMutatingAdmissionPolicies{
var mutatingadmissionpoliciesKind = v1alpha1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicy") gentype.NewFakeClientWithListAndApply[*v1alpha1.MutatingAdmissionPolicy, *v1alpha1.MutatingAdmissionPolicyList, *admissionregistrationv1alpha1.MutatingAdmissionPolicyApplyConfiguration](
fake.Fake,
// Get takes name of the mutatingAdmissionPolicy, and returns the corresponding mutatingAdmissionPolicy object, and an error if there is any. "",
func (c *FakeMutatingAdmissionPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MutatingAdmissionPolicy, err error) { v1alpha1.SchemeGroupVersion.WithResource("mutatingadmissionpolicies"),
emptyResult := &v1alpha1.MutatingAdmissionPolicy{} v1alpha1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicy"),
obj, err := c.Fake. func() *v1alpha1.MutatingAdmissionPolicy { return &v1alpha1.MutatingAdmissionPolicy{} },
Invokes(testing.NewRootGetActionWithOptions(mutatingadmissionpoliciesResource, name, options), emptyResult) func() *v1alpha1.MutatingAdmissionPolicyList { return &v1alpha1.MutatingAdmissionPolicyList{} },
if obj == nil { func(dst, src *v1alpha1.MutatingAdmissionPolicyList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1alpha1.MutatingAdmissionPolicyList) []*v1alpha1.MutatingAdmissionPolicy {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1alpha1.MutatingAdmissionPolicyList, items []*v1alpha1.MutatingAdmissionPolicy) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1alpha1.MutatingAdmissionPolicy), err
}
// List takes label and field selectors, and returns the list of MutatingAdmissionPolicies that match those selectors.
func (c *FakeMutatingAdmissionPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MutatingAdmissionPolicyList, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicyList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(mutatingadmissionpoliciesResource, mutatingadmissionpoliciesKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.MutatingAdmissionPolicyList{ListMeta: obj.(*v1alpha1.MutatingAdmissionPolicyList).ListMeta}
for _, item := range obj.(*v1alpha1.MutatingAdmissionPolicyList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested mutatingAdmissionPolicies.
func (c *FakeMutatingAdmissionPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(mutatingadmissionpoliciesResource, opts))
}
// Create takes the representation of a mutatingAdmissionPolicy and creates it. Returns the server's representation of the mutatingAdmissionPolicy, and an error, if there is any.
func (c *FakeMutatingAdmissionPolicies) Create(ctx context.Context, mutatingAdmissionPolicy *v1alpha1.MutatingAdmissionPolicy, opts v1.CreateOptions) (result *v1alpha1.MutatingAdmissionPolicy, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(mutatingadmissionpoliciesResource, mutatingAdmissionPolicy, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicy), err
}
// Update takes the representation of a mutatingAdmissionPolicy and updates it. Returns the server's representation of the mutatingAdmissionPolicy, and an error, if there is any.
func (c *FakeMutatingAdmissionPolicies) Update(ctx context.Context, mutatingAdmissionPolicy *v1alpha1.MutatingAdmissionPolicy, opts v1.UpdateOptions) (result *v1alpha1.MutatingAdmissionPolicy, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(mutatingadmissionpoliciesResource, mutatingAdmissionPolicy, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicy), err
}
// Delete takes name of the mutatingAdmissionPolicy and deletes it. Returns an error if one occurs.
func (c *FakeMutatingAdmissionPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(mutatingadmissionpoliciesResource, name, opts), &v1alpha1.MutatingAdmissionPolicy{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeMutatingAdmissionPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(mutatingadmissionpoliciesResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.MutatingAdmissionPolicyList{})
return err
}
// Patch applies the patch and returns the patched mutatingAdmissionPolicy.
func (c *FakeMutatingAdmissionPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MutatingAdmissionPolicy, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(mutatingadmissionpoliciesResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicy), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied mutatingAdmissionPolicy.
func (c *FakeMutatingAdmissionPolicies) Apply(ctx context.Context, mutatingAdmissionPolicy *admissionregistrationv1alpha1.MutatingAdmissionPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MutatingAdmissionPolicy, err error) {
if mutatingAdmissionPolicy == nil {
return nil, fmt.Errorf("mutatingAdmissionPolicy provided to Apply must not be nil")
}
data, err := json.Marshal(mutatingAdmissionPolicy)
if err != nil {
return nil, err
}
name := mutatingAdmissionPolicy.Name
if name == nil {
return nil, fmt.Errorf("mutatingAdmissionPolicy.Name must be provided to Apply")
}
emptyResult := &v1alpha1.MutatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(mutatingadmissionpoliciesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicy), err
} }

View File

@@ -19,133 +19,37 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1alpha1 "k8s.io/api/admissionregistration/v1alpha1" v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1" admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedadmissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
) )
// FakeMutatingAdmissionPolicyBindings implements MutatingAdmissionPolicyBindingInterface // fakeMutatingAdmissionPolicyBindings implements MutatingAdmissionPolicyBindingInterface
type FakeMutatingAdmissionPolicyBindings struct { type fakeMutatingAdmissionPolicyBindings struct {
*gentype.FakeClientWithListAndApply[*v1alpha1.MutatingAdmissionPolicyBinding, *v1alpha1.MutatingAdmissionPolicyBindingList, *admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingApplyConfiguration]
Fake *FakeAdmissionregistrationV1alpha1 Fake *FakeAdmissionregistrationV1alpha1
} }
var mutatingadmissionpolicybindingsResource = v1alpha1.SchemeGroupVersion.WithResource("mutatingadmissionpolicybindings") func newFakeMutatingAdmissionPolicyBindings(fake *FakeAdmissionregistrationV1alpha1) typedadmissionregistrationv1alpha1.MutatingAdmissionPolicyBindingInterface {
return &fakeMutatingAdmissionPolicyBindings{
var mutatingadmissionpolicybindingsKind = v1alpha1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicyBinding") gentype.NewFakeClientWithListAndApply[*v1alpha1.MutatingAdmissionPolicyBinding, *v1alpha1.MutatingAdmissionPolicyBindingList, *admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingApplyConfiguration](
fake.Fake,
// Get takes name of the mutatingAdmissionPolicyBinding, and returns the corresponding mutatingAdmissionPolicyBinding object, and an error if there is any. "",
func (c *FakeMutatingAdmissionPolicyBindings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MutatingAdmissionPolicyBinding, err error) { v1alpha1.SchemeGroupVersion.WithResource("mutatingadmissionpolicybindings"),
emptyResult := &v1alpha1.MutatingAdmissionPolicyBinding{} v1alpha1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicyBinding"),
obj, err := c.Fake. func() *v1alpha1.MutatingAdmissionPolicyBinding { return &v1alpha1.MutatingAdmissionPolicyBinding{} },
Invokes(testing.NewRootGetActionWithOptions(mutatingadmissionpolicybindingsResource, name, options), emptyResult) func() *v1alpha1.MutatingAdmissionPolicyBindingList {
if obj == nil { return &v1alpha1.MutatingAdmissionPolicyBindingList{}
return emptyResult, err },
func(dst, src *v1alpha1.MutatingAdmissionPolicyBindingList) { dst.ListMeta = src.ListMeta },
func(list *v1alpha1.MutatingAdmissionPolicyBindingList) []*v1alpha1.MutatingAdmissionPolicyBinding {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1alpha1.MutatingAdmissionPolicyBindingList, items []*v1alpha1.MutatingAdmissionPolicyBinding) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1alpha1.MutatingAdmissionPolicyBinding), err
}
// List takes label and field selectors, and returns the list of MutatingAdmissionPolicyBindings that match those selectors.
func (c *FakeMutatingAdmissionPolicyBindings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MutatingAdmissionPolicyBindingList, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicyBindingList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(mutatingadmissionpolicybindingsResource, mutatingadmissionpolicybindingsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.MutatingAdmissionPolicyBindingList{ListMeta: obj.(*v1alpha1.MutatingAdmissionPolicyBindingList).ListMeta}
for _, item := range obj.(*v1alpha1.MutatingAdmissionPolicyBindingList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested mutatingAdmissionPolicyBindings.
func (c *FakeMutatingAdmissionPolicyBindings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(mutatingadmissionpolicybindingsResource, opts))
}
// Create takes the representation of a mutatingAdmissionPolicyBinding and creates it. Returns the server's representation of the mutatingAdmissionPolicyBinding, and an error, if there is any.
func (c *FakeMutatingAdmissionPolicyBindings) Create(ctx context.Context, mutatingAdmissionPolicyBinding *v1alpha1.MutatingAdmissionPolicyBinding, opts v1.CreateOptions) (result *v1alpha1.MutatingAdmissionPolicyBinding, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(mutatingadmissionpolicybindingsResource, mutatingAdmissionPolicyBinding, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicyBinding), err
}
// Update takes the representation of a mutatingAdmissionPolicyBinding and updates it. Returns the server's representation of the mutatingAdmissionPolicyBinding, and an error, if there is any.
func (c *FakeMutatingAdmissionPolicyBindings) Update(ctx context.Context, mutatingAdmissionPolicyBinding *v1alpha1.MutatingAdmissionPolicyBinding, opts v1.UpdateOptions) (result *v1alpha1.MutatingAdmissionPolicyBinding, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(mutatingadmissionpolicybindingsResource, mutatingAdmissionPolicyBinding, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicyBinding), err
}
// Delete takes name of the mutatingAdmissionPolicyBinding and deletes it. Returns an error if one occurs.
func (c *FakeMutatingAdmissionPolicyBindings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(mutatingadmissionpolicybindingsResource, name, opts), &v1alpha1.MutatingAdmissionPolicyBinding{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeMutatingAdmissionPolicyBindings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(mutatingadmissionpolicybindingsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.MutatingAdmissionPolicyBindingList{})
return err
}
// Patch applies the patch and returns the patched mutatingAdmissionPolicyBinding.
func (c *FakeMutatingAdmissionPolicyBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MutatingAdmissionPolicyBinding, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(mutatingadmissionpolicybindingsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicyBinding), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied mutatingAdmissionPolicyBinding.
func (c *FakeMutatingAdmissionPolicyBindings) Apply(ctx context.Context, mutatingAdmissionPolicyBinding *admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MutatingAdmissionPolicyBinding, err error) {
if mutatingAdmissionPolicyBinding == nil {
return nil, fmt.Errorf("mutatingAdmissionPolicyBinding provided to Apply must not be nil")
}
data, err := json.Marshal(mutatingAdmissionPolicyBinding)
if err != nil {
return nil, err
}
name := mutatingAdmissionPolicyBinding.Name
if name == nil {
return nil, fmt.Errorf("mutatingAdmissionPolicyBinding.Name must be provided to Apply")
}
emptyResult := &v1alpha1.MutatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(mutatingadmissionpolicybindingsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicyBinding), err
} }

View File

@@ -19,168 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1alpha1 "k8s.io/api/admissionregistration/v1alpha1" v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1" admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedadmissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
) )
// FakeValidatingAdmissionPolicies implements ValidatingAdmissionPolicyInterface // fakeValidatingAdmissionPolicies implements ValidatingAdmissionPolicyInterface
type FakeValidatingAdmissionPolicies struct { type fakeValidatingAdmissionPolicies struct {
*gentype.FakeClientWithListAndApply[*v1alpha1.ValidatingAdmissionPolicy, *v1alpha1.ValidatingAdmissionPolicyList, *admissionregistrationv1alpha1.ValidatingAdmissionPolicyApplyConfiguration]
Fake *FakeAdmissionregistrationV1alpha1 Fake *FakeAdmissionregistrationV1alpha1
} }
var validatingadmissionpoliciesResource = v1alpha1.SchemeGroupVersion.WithResource("validatingadmissionpolicies") func newFakeValidatingAdmissionPolicies(fake *FakeAdmissionregistrationV1alpha1) typedadmissionregistrationv1alpha1.ValidatingAdmissionPolicyInterface {
return &fakeValidatingAdmissionPolicies{
var validatingadmissionpoliciesKind = v1alpha1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicy") gentype.NewFakeClientWithListAndApply[*v1alpha1.ValidatingAdmissionPolicy, *v1alpha1.ValidatingAdmissionPolicyList, *admissionregistrationv1alpha1.ValidatingAdmissionPolicyApplyConfiguration](
fake.Fake,
// Get takes name of the validatingAdmissionPolicy, and returns the corresponding validatingAdmissionPolicy object, and an error if there is any. "",
func (c *FakeValidatingAdmissionPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ValidatingAdmissionPolicy, err error) { v1alpha1.SchemeGroupVersion.WithResource("validatingadmissionpolicies"),
emptyResult := &v1alpha1.ValidatingAdmissionPolicy{} v1alpha1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicy"),
obj, err := c.Fake. func() *v1alpha1.ValidatingAdmissionPolicy { return &v1alpha1.ValidatingAdmissionPolicy{} },
Invokes(testing.NewRootGetActionWithOptions(validatingadmissionpoliciesResource, name, options), emptyResult) func() *v1alpha1.ValidatingAdmissionPolicyList { return &v1alpha1.ValidatingAdmissionPolicyList{} },
if obj == nil { func(dst, src *v1alpha1.ValidatingAdmissionPolicyList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1alpha1.ValidatingAdmissionPolicyList) []*v1alpha1.ValidatingAdmissionPolicy {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1alpha1.ValidatingAdmissionPolicyList, items []*v1alpha1.ValidatingAdmissionPolicy) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1alpha1.ValidatingAdmissionPolicy), err
}
// List takes label and field selectors, and returns the list of ValidatingAdmissionPolicies that match those selectors.
func (c *FakeValidatingAdmissionPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ValidatingAdmissionPolicyList, err error) {
emptyResult := &v1alpha1.ValidatingAdmissionPolicyList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(validatingadmissionpoliciesResource, validatingadmissionpoliciesKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ValidatingAdmissionPolicyList{ListMeta: obj.(*v1alpha1.ValidatingAdmissionPolicyList).ListMeta}
for _, item := range obj.(*v1alpha1.ValidatingAdmissionPolicyList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested validatingAdmissionPolicies.
func (c *FakeValidatingAdmissionPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(validatingadmissionpoliciesResource, opts))
}
// Create takes the representation of a validatingAdmissionPolicy and creates it. Returns the server's representation of the validatingAdmissionPolicy, and an error, if there is any.
func (c *FakeValidatingAdmissionPolicies) Create(ctx context.Context, validatingAdmissionPolicy *v1alpha1.ValidatingAdmissionPolicy, opts v1.CreateOptions) (result *v1alpha1.ValidatingAdmissionPolicy, err error) {
emptyResult := &v1alpha1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(validatingadmissionpoliciesResource, validatingAdmissionPolicy, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ValidatingAdmissionPolicy), err
}
// Update takes the representation of a validatingAdmissionPolicy and updates it. Returns the server's representation of the validatingAdmissionPolicy, and an error, if there is any.
func (c *FakeValidatingAdmissionPolicies) Update(ctx context.Context, validatingAdmissionPolicy *v1alpha1.ValidatingAdmissionPolicy, opts v1.UpdateOptions) (result *v1alpha1.ValidatingAdmissionPolicy, err error) {
emptyResult := &v1alpha1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(validatingadmissionpoliciesResource, validatingAdmissionPolicy, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ValidatingAdmissionPolicy), 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 *FakeValidatingAdmissionPolicies) UpdateStatus(ctx context.Context, validatingAdmissionPolicy *v1alpha1.ValidatingAdmissionPolicy, opts v1.UpdateOptions) (result *v1alpha1.ValidatingAdmissionPolicy, err error) {
emptyResult := &v1alpha1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(validatingadmissionpoliciesResource, "status", validatingAdmissionPolicy, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ValidatingAdmissionPolicy), err
}
// Delete takes name of the validatingAdmissionPolicy and deletes it. Returns an error if one occurs.
func (c *FakeValidatingAdmissionPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(validatingadmissionpoliciesResource, name, opts), &v1alpha1.ValidatingAdmissionPolicy{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeValidatingAdmissionPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(validatingadmissionpoliciesResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.ValidatingAdmissionPolicyList{})
return err
}
// Patch applies the patch and returns the patched validatingAdmissionPolicy.
func (c *FakeValidatingAdmissionPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ValidatingAdmissionPolicy, err error) {
emptyResult := &v1alpha1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpoliciesResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ValidatingAdmissionPolicy), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied validatingAdmissionPolicy.
func (c *FakeValidatingAdmissionPolicies) Apply(ctx context.Context, validatingAdmissionPolicy *admissionregistrationv1alpha1.ValidatingAdmissionPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ValidatingAdmissionPolicy, err error) {
if validatingAdmissionPolicy == nil {
return nil, fmt.Errorf("validatingAdmissionPolicy provided to Apply must not be nil")
}
data, err := json.Marshal(validatingAdmissionPolicy)
if err != nil {
return nil, err
}
name := validatingAdmissionPolicy.Name
if name == nil {
return nil, fmt.Errorf("validatingAdmissionPolicy.Name must be provided to Apply")
}
emptyResult := &v1alpha1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpoliciesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ValidatingAdmissionPolicy), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeValidatingAdmissionPolicies) ApplyStatus(ctx context.Context, validatingAdmissionPolicy *admissionregistrationv1alpha1.ValidatingAdmissionPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ValidatingAdmissionPolicy, err error) {
if validatingAdmissionPolicy == nil {
return nil, fmt.Errorf("validatingAdmissionPolicy provided to Apply must not be nil")
}
data, err := json.Marshal(validatingAdmissionPolicy)
if err != nil {
return nil, err
}
name := validatingAdmissionPolicy.Name
if name == nil {
return nil, fmt.Errorf("validatingAdmissionPolicy.Name must be provided to Apply")
}
emptyResult := &v1alpha1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpoliciesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ValidatingAdmissionPolicy), err
} }

View File

@@ -19,133 +19,37 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1alpha1 "k8s.io/api/admissionregistration/v1alpha1" v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1" admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedadmissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
) )
// FakeValidatingAdmissionPolicyBindings implements ValidatingAdmissionPolicyBindingInterface // fakeValidatingAdmissionPolicyBindings implements ValidatingAdmissionPolicyBindingInterface
type FakeValidatingAdmissionPolicyBindings struct { type fakeValidatingAdmissionPolicyBindings struct {
*gentype.FakeClientWithListAndApply[*v1alpha1.ValidatingAdmissionPolicyBinding, *v1alpha1.ValidatingAdmissionPolicyBindingList, *admissionregistrationv1alpha1.ValidatingAdmissionPolicyBindingApplyConfiguration]
Fake *FakeAdmissionregistrationV1alpha1 Fake *FakeAdmissionregistrationV1alpha1
} }
var validatingadmissionpolicybindingsResource = v1alpha1.SchemeGroupVersion.WithResource("validatingadmissionpolicybindings") func newFakeValidatingAdmissionPolicyBindings(fake *FakeAdmissionregistrationV1alpha1) typedadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBindingInterface {
return &fakeValidatingAdmissionPolicyBindings{
var validatingadmissionpolicybindingsKind = v1alpha1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicyBinding") gentype.NewFakeClientWithListAndApply[*v1alpha1.ValidatingAdmissionPolicyBinding, *v1alpha1.ValidatingAdmissionPolicyBindingList, *admissionregistrationv1alpha1.ValidatingAdmissionPolicyBindingApplyConfiguration](
fake.Fake,
// Get takes name of the validatingAdmissionPolicyBinding, and returns the corresponding validatingAdmissionPolicyBinding object, and an error if there is any. "",
func (c *FakeValidatingAdmissionPolicyBindings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ValidatingAdmissionPolicyBinding, err error) { v1alpha1.SchemeGroupVersion.WithResource("validatingadmissionpolicybindings"),
emptyResult := &v1alpha1.ValidatingAdmissionPolicyBinding{} v1alpha1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicyBinding"),
obj, err := c.Fake. func() *v1alpha1.ValidatingAdmissionPolicyBinding { return &v1alpha1.ValidatingAdmissionPolicyBinding{} },
Invokes(testing.NewRootGetActionWithOptions(validatingadmissionpolicybindingsResource, name, options), emptyResult) func() *v1alpha1.ValidatingAdmissionPolicyBindingList {
if obj == nil { return &v1alpha1.ValidatingAdmissionPolicyBindingList{}
return emptyResult, err },
func(dst, src *v1alpha1.ValidatingAdmissionPolicyBindingList) { dst.ListMeta = src.ListMeta },
func(list *v1alpha1.ValidatingAdmissionPolicyBindingList) []*v1alpha1.ValidatingAdmissionPolicyBinding {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1alpha1.ValidatingAdmissionPolicyBindingList, items []*v1alpha1.ValidatingAdmissionPolicyBinding) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1alpha1.ValidatingAdmissionPolicyBinding), err
}
// List takes label and field selectors, and returns the list of ValidatingAdmissionPolicyBindings that match those selectors.
func (c *FakeValidatingAdmissionPolicyBindings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ValidatingAdmissionPolicyBindingList, err error) {
emptyResult := &v1alpha1.ValidatingAdmissionPolicyBindingList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(validatingadmissionpolicybindingsResource, validatingadmissionpolicybindingsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ValidatingAdmissionPolicyBindingList{ListMeta: obj.(*v1alpha1.ValidatingAdmissionPolicyBindingList).ListMeta}
for _, item := range obj.(*v1alpha1.ValidatingAdmissionPolicyBindingList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested validatingAdmissionPolicyBindings.
func (c *FakeValidatingAdmissionPolicyBindings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(validatingadmissionpolicybindingsResource, opts))
}
// Create takes the representation of a validatingAdmissionPolicyBinding and creates it. Returns the server's representation of the validatingAdmissionPolicyBinding, and an error, if there is any.
func (c *FakeValidatingAdmissionPolicyBindings) Create(ctx context.Context, validatingAdmissionPolicyBinding *v1alpha1.ValidatingAdmissionPolicyBinding, opts v1.CreateOptions) (result *v1alpha1.ValidatingAdmissionPolicyBinding, err error) {
emptyResult := &v1alpha1.ValidatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(validatingadmissionpolicybindingsResource, validatingAdmissionPolicyBinding, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ValidatingAdmissionPolicyBinding), err
}
// Update takes the representation of a validatingAdmissionPolicyBinding and updates it. Returns the server's representation of the validatingAdmissionPolicyBinding, and an error, if there is any.
func (c *FakeValidatingAdmissionPolicyBindings) Update(ctx context.Context, validatingAdmissionPolicyBinding *v1alpha1.ValidatingAdmissionPolicyBinding, opts v1.UpdateOptions) (result *v1alpha1.ValidatingAdmissionPolicyBinding, err error) {
emptyResult := &v1alpha1.ValidatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(validatingadmissionpolicybindingsResource, validatingAdmissionPolicyBinding, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ValidatingAdmissionPolicyBinding), err
}
// Delete takes name of the validatingAdmissionPolicyBinding and deletes it. Returns an error if one occurs.
func (c *FakeValidatingAdmissionPolicyBindings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(validatingadmissionpolicybindingsResource, name, opts), &v1alpha1.ValidatingAdmissionPolicyBinding{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeValidatingAdmissionPolicyBindings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(validatingadmissionpolicybindingsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.ValidatingAdmissionPolicyBindingList{})
return err
}
// Patch applies the patch and returns the patched validatingAdmissionPolicyBinding.
func (c *FakeValidatingAdmissionPolicyBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ValidatingAdmissionPolicyBinding, err error) {
emptyResult := &v1alpha1.ValidatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpolicybindingsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ValidatingAdmissionPolicyBinding), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied validatingAdmissionPolicyBinding.
func (c *FakeValidatingAdmissionPolicyBindings) Apply(ctx context.Context, validatingAdmissionPolicyBinding *admissionregistrationv1alpha1.ValidatingAdmissionPolicyBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ValidatingAdmissionPolicyBinding, err error) {
if validatingAdmissionPolicyBinding == nil {
return nil, fmt.Errorf("validatingAdmissionPolicyBinding provided to Apply must not be nil")
}
data, err := json.Marshal(validatingAdmissionPolicyBinding)
if err != nil {
return nil, err
}
name := validatingAdmissionPolicyBinding.Name
if name == nil {
return nil, fmt.Errorf("validatingAdmissionPolicyBinding.Name must be provided to Apply")
}
emptyResult := &v1alpha1.ValidatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpolicybindingsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ValidatingAdmissionPolicyBinding), err
} }

View File

@@ -29,19 +29,19 @@ type FakeAdmissionregistrationV1beta1 struct {
} }
func (c *FakeAdmissionregistrationV1beta1) MutatingWebhookConfigurations() v1beta1.MutatingWebhookConfigurationInterface { func (c *FakeAdmissionregistrationV1beta1) MutatingWebhookConfigurations() v1beta1.MutatingWebhookConfigurationInterface {
return &FakeMutatingWebhookConfigurations{c} return newFakeMutatingWebhookConfigurations(c)
} }
func (c *FakeAdmissionregistrationV1beta1) ValidatingAdmissionPolicies() v1beta1.ValidatingAdmissionPolicyInterface { func (c *FakeAdmissionregistrationV1beta1) ValidatingAdmissionPolicies() v1beta1.ValidatingAdmissionPolicyInterface {
return &FakeValidatingAdmissionPolicies{c} return newFakeValidatingAdmissionPolicies(c)
} }
func (c *FakeAdmissionregistrationV1beta1) ValidatingAdmissionPolicyBindings() v1beta1.ValidatingAdmissionPolicyBindingInterface { func (c *FakeAdmissionregistrationV1beta1) ValidatingAdmissionPolicyBindings() v1beta1.ValidatingAdmissionPolicyBindingInterface {
return &FakeValidatingAdmissionPolicyBindings{c} return newFakeValidatingAdmissionPolicyBindings(c)
} }
func (c *FakeAdmissionregistrationV1beta1) ValidatingWebhookConfigurations() v1beta1.ValidatingWebhookConfigurationInterface { func (c *FakeAdmissionregistrationV1beta1) ValidatingWebhookConfigurations() v1beta1.ValidatingWebhookConfigurationInterface {
return &FakeValidatingWebhookConfigurations{c} return newFakeValidatingWebhookConfigurations(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,133 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta1 "k8s.io/api/admissionregistration/v1beta1" v1beta1 "k8s.io/api/admissionregistration/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1" admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
) )
// FakeMutatingWebhookConfigurations implements MutatingWebhookConfigurationInterface // fakeMutatingWebhookConfigurations implements MutatingWebhookConfigurationInterface
type FakeMutatingWebhookConfigurations struct { type fakeMutatingWebhookConfigurations struct {
*gentype.FakeClientWithListAndApply[*v1beta1.MutatingWebhookConfiguration, *v1beta1.MutatingWebhookConfigurationList, *admissionregistrationv1beta1.MutatingWebhookConfigurationApplyConfiguration]
Fake *FakeAdmissionregistrationV1beta1 Fake *FakeAdmissionregistrationV1beta1
} }
var mutatingwebhookconfigurationsResource = v1beta1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations") func newFakeMutatingWebhookConfigurations(fake *FakeAdmissionregistrationV1beta1) typedadmissionregistrationv1beta1.MutatingWebhookConfigurationInterface {
return &fakeMutatingWebhookConfigurations{
var mutatingwebhookconfigurationsKind = v1beta1.SchemeGroupVersion.WithKind("MutatingWebhookConfiguration") gentype.NewFakeClientWithListAndApply[*v1beta1.MutatingWebhookConfiguration, *v1beta1.MutatingWebhookConfigurationList, *admissionregistrationv1beta1.MutatingWebhookConfigurationApplyConfiguration](
fake.Fake,
// Get takes name of the mutatingWebhookConfiguration, and returns the corresponding mutatingWebhookConfiguration object, and an error if there is any. "",
func (c *FakeMutatingWebhookConfigurations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.MutatingWebhookConfiguration, err error) { v1beta1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"),
emptyResult := &v1beta1.MutatingWebhookConfiguration{} v1beta1.SchemeGroupVersion.WithKind("MutatingWebhookConfiguration"),
obj, err := c.Fake. func() *v1beta1.MutatingWebhookConfiguration { return &v1beta1.MutatingWebhookConfiguration{} },
Invokes(testing.NewRootGetActionWithOptions(mutatingwebhookconfigurationsResource, name, options), emptyResult) func() *v1beta1.MutatingWebhookConfigurationList { return &v1beta1.MutatingWebhookConfigurationList{} },
if obj == nil { func(dst, src *v1beta1.MutatingWebhookConfigurationList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1beta1.MutatingWebhookConfigurationList) []*v1beta1.MutatingWebhookConfiguration {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1beta1.MutatingWebhookConfigurationList, items []*v1beta1.MutatingWebhookConfiguration) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta1.MutatingWebhookConfiguration), err
}
// List takes label and field selectors, and returns the list of MutatingWebhookConfigurations that match those selectors.
func (c *FakeMutatingWebhookConfigurations) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.MutatingWebhookConfigurationList, err error) {
emptyResult := &v1beta1.MutatingWebhookConfigurationList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(mutatingwebhookconfigurationsResource, mutatingwebhookconfigurationsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.MutatingWebhookConfigurationList{ListMeta: obj.(*v1beta1.MutatingWebhookConfigurationList).ListMeta}
for _, item := range obj.(*v1beta1.MutatingWebhookConfigurationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested mutatingWebhookConfigurations.
func (c *FakeMutatingWebhookConfigurations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(mutatingwebhookconfigurationsResource, opts))
}
// Create takes the representation of a mutatingWebhookConfiguration and creates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any.
func (c *FakeMutatingWebhookConfigurations) Create(ctx context.Context, mutatingWebhookConfiguration *v1beta1.MutatingWebhookConfiguration, opts v1.CreateOptions) (result *v1beta1.MutatingWebhookConfiguration, err error) {
emptyResult := &v1beta1.MutatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(mutatingwebhookconfigurationsResource, mutatingWebhookConfiguration, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.MutatingWebhookConfiguration), err
}
// Update takes the representation of a mutatingWebhookConfiguration and updates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any.
func (c *FakeMutatingWebhookConfigurations) Update(ctx context.Context, mutatingWebhookConfiguration *v1beta1.MutatingWebhookConfiguration, opts v1.UpdateOptions) (result *v1beta1.MutatingWebhookConfiguration, err error) {
emptyResult := &v1beta1.MutatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(mutatingwebhookconfigurationsResource, mutatingWebhookConfiguration, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.MutatingWebhookConfiguration), err
}
// Delete takes name of the mutatingWebhookConfiguration and deletes it. Returns an error if one occurs.
func (c *FakeMutatingWebhookConfigurations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(mutatingwebhookconfigurationsResource, name, opts), &v1beta1.MutatingWebhookConfiguration{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeMutatingWebhookConfigurations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(mutatingwebhookconfigurationsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.MutatingWebhookConfigurationList{})
return err
}
// Patch applies the patch and returns the patched mutatingWebhookConfiguration.
func (c *FakeMutatingWebhookConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.MutatingWebhookConfiguration, err error) {
emptyResult := &v1beta1.MutatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(mutatingwebhookconfigurationsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.MutatingWebhookConfiguration), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied mutatingWebhookConfiguration.
func (c *FakeMutatingWebhookConfigurations) Apply(ctx context.Context, mutatingWebhookConfiguration *admissionregistrationv1beta1.MutatingWebhookConfigurationApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.MutatingWebhookConfiguration, err error) {
if mutatingWebhookConfiguration == nil {
return nil, fmt.Errorf("mutatingWebhookConfiguration provided to Apply must not be nil")
}
data, err := json.Marshal(mutatingWebhookConfiguration)
if err != nil {
return nil, err
}
name := mutatingWebhookConfiguration.Name
if name == nil {
return nil, fmt.Errorf("mutatingWebhookConfiguration.Name must be provided to Apply")
}
emptyResult := &v1beta1.MutatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(mutatingwebhookconfigurationsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.MutatingWebhookConfiguration), err
} }

View File

@@ -19,168 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta1 "k8s.io/api/admissionregistration/v1beta1" v1beta1 "k8s.io/api/admissionregistration/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1" admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
) )
// FakeValidatingAdmissionPolicies implements ValidatingAdmissionPolicyInterface // fakeValidatingAdmissionPolicies implements ValidatingAdmissionPolicyInterface
type FakeValidatingAdmissionPolicies struct { type fakeValidatingAdmissionPolicies struct {
*gentype.FakeClientWithListAndApply[*v1beta1.ValidatingAdmissionPolicy, *v1beta1.ValidatingAdmissionPolicyList, *admissionregistrationv1beta1.ValidatingAdmissionPolicyApplyConfiguration]
Fake *FakeAdmissionregistrationV1beta1 Fake *FakeAdmissionregistrationV1beta1
} }
var validatingadmissionpoliciesResource = v1beta1.SchemeGroupVersion.WithResource("validatingadmissionpolicies") func newFakeValidatingAdmissionPolicies(fake *FakeAdmissionregistrationV1beta1) typedadmissionregistrationv1beta1.ValidatingAdmissionPolicyInterface {
return &fakeValidatingAdmissionPolicies{
var validatingadmissionpoliciesKind = v1beta1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicy") gentype.NewFakeClientWithListAndApply[*v1beta1.ValidatingAdmissionPolicy, *v1beta1.ValidatingAdmissionPolicyList, *admissionregistrationv1beta1.ValidatingAdmissionPolicyApplyConfiguration](
fake.Fake,
// Get takes name of the validatingAdmissionPolicy, and returns the corresponding validatingAdmissionPolicy object, and an error if there is any. "",
func (c *FakeValidatingAdmissionPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ValidatingAdmissionPolicy, err error) { v1beta1.SchemeGroupVersion.WithResource("validatingadmissionpolicies"),
emptyResult := &v1beta1.ValidatingAdmissionPolicy{} v1beta1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicy"),
obj, err := c.Fake. func() *v1beta1.ValidatingAdmissionPolicy { return &v1beta1.ValidatingAdmissionPolicy{} },
Invokes(testing.NewRootGetActionWithOptions(validatingadmissionpoliciesResource, name, options), emptyResult) func() *v1beta1.ValidatingAdmissionPolicyList { return &v1beta1.ValidatingAdmissionPolicyList{} },
if obj == nil { func(dst, src *v1beta1.ValidatingAdmissionPolicyList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1beta1.ValidatingAdmissionPolicyList) []*v1beta1.ValidatingAdmissionPolicy {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1beta1.ValidatingAdmissionPolicyList, items []*v1beta1.ValidatingAdmissionPolicy) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta1.ValidatingAdmissionPolicy), err
}
// List takes label and field selectors, and returns the list of ValidatingAdmissionPolicies that match those selectors.
func (c *FakeValidatingAdmissionPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ValidatingAdmissionPolicyList, err error) {
emptyResult := &v1beta1.ValidatingAdmissionPolicyList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(validatingadmissionpoliciesResource, validatingadmissionpoliciesKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.ValidatingAdmissionPolicyList{ListMeta: obj.(*v1beta1.ValidatingAdmissionPolicyList).ListMeta}
for _, item := range obj.(*v1beta1.ValidatingAdmissionPolicyList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested validatingAdmissionPolicies.
func (c *FakeValidatingAdmissionPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(validatingadmissionpoliciesResource, opts))
}
// Create takes the representation of a validatingAdmissionPolicy and creates it. Returns the server's representation of the validatingAdmissionPolicy, and an error, if there is any.
func (c *FakeValidatingAdmissionPolicies) Create(ctx context.Context, validatingAdmissionPolicy *v1beta1.ValidatingAdmissionPolicy, opts v1.CreateOptions) (result *v1beta1.ValidatingAdmissionPolicy, err error) {
emptyResult := &v1beta1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(validatingadmissionpoliciesResource, validatingAdmissionPolicy, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingAdmissionPolicy), err
}
// Update takes the representation of a validatingAdmissionPolicy and updates it. Returns the server's representation of the validatingAdmissionPolicy, and an error, if there is any.
func (c *FakeValidatingAdmissionPolicies) Update(ctx context.Context, validatingAdmissionPolicy *v1beta1.ValidatingAdmissionPolicy, opts v1.UpdateOptions) (result *v1beta1.ValidatingAdmissionPolicy, err error) {
emptyResult := &v1beta1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(validatingadmissionpoliciesResource, validatingAdmissionPolicy, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingAdmissionPolicy), 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 *FakeValidatingAdmissionPolicies) UpdateStatus(ctx context.Context, validatingAdmissionPolicy *v1beta1.ValidatingAdmissionPolicy, opts v1.UpdateOptions) (result *v1beta1.ValidatingAdmissionPolicy, err error) {
emptyResult := &v1beta1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(validatingadmissionpoliciesResource, "status", validatingAdmissionPolicy, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingAdmissionPolicy), err
}
// Delete takes name of the validatingAdmissionPolicy and deletes it. Returns an error if one occurs.
func (c *FakeValidatingAdmissionPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(validatingadmissionpoliciesResource, name, opts), &v1beta1.ValidatingAdmissionPolicy{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeValidatingAdmissionPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(validatingadmissionpoliciesResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.ValidatingAdmissionPolicyList{})
return err
}
// Patch applies the patch and returns the patched validatingAdmissionPolicy.
func (c *FakeValidatingAdmissionPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ValidatingAdmissionPolicy, err error) {
emptyResult := &v1beta1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpoliciesResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingAdmissionPolicy), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied validatingAdmissionPolicy.
func (c *FakeValidatingAdmissionPolicies) Apply(ctx context.Context, validatingAdmissionPolicy *admissionregistrationv1beta1.ValidatingAdmissionPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ValidatingAdmissionPolicy, err error) {
if validatingAdmissionPolicy == nil {
return nil, fmt.Errorf("validatingAdmissionPolicy provided to Apply must not be nil")
}
data, err := json.Marshal(validatingAdmissionPolicy)
if err != nil {
return nil, err
}
name := validatingAdmissionPolicy.Name
if name == nil {
return nil, fmt.Errorf("validatingAdmissionPolicy.Name must be provided to Apply")
}
emptyResult := &v1beta1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpoliciesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingAdmissionPolicy), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeValidatingAdmissionPolicies) ApplyStatus(ctx context.Context, validatingAdmissionPolicy *admissionregistrationv1beta1.ValidatingAdmissionPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ValidatingAdmissionPolicy, err error) {
if validatingAdmissionPolicy == nil {
return nil, fmt.Errorf("validatingAdmissionPolicy provided to Apply must not be nil")
}
data, err := json.Marshal(validatingAdmissionPolicy)
if err != nil {
return nil, err
}
name := validatingAdmissionPolicy.Name
if name == nil {
return nil, fmt.Errorf("validatingAdmissionPolicy.Name must be provided to Apply")
}
emptyResult := &v1beta1.ValidatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpoliciesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingAdmissionPolicy), err
} }

View File

@@ -19,133 +19,37 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta1 "k8s.io/api/admissionregistration/v1beta1" v1beta1 "k8s.io/api/admissionregistration/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1" admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
) )
// FakeValidatingAdmissionPolicyBindings implements ValidatingAdmissionPolicyBindingInterface // fakeValidatingAdmissionPolicyBindings implements ValidatingAdmissionPolicyBindingInterface
type FakeValidatingAdmissionPolicyBindings struct { type fakeValidatingAdmissionPolicyBindings struct {
*gentype.FakeClientWithListAndApply[*v1beta1.ValidatingAdmissionPolicyBinding, *v1beta1.ValidatingAdmissionPolicyBindingList, *admissionregistrationv1beta1.ValidatingAdmissionPolicyBindingApplyConfiguration]
Fake *FakeAdmissionregistrationV1beta1 Fake *FakeAdmissionregistrationV1beta1
} }
var validatingadmissionpolicybindingsResource = v1beta1.SchemeGroupVersion.WithResource("validatingadmissionpolicybindings") func newFakeValidatingAdmissionPolicyBindings(fake *FakeAdmissionregistrationV1beta1) typedadmissionregistrationv1beta1.ValidatingAdmissionPolicyBindingInterface {
return &fakeValidatingAdmissionPolicyBindings{
var validatingadmissionpolicybindingsKind = v1beta1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicyBinding") gentype.NewFakeClientWithListAndApply[*v1beta1.ValidatingAdmissionPolicyBinding, *v1beta1.ValidatingAdmissionPolicyBindingList, *admissionregistrationv1beta1.ValidatingAdmissionPolicyBindingApplyConfiguration](
fake.Fake,
// Get takes name of the validatingAdmissionPolicyBinding, and returns the corresponding validatingAdmissionPolicyBinding object, and an error if there is any. "",
func (c *FakeValidatingAdmissionPolicyBindings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ValidatingAdmissionPolicyBinding, err error) { v1beta1.SchemeGroupVersion.WithResource("validatingadmissionpolicybindings"),
emptyResult := &v1beta1.ValidatingAdmissionPolicyBinding{} v1beta1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicyBinding"),
obj, err := c.Fake. func() *v1beta1.ValidatingAdmissionPolicyBinding { return &v1beta1.ValidatingAdmissionPolicyBinding{} },
Invokes(testing.NewRootGetActionWithOptions(validatingadmissionpolicybindingsResource, name, options), emptyResult) func() *v1beta1.ValidatingAdmissionPolicyBindingList {
if obj == nil { return &v1beta1.ValidatingAdmissionPolicyBindingList{}
return emptyResult, err },
func(dst, src *v1beta1.ValidatingAdmissionPolicyBindingList) { dst.ListMeta = src.ListMeta },
func(list *v1beta1.ValidatingAdmissionPolicyBindingList) []*v1beta1.ValidatingAdmissionPolicyBinding {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1beta1.ValidatingAdmissionPolicyBindingList, items []*v1beta1.ValidatingAdmissionPolicyBinding) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta1.ValidatingAdmissionPolicyBinding), err
}
// List takes label and field selectors, and returns the list of ValidatingAdmissionPolicyBindings that match those selectors.
func (c *FakeValidatingAdmissionPolicyBindings) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ValidatingAdmissionPolicyBindingList, err error) {
emptyResult := &v1beta1.ValidatingAdmissionPolicyBindingList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(validatingadmissionpolicybindingsResource, validatingadmissionpolicybindingsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.ValidatingAdmissionPolicyBindingList{ListMeta: obj.(*v1beta1.ValidatingAdmissionPolicyBindingList).ListMeta}
for _, item := range obj.(*v1beta1.ValidatingAdmissionPolicyBindingList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested validatingAdmissionPolicyBindings.
func (c *FakeValidatingAdmissionPolicyBindings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(validatingadmissionpolicybindingsResource, opts))
}
// Create takes the representation of a validatingAdmissionPolicyBinding and creates it. Returns the server's representation of the validatingAdmissionPolicyBinding, and an error, if there is any.
func (c *FakeValidatingAdmissionPolicyBindings) Create(ctx context.Context, validatingAdmissionPolicyBinding *v1beta1.ValidatingAdmissionPolicyBinding, opts v1.CreateOptions) (result *v1beta1.ValidatingAdmissionPolicyBinding, err error) {
emptyResult := &v1beta1.ValidatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(validatingadmissionpolicybindingsResource, validatingAdmissionPolicyBinding, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingAdmissionPolicyBinding), err
}
// Update takes the representation of a validatingAdmissionPolicyBinding and updates it. Returns the server's representation of the validatingAdmissionPolicyBinding, and an error, if there is any.
func (c *FakeValidatingAdmissionPolicyBindings) Update(ctx context.Context, validatingAdmissionPolicyBinding *v1beta1.ValidatingAdmissionPolicyBinding, opts v1.UpdateOptions) (result *v1beta1.ValidatingAdmissionPolicyBinding, err error) {
emptyResult := &v1beta1.ValidatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(validatingadmissionpolicybindingsResource, validatingAdmissionPolicyBinding, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingAdmissionPolicyBinding), err
}
// Delete takes name of the validatingAdmissionPolicyBinding and deletes it. Returns an error if one occurs.
func (c *FakeValidatingAdmissionPolicyBindings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(validatingadmissionpolicybindingsResource, name, opts), &v1beta1.ValidatingAdmissionPolicyBinding{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeValidatingAdmissionPolicyBindings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(validatingadmissionpolicybindingsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.ValidatingAdmissionPolicyBindingList{})
return err
}
// Patch applies the patch and returns the patched validatingAdmissionPolicyBinding.
func (c *FakeValidatingAdmissionPolicyBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ValidatingAdmissionPolicyBinding, err error) {
emptyResult := &v1beta1.ValidatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpolicybindingsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingAdmissionPolicyBinding), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied validatingAdmissionPolicyBinding.
func (c *FakeValidatingAdmissionPolicyBindings) Apply(ctx context.Context, validatingAdmissionPolicyBinding *admissionregistrationv1beta1.ValidatingAdmissionPolicyBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ValidatingAdmissionPolicyBinding, err error) {
if validatingAdmissionPolicyBinding == nil {
return nil, fmt.Errorf("validatingAdmissionPolicyBinding provided to Apply must not be nil")
}
data, err := json.Marshal(validatingAdmissionPolicyBinding)
if err != nil {
return nil, err
}
name := validatingAdmissionPolicyBinding.Name
if name == nil {
return nil, fmt.Errorf("validatingAdmissionPolicyBinding.Name must be provided to Apply")
}
emptyResult := &v1beta1.ValidatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingadmissionpolicybindingsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingAdmissionPolicyBinding), err
} }

View File

@@ -19,133 +19,37 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta1 "k8s.io/api/admissionregistration/v1beta1" v1beta1 "k8s.io/api/admissionregistration/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1" admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
) )
// FakeValidatingWebhookConfigurations implements ValidatingWebhookConfigurationInterface // fakeValidatingWebhookConfigurations implements ValidatingWebhookConfigurationInterface
type FakeValidatingWebhookConfigurations struct { type fakeValidatingWebhookConfigurations struct {
*gentype.FakeClientWithListAndApply[*v1beta1.ValidatingWebhookConfiguration, *v1beta1.ValidatingWebhookConfigurationList, *admissionregistrationv1beta1.ValidatingWebhookConfigurationApplyConfiguration]
Fake *FakeAdmissionregistrationV1beta1 Fake *FakeAdmissionregistrationV1beta1
} }
var validatingwebhookconfigurationsResource = v1beta1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations") func newFakeValidatingWebhookConfigurations(fake *FakeAdmissionregistrationV1beta1) typedadmissionregistrationv1beta1.ValidatingWebhookConfigurationInterface {
return &fakeValidatingWebhookConfigurations{
var validatingwebhookconfigurationsKind = v1beta1.SchemeGroupVersion.WithKind("ValidatingWebhookConfiguration") gentype.NewFakeClientWithListAndApply[*v1beta1.ValidatingWebhookConfiguration, *v1beta1.ValidatingWebhookConfigurationList, *admissionregistrationv1beta1.ValidatingWebhookConfigurationApplyConfiguration](
fake.Fake,
// Get takes name of the validatingWebhookConfiguration, and returns the corresponding validatingWebhookConfiguration object, and an error if there is any. "",
func (c *FakeValidatingWebhookConfigurations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ValidatingWebhookConfiguration, err error) { v1beta1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations"),
emptyResult := &v1beta1.ValidatingWebhookConfiguration{} v1beta1.SchemeGroupVersion.WithKind("ValidatingWebhookConfiguration"),
obj, err := c.Fake. func() *v1beta1.ValidatingWebhookConfiguration { return &v1beta1.ValidatingWebhookConfiguration{} },
Invokes(testing.NewRootGetActionWithOptions(validatingwebhookconfigurationsResource, name, options), emptyResult) func() *v1beta1.ValidatingWebhookConfigurationList {
if obj == nil { return &v1beta1.ValidatingWebhookConfigurationList{}
return emptyResult, err },
func(dst, src *v1beta1.ValidatingWebhookConfigurationList) { dst.ListMeta = src.ListMeta },
func(list *v1beta1.ValidatingWebhookConfigurationList) []*v1beta1.ValidatingWebhookConfiguration {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1beta1.ValidatingWebhookConfigurationList, items []*v1beta1.ValidatingWebhookConfiguration) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta1.ValidatingWebhookConfiguration), err
}
// List takes label and field selectors, and returns the list of ValidatingWebhookConfigurations that match those selectors.
func (c *FakeValidatingWebhookConfigurations) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ValidatingWebhookConfigurationList, err error) {
emptyResult := &v1beta1.ValidatingWebhookConfigurationList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(validatingwebhookconfigurationsResource, validatingwebhookconfigurationsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.ValidatingWebhookConfigurationList{ListMeta: obj.(*v1beta1.ValidatingWebhookConfigurationList).ListMeta}
for _, item := range obj.(*v1beta1.ValidatingWebhookConfigurationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested validatingWebhookConfigurations.
func (c *FakeValidatingWebhookConfigurations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(validatingwebhookconfigurationsResource, opts))
}
// Create takes the representation of a validatingWebhookConfiguration and creates it. Returns the server's representation of the validatingWebhookConfiguration, and an error, if there is any.
func (c *FakeValidatingWebhookConfigurations) Create(ctx context.Context, validatingWebhookConfiguration *v1beta1.ValidatingWebhookConfiguration, opts v1.CreateOptions) (result *v1beta1.ValidatingWebhookConfiguration, err error) {
emptyResult := &v1beta1.ValidatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(validatingwebhookconfigurationsResource, validatingWebhookConfiguration, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingWebhookConfiguration), err
}
// Update takes the representation of a validatingWebhookConfiguration and updates it. Returns the server's representation of the validatingWebhookConfiguration, and an error, if there is any.
func (c *FakeValidatingWebhookConfigurations) Update(ctx context.Context, validatingWebhookConfiguration *v1beta1.ValidatingWebhookConfiguration, opts v1.UpdateOptions) (result *v1beta1.ValidatingWebhookConfiguration, err error) {
emptyResult := &v1beta1.ValidatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(validatingwebhookconfigurationsResource, validatingWebhookConfiguration, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingWebhookConfiguration), err
}
// Delete takes name of the validatingWebhookConfiguration and deletes it. Returns an error if one occurs.
func (c *FakeValidatingWebhookConfigurations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(validatingwebhookconfigurationsResource, name, opts), &v1beta1.ValidatingWebhookConfiguration{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeValidatingWebhookConfigurations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(validatingwebhookconfigurationsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.ValidatingWebhookConfigurationList{})
return err
}
// Patch applies the patch and returns the patched validatingWebhookConfiguration.
func (c *FakeValidatingWebhookConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ValidatingWebhookConfiguration, err error) {
emptyResult := &v1beta1.ValidatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingwebhookconfigurationsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingWebhookConfiguration), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied validatingWebhookConfiguration.
func (c *FakeValidatingWebhookConfigurations) Apply(ctx context.Context, validatingWebhookConfiguration *admissionregistrationv1beta1.ValidatingWebhookConfigurationApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ValidatingWebhookConfiguration, err error) {
if validatingWebhookConfiguration == nil {
return nil, fmt.Errorf("validatingWebhookConfiguration provided to Apply must not be nil")
}
data, err := json.Marshal(validatingWebhookConfiguration)
if err != nil {
return nil, err
}
name := validatingWebhookConfiguration.Name
if name == nil {
return nil, fmt.Errorf("validatingWebhookConfiguration.Name must be provided to Apply")
}
emptyResult := &v1beta1.ValidatingWebhookConfiguration{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(validatingwebhookconfigurationsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ValidatingWebhookConfiguration), err
} }

View File

@@ -29,7 +29,7 @@ type FakeInternalV1alpha1 struct {
} }
func (c *FakeInternalV1alpha1) StorageVersions() v1alpha1.StorageVersionInterface { func (c *FakeInternalV1alpha1) StorageVersions() v1alpha1.StorageVersionInterface {
return &FakeStorageVersions{c} return newFakeStorageVersions(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,168 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" v1alpha1 "k8s.io/api/apiserverinternal/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
apiserverinternalv1alpha1 "k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1" apiserverinternalv1alpha1 "k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedapiserverinternalv1alpha1 "k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1"
) )
// FakeStorageVersions implements StorageVersionInterface // fakeStorageVersions implements StorageVersionInterface
type FakeStorageVersions struct { type fakeStorageVersions struct {
*gentype.FakeClientWithListAndApply[*v1alpha1.StorageVersion, *v1alpha1.StorageVersionList, *apiserverinternalv1alpha1.StorageVersionApplyConfiguration]
Fake *FakeInternalV1alpha1 Fake *FakeInternalV1alpha1
} }
var storageversionsResource = v1alpha1.SchemeGroupVersion.WithResource("storageversions") func newFakeStorageVersions(fake *FakeInternalV1alpha1) typedapiserverinternalv1alpha1.StorageVersionInterface {
return &fakeStorageVersions{
var storageversionsKind = v1alpha1.SchemeGroupVersion.WithKind("StorageVersion") gentype.NewFakeClientWithListAndApply[*v1alpha1.StorageVersion, *v1alpha1.StorageVersionList, *apiserverinternalv1alpha1.StorageVersionApplyConfiguration](
fake.Fake,
// Get takes name of the storageVersion, and returns the corresponding storageVersion object, and an error if there is any. "",
func (c *FakeStorageVersions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.StorageVersion, err error) { v1alpha1.SchemeGroupVersion.WithResource("storageversions"),
emptyResult := &v1alpha1.StorageVersion{} v1alpha1.SchemeGroupVersion.WithKind("StorageVersion"),
obj, err := c.Fake. func() *v1alpha1.StorageVersion { return &v1alpha1.StorageVersion{} },
Invokes(testing.NewRootGetActionWithOptions(storageversionsResource, name, options), emptyResult) func() *v1alpha1.StorageVersionList { return &v1alpha1.StorageVersionList{} },
if obj == nil { func(dst, src *v1alpha1.StorageVersionList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1alpha1.StorageVersionList) []*v1alpha1.StorageVersion {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1alpha1.StorageVersionList, items []*v1alpha1.StorageVersion) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1alpha1.StorageVersion), err
}
// List takes label and field selectors, and returns the list of StorageVersions that match those selectors.
func (c *FakeStorageVersions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.StorageVersionList, err error) {
emptyResult := &v1alpha1.StorageVersionList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(storageversionsResource, storageversionsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.StorageVersionList{ListMeta: obj.(*v1alpha1.StorageVersionList).ListMeta}
for _, item := range obj.(*v1alpha1.StorageVersionList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested storageVersions.
func (c *FakeStorageVersions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(storageversionsResource, opts))
}
// Create takes the representation of a storageVersion and creates it. Returns the server's representation of the storageVersion, and an error, if there is any.
func (c *FakeStorageVersions) Create(ctx context.Context, storageVersion *v1alpha1.StorageVersion, opts v1.CreateOptions) (result *v1alpha1.StorageVersion, err error) {
emptyResult := &v1alpha1.StorageVersion{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(storageversionsResource, storageVersion, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.StorageVersion), err
}
// Update takes the representation of a storageVersion and updates it. Returns the server's representation of the storageVersion, and an error, if there is any.
func (c *FakeStorageVersions) Update(ctx context.Context, storageVersion *v1alpha1.StorageVersion, opts v1.UpdateOptions) (result *v1alpha1.StorageVersion, err error) {
emptyResult := &v1alpha1.StorageVersion{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(storageversionsResource, storageVersion, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.StorageVersion), 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 *FakeStorageVersions) UpdateStatus(ctx context.Context, storageVersion *v1alpha1.StorageVersion, opts v1.UpdateOptions) (result *v1alpha1.StorageVersion, err error) {
emptyResult := &v1alpha1.StorageVersion{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(storageversionsResource, "status", storageVersion, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.StorageVersion), err
}
// Delete takes name of the storageVersion and deletes it. Returns an error if one occurs.
func (c *FakeStorageVersions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(storageversionsResource, name, opts), &v1alpha1.StorageVersion{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeStorageVersions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(storageversionsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.StorageVersionList{})
return err
}
// Patch applies the patch and returns the patched storageVersion.
func (c *FakeStorageVersions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.StorageVersion, err error) {
emptyResult := &v1alpha1.StorageVersion{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(storageversionsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.StorageVersion), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied storageVersion.
func (c *FakeStorageVersions) Apply(ctx context.Context, storageVersion *apiserverinternalv1alpha1.StorageVersionApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.StorageVersion, err error) {
if storageVersion == nil {
return nil, fmt.Errorf("storageVersion provided to Apply must not be nil")
}
data, err := json.Marshal(storageVersion)
if err != nil {
return nil, err
}
name := storageVersion.Name
if name == nil {
return nil, fmt.Errorf("storageVersion.Name must be provided to Apply")
}
emptyResult := &v1alpha1.StorageVersion{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(storageversionsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.StorageVersion), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeStorageVersions) ApplyStatus(ctx context.Context, storageVersion *apiserverinternalv1alpha1.StorageVersionApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.StorageVersion, err error) {
if storageVersion == nil {
return nil, fmt.Errorf("storageVersion provided to Apply must not be nil")
}
data, err := json.Marshal(storageVersion)
if err != nil {
return nil, err
}
name := storageVersion.Name
if name == nil {
return nil, fmt.Errorf("storageVersion.Name must be provided to Apply")
}
emptyResult := &v1alpha1.StorageVersion{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(storageversionsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.StorageVersion), err
} }

View File

@@ -29,23 +29,23 @@ type FakeAppsV1 struct {
} }
func (c *FakeAppsV1) ControllerRevisions(namespace string) v1.ControllerRevisionInterface { func (c *FakeAppsV1) ControllerRevisions(namespace string) v1.ControllerRevisionInterface {
return &FakeControllerRevisions{c, namespace} return newFakeControllerRevisions(c, namespace)
} }
func (c *FakeAppsV1) DaemonSets(namespace string) v1.DaemonSetInterface { func (c *FakeAppsV1) DaemonSets(namespace string) v1.DaemonSetInterface {
return &FakeDaemonSets{c, namespace} return newFakeDaemonSets(c, namespace)
} }
func (c *FakeAppsV1) Deployments(namespace string) v1.DeploymentInterface { func (c *FakeAppsV1) Deployments(namespace string) v1.DeploymentInterface {
return &FakeDeployments{c, namespace} return newFakeDeployments(c, namespace)
} }
func (c *FakeAppsV1) ReplicaSets(namespace string) v1.ReplicaSetInterface { func (c *FakeAppsV1) ReplicaSets(namespace string) v1.ReplicaSetInterface {
return &FakeReplicaSets{c, namespace} return newFakeReplicaSets(c, namespace)
} }
func (c *FakeAppsV1) StatefulSets(namespace string) v1.StatefulSetInterface { func (c *FakeAppsV1) StatefulSets(namespace string) v1.StatefulSetInterface {
return &FakeStatefulSets{c, namespace} return newFakeStatefulSets(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,142 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/apps/v1" v1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
appsv1 "k8s.io/client-go/applyconfigurations/apps/v1" appsv1 "k8s.io/client-go/applyconfigurations/apps/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
) )
// FakeControllerRevisions implements ControllerRevisionInterface // fakeControllerRevisions implements ControllerRevisionInterface
type FakeControllerRevisions struct { type fakeControllerRevisions struct {
*gentype.FakeClientWithListAndApply[*v1.ControllerRevision, *v1.ControllerRevisionList, *appsv1.ControllerRevisionApplyConfiguration]
Fake *FakeAppsV1 Fake *FakeAppsV1
ns string
} }
var controllerrevisionsResource = v1.SchemeGroupVersion.WithResource("controllerrevisions") func newFakeControllerRevisions(fake *FakeAppsV1, namespace string) typedappsv1.ControllerRevisionInterface {
return &fakeControllerRevisions{
var controllerrevisionsKind = v1.SchemeGroupVersion.WithKind("ControllerRevision") gentype.NewFakeClientWithListAndApply[*v1.ControllerRevision, *v1.ControllerRevisionList, *appsv1.ControllerRevisionApplyConfiguration](
fake.Fake,
// Get takes name of the controllerRevision, and returns the corresponding controllerRevision object, and an error if there is any. namespace,
func (c *FakeControllerRevisions) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ControllerRevision, err error) { v1.SchemeGroupVersion.WithResource("controllerrevisions"),
emptyResult := &v1.ControllerRevision{} v1.SchemeGroupVersion.WithKind("ControllerRevision"),
obj, err := c.Fake. func() *v1.ControllerRevision { return &v1.ControllerRevision{} },
Invokes(testing.NewGetActionWithOptions(controllerrevisionsResource, c.ns, name, options), emptyResult) func() *v1.ControllerRevisionList { return &v1.ControllerRevisionList{} },
func(dst, src *v1.ControllerRevisionList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.ControllerRevisionList) []*v1.ControllerRevision {
return emptyResult, err return gentype.ToPointerSlice(list.Items)
},
func(list *v1.ControllerRevisionList, items []*v1.ControllerRevision) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.ControllerRevision), err
}
// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors.
func (c *FakeControllerRevisions) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ControllerRevisionList, err error) {
emptyResult := &v1.ControllerRevisionList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(controllerrevisionsResource, controllerrevisionsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ControllerRevisionList{ListMeta: obj.(*v1.ControllerRevisionList).ListMeta}
for _, item := range obj.(*v1.ControllerRevisionList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested controllerRevisions.
func (c *FakeControllerRevisions) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(controllerrevisionsResource, c.ns, opts))
}
// Create takes the representation of a controllerRevision and creates it. Returns the server's representation of the controllerRevision, and an error, if there is any.
func (c *FakeControllerRevisions) Create(ctx context.Context, controllerRevision *v1.ControllerRevision, opts metav1.CreateOptions) (result *v1.ControllerRevision, err error) {
emptyResult := &v1.ControllerRevision{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(controllerrevisionsResource, c.ns, controllerRevision, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ControllerRevision), err
}
// Update takes the representation of a controllerRevision and updates it. Returns the server's representation of the controllerRevision, and an error, if there is any.
func (c *FakeControllerRevisions) Update(ctx context.Context, controllerRevision *v1.ControllerRevision, opts metav1.UpdateOptions) (result *v1.ControllerRevision, err error) {
emptyResult := &v1.ControllerRevision{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(controllerrevisionsResource, c.ns, controllerRevision, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ControllerRevision), err
}
// Delete takes name of the controllerRevision and deletes it. Returns an error if one occurs.
func (c *FakeControllerRevisions) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(controllerrevisionsResource, c.ns, name, opts), &v1.ControllerRevision{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeControllerRevisions) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(controllerrevisionsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.ControllerRevisionList{})
return err
}
// Patch applies the patch and returns the patched controllerRevision.
func (c *FakeControllerRevisions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ControllerRevision, err error) {
emptyResult := &v1.ControllerRevision{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(controllerrevisionsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ControllerRevision), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied controllerRevision.
func (c *FakeControllerRevisions) Apply(ctx context.Context, controllerRevision *appsv1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ControllerRevision, err error) {
if controllerRevision == nil {
return nil, fmt.Errorf("controllerRevision provided to Apply must not be nil")
}
data, err := json.Marshal(controllerRevision)
if err != nil {
return nil, err
}
name := controllerRevision.Name
if name == nil {
return nil, fmt.Errorf("controllerRevision.Name must be provided to Apply")
}
emptyResult := &v1.ControllerRevision{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(controllerrevisionsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ControllerRevision), err
} }

View File

@@ -19,179 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/apps/v1" v1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
appsv1 "k8s.io/client-go/applyconfigurations/apps/v1" appsv1 "k8s.io/client-go/applyconfigurations/apps/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
) )
// FakeDaemonSets implements DaemonSetInterface // fakeDaemonSets implements DaemonSetInterface
type FakeDaemonSets struct { type fakeDaemonSets struct {
*gentype.FakeClientWithListAndApply[*v1.DaemonSet, *v1.DaemonSetList, *appsv1.DaemonSetApplyConfiguration]
Fake *FakeAppsV1 Fake *FakeAppsV1
ns string
} }
var daemonsetsResource = v1.SchemeGroupVersion.WithResource("daemonsets") func newFakeDaemonSets(fake *FakeAppsV1, namespace string) typedappsv1.DaemonSetInterface {
return &fakeDaemonSets{
var daemonsetsKind = v1.SchemeGroupVersion.WithKind("DaemonSet") gentype.NewFakeClientWithListAndApply[*v1.DaemonSet, *v1.DaemonSetList, *appsv1.DaemonSetApplyConfiguration](
fake.Fake,
// Get takes name of the daemonSet, and returns the corresponding daemonSet object, and an error if there is any. namespace,
func (c *FakeDaemonSets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.DaemonSet, err error) { v1.SchemeGroupVersion.WithResource("daemonsets"),
emptyResult := &v1.DaemonSet{} v1.SchemeGroupVersion.WithKind("DaemonSet"),
obj, err := c.Fake. func() *v1.DaemonSet { return &v1.DaemonSet{} },
Invokes(testing.NewGetActionWithOptions(daemonsetsResource, c.ns, name, options), emptyResult) func() *v1.DaemonSetList { return &v1.DaemonSetList{} },
func(dst, src *v1.DaemonSetList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.DaemonSetList) []*v1.DaemonSet { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.DaemonSetList, items []*v1.DaemonSet) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.DaemonSet), err
}
// List takes label and field selectors, and returns the list of DaemonSets that match those selectors.
func (c *FakeDaemonSets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.DaemonSetList, err error) {
emptyResult := &v1.DaemonSetList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(daemonsetsResource, daemonsetsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.DaemonSetList{ListMeta: obj.(*v1.DaemonSetList).ListMeta}
for _, item := range obj.(*v1.DaemonSetList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested daemonSets.
func (c *FakeDaemonSets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(daemonsetsResource, c.ns, opts))
}
// Create takes the representation of a daemonSet and creates it. Returns the server's representation of the daemonSet, and an error, if there is any.
func (c *FakeDaemonSets) Create(ctx context.Context, daemonSet *v1.DaemonSet, opts metav1.CreateOptions) (result *v1.DaemonSet, err error) {
emptyResult := &v1.DaemonSet{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(daemonsetsResource, c.ns, daemonSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.DaemonSet), err
}
// Update takes the representation of a daemonSet and updates it. Returns the server's representation of the daemonSet, and an error, if there is any.
func (c *FakeDaemonSets) Update(ctx context.Context, daemonSet *v1.DaemonSet, opts metav1.UpdateOptions) (result *v1.DaemonSet, err error) {
emptyResult := &v1.DaemonSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(daemonsetsResource, c.ns, daemonSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.DaemonSet), 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 *FakeDaemonSets) UpdateStatus(ctx context.Context, daemonSet *v1.DaemonSet, opts metav1.UpdateOptions) (result *v1.DaemonSet, err error) {
emptyResult := &v1.DaemonSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(daemonsetsResource, "status", c.ns, daemonSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.DaemonSet), err
}
// Delete takes name of the daemonSet and deletes it. Returns an error if one occurs.
func (c *FakeDaemonSets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(daemonsetsResource, c.ns, name, opts), &v1.DaemonSet{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeDaemonSets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(daemonsetsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.DaemonSetList{})
return err
}
// Patch applies the patch and returns the patched daemonSet.
func (c *FakeDaemonSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.DaemonSet, err error) {
emptyResult := &v1.DaemonSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(daemonsetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.DaemonSet), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied daemonSet.
func (c *FakeDaemonSets) Apply(ctx context.Context, daemonSet *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.DaemonSet, err error) {
if daemonSet == nil {
return nil, fmt.Errorf("daemonSet provided to Apply must not be nil")
}
data, err := json.Marshal(daemonSet)
if err != nil {
return nil, err
}
name := daemonSet.Name
if name == nil {
return nil, fmt.Errorf("daemonSet.Name must be provided to Apply")
}
emptyResult := &v1.DaemonSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(daemonsetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.DaemonSet), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeDaemonSets) ApplyStatus(ctx context.Context, daemonSet *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.DaemonSet, err error) {
if daemonSet == nil {
return nil, fmt.Errorf("daemonSet provided to Apply must not be nil")
}
data, err := json.Marshal(daemonSet)
if err != nil {
return nil, err
}
name := daemonSet.Name
if name == nil {
return nil, fmt.Errorf("daemonSet.Name must be provided to Apply")
}
emptyResult := &v1.DaemonSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(daemonsetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.DaemonSet), err
} }

View File

@@ -26,183 +26,42 @@ import (
v1 "k8s.io/api/apps/v1" v1 "k8s.io/api/apps/v1"
autoscalingv1 "k8s.io/api/autoscaling/v1" autoscalingv1 "k8s.io/api/autoscaling/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
appsv1 "k8s.io/client-go/applyconfigurations/apps/v1" appsv1 "k8s.io/client-go/applyconfigurations/apps/v1"
applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1"
gentype "k8s.io/client-go/gentype"
typedappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
// FakeDeployments implements DeploymentInterface // fakeDeployments implements DeploymentInterface
type FakeDeployments struct { type fakeDeployments struct {
*gentype.FakeClientWithListAndApply[*v1.Deployment, *v1.DeploymentList, *appsv1.DeploymentApplyConfiguration]
Fake *FakeAppsV1 Fake *FakeAppsV1
ns string
} }
var deploymentsResource = v1.SchemeGroupVersion.WithResource("deployments") func newFakeDeployments(fake *FakeAppsV1, namespace string) typedappsv1.DeploymentInterface {
return &fakeDeployments{
var deploymentsKind = v1.SchemeGroupVersion.WithKind("Deployment") gentype.NewFakeClientWithListAndApply[*v1.Deployment, *v1.DeploymentList, *appsv1.DeploymentApplyConfiguration](
fake.Fake,
// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any. namespace,
func (c *FakeDeployments) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Deployment, err error) { v1.SchemeGroupVersion.WithResource("deployments"),
emptyResult := &v1.Deployment{} v1.SchemeGroupVersion.WithKind("Deployment"),
obj, err := c.Fake. func() *v1.Deployment { return &v1.Deployment{} },
Invokes(testing.NewGetActionWithOptions(deploymentsResource, c.ns, name, options), emptyResult) func() *v1.DeploymentList { return &v1.DeploymentList{} },
func(dst, src *v1.DeploymentList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.DeploymentList) []*v1.Deployment { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.DeploymentList, items []*v1.Deployment) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.Deployment), err
}
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
func (c *FakeDeployments) List(ctx context.Context, opts metav1.ListOptions) (result *v1.DeploymentList, err error) {
emptyResult := &v1.DeploymentList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(deploymentsResource, deploymentsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.DeploymentList{ListMeta: obj.(*v1.DeploymentList).ListMeta}
for _, item := range obj.(*v1.DeploymentList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested deployments.
func (c *FakeDeployments) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(deploymentsResource, c.ns, opts))
}
// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any.
func (c *FakeDeployments) Create(ctx context.Context, deployment *v1.Deployment, opts metav1.CreateOptions) (result *v1.Deployment, err error) {
emptyResult := &v1.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(deploymentsResource, c.ns, deployment, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Deployment), err
}
// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any.
func (c *FakeDeployments) Update(ctx context.Context, deployment *v1.Deployment, opts metav1.UpdateOptions) (result *v1.Deployment, err error) {
emptyResult := &v1.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(deploymentsResource, c.ns, deployment, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Deployment), 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 *FakeDeployments) UpdateStatus(ctx context.Context, deployment *v1.Deployment, opts metav1.UpdateOptions) (result *v1.Deployment, err error) {
emptyResult := &v1.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(deploymentsResource, "status", c.ns, deployment, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Deployment), err
}
// Delete takes name of the deployment and deletes it. Returns an error if one occurs.
func (c *FakeDeployments) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(deploymentsResource, c.ns, name, opts), &v1.Deployment{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeDeployments) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(deploymentsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.DeploymentList{})
return err
}
// Patch applies the patch and returns the patched deployment.
func (c *FakeDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Deployment, err error) {
emptyResult := &v1.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(deploymentsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Deployment), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied deployment.
func (c *FakeDeployments) Apply(ctx context.Context, deployment *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Deployment, err error) {
if deployment == nil {
return nil, fmt.Errorf("deployment provided to Apply must not be nil")
}
data, err := json.Marshal(deployment)
if err != nil {
return nil, err
}
name := deployment.Name
if name == nil {
return nil, fmt.Errorf("deployment.Name must be provided to Apply")
}
emptyResult := &v1.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(deploymentsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Deployment), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeDeployments) ApplyStatus(ctx context.Context, deployment *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Deployment, err error) {
if deployment == nil {
return nil, fmt.Errorf("deployment provided to Apply must not be nil")
}
data, err := json.Marshal(deployment)
if err != nil {
return nil, err
}
name := deployment.Name
if name == nil {
return nil, fmt.Errorf("deployment.Name must be provided to Apply")
}
emptyResult := &v1.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(deploymentsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Deployment), err
} }
// GetScale takes name of the deployment, and returns the corresponding scale object, and an error if there is any. // GetScale takes name of the deployment, and returns the corresponding scale object, and an error if there is any.
func (c *FakeDeployments) GetScale(ctx context.Context, deploymentName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { func (c *fakeDeployments) GetScale(ctx context.Context, deploymentName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
emptyResult := &autoscalingv1.Scale{} emptyResult := &autoscalingv1.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewGetSubresourceActionWithOptions(deploymentsResource, c.ns, "scale", deploymentName, options), emptyResult) Invokes(testing.NewGetSubresourceActionWithOptions(c.Resource(), c.Namespace(), "scale", deploymentName, options), emptyResult)
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err
@@ -211,10 +70,10 @@ func (c *FakeDeployments) GetScale(ctx context.Context, deploymentName string, o
} }
// 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. // 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 *FakeDeployments) UpdateScale(ctx context.Context, deploymentName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { func (c *fakeDeployments) UpdateScale(ctx context.Context, deploymentName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
emptyResult := &autoscalingv1.Scale{} emptyResult := &autoscalingv1.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(deploymentsResource, "scale", c.ns, scale, opts), &autoscalingv1.Scale{}) Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "scale", c.Namespace(), scale, opts), &autoscalingv1.Scale{})
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err
@@ -224,7 +83,7 @@ func (c *FakeDeployments) UpdateScale(ctx context.Context, deploymentName string
// ApplyScale takes top resource name and the apply declarative configuration for scale, // ApplyScale takes top resource name and the apply declarative configuration for scale,
// applies it and returns the applied scale, and an error, if there is any. // applies it and returns the applied scale, and an error, if there is any.
func (c *FakeDeployments) ApplyScale(ctx context.Context, deploymentName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) { func (c *fakeDeployments) ApplyScale(ctx context.Context, deploymentName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) {
if scale == nil { if scale == nil {
return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
} }
@@ -234,7 +93,7 @@ func (c *FakeDeployments) ApplyScale(ctx context.Context, deploymentName string,
} }
emptyResult := &autoscalingv1.Scale{} emptyResult := &autoscalingv1.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(deploymentsResource, c.ns, deploymentName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult) Invokes(testing.NewPatchSubresourceActionWithOptions(c.Resource(), c.Namespace(), deploymentName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult)
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err

View File

@@ -26,183 +26,42 @@ import (
v1 "k8s.io/api/apps/v1" v1 "k8s.io/api/apps/v1"
autoscalingv1 "k8s.io/api/autoscaling/v1" autoscalingv1 "k8s.io/api/autoscaling/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
appsv1 "k8s.io/client-go/applyconfigurations/apps/v1" appsv1 "k8s.io/client-go/applyconfigurations/apps/v1"
applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1"
gentype "k8s.io/client-go/gentype"
typedappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
// FakeReplicaSets implements ReplicaSetInterface // fakeReplicaSets implements ReplicaSetInterface
type FakeReplicaSets struct { type fakeReplicaSets struct {
*gentype.FakeClientWithListAndApply[*v1.ReplicaSet, *v1.ReplicaSetList, *appsv1.ReplicaSetApplyConfiguration]
Fake *FakeAppsV1 Fake *FakeAppsV1
ns string
} }
var replicasetsResource = v1.SchemeGroupVersion.WithResource("replicasets") func newFakeReplicaSets(fake *FakeAppsV1, namespace string) typedappsv1.ReplicaSetInterface {
return &fakeReplicaSets{
var replicasetsKind = v1.SchemeGroupVersion.WithKind("ReplicaSet") gentype.NewFakeClientWithListAndApply[*v1.ReplicaSet, *v1.ReplicaSetList, *appsv1.ReplicaSetApplyConfiguration](
fake.Fake,
// Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any. namespace,
func (c *FakeReplicaSets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ReplicaSet, err error) { v1.SchemeGroupVersion.WithResource("replicasets"),
emptyResult := &v1.ReplicaSet{} v1.SchemeGroupVersion.WithKind("ReplicaSet"),
obj, err := c.Fake. func() *v1.ReplicaSet { return &v1.ReplicaSet{} },
Invokes(testing.NewGetActionWithOptions(replicasetsResource, c.ns, name, options), emptyResult) func() *v1.ReplicaSetList { return &v1.ReplicaSetList{} },
func(dst, src *v1.ReplicaSetList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.ReplicaSetList) []*v1.ReplicaSet { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.ReplicaSetList, items []*v1.ReplicaSet) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.ReplicaSet), err
}
// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors.
func (c *FakeReplicaSets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ReplicaSetList, err error) {
emptyResult := &v1.ReplicaSetList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(replicasetsResource, replicasetsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ReplicaSetList{ListMeta: obj.(*v1.ReplicaSetList).ListMeta}
for _, item := range obj.(*v1.ReplicaSetList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested replicaSets.
func (c *FakeReplicaSets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(replicasetsResource, c.ns, opts))
}
// Create takes the representation of a replicaSet and creates it. Returns the server's representation of the replicaSet, and an error, if there is any.
func (c *FakeReplicaSets) Create(ctx context.Context, replicaSet *v1.ReplicaSet, opts metav1.CreateOptions) (result *v1.ReplicaSet, err error) {
emptyResult := &v1.ReplicaSet{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(replicasetsResource, c.ns, replicaSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ReplicaSet), err
}
// Update takes the representation of a replicaSet and updates it. Returns the server's representation of the replicaSet, and an error, if there is any.
func (c *FakeReplicaSets) Update(ctx context.Context, replicaSet *v1.ReplicaSet, opts metav1.UpdateOptions) (result *v1.ReplicaSet, err error) {
emptyResult := &v1.ReplicaSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(replicasetsResource, c.ns, replicaSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ReplicaSet), 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 *FakeReplicaSets) UpdateStatus(ctx context.Context, replicaSet *v1.ReplicaSet, opts metav1.UpdateOptions) (result *v1.ReplicaSet, err error) {
emptyResult := &v1.ReplicaSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(replicasetsResource, "status", c.ns, replicaSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ReplicaSet), err
}
// Delete takes name of the replicaSet and deletes it. Returns an error if one occurs.
func (c *FakeReplicaSets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(replicasetsResource, c.ns, name, opts), &v1.ReplicaSet{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeReplicaSets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(replicasetsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.ReplicaSetList{})
return err
}
// Patch applies the patch and returns the patched replicaSet.
func (c *FakeReplicaSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ReplicaSet, err error) {
emptyResult := &v1.ReplicaSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(replicasetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ReplicaSet), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied replicaSet.
func (c *FakeReplicaSets) Apply(ctx context.Context, replicaSet *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicaSet, err error) {
if replicaSet == nil {
return nil, fmt.Errorf("replicaSet provided to Apply must not be nil")
}
data, err := json.Marshal(replicaSet)
if err != nil {
return nil, err
}
name := replicaSet.Name
if name == nil {
return nil, fmt.Errorf("replicaSet.Name must be provided to Apply")
}
emptyResult := &v1.ReplicaSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(replicasetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ReplicaSet), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeReplicaSets) ApplyStatus(ctx context.Context, replicaSet *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicaSet, err error) {
if replicaSet == nil {
return nil, fmt.Errorf("replicaSet provided to Apply must not be nil")
}
data, err := json.Marshal(replicaSet)
if err != nil {
return nil, err
}
name := replicaSet.Name
if name == nil {
return nil, fmt.Errorf("replicaSet.Name must be provided to Apply")
}
emptyResult := &v1.ReplicaSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(replicasetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ReplicaSet), err
} }
// GetScale takes name of the replicaSet, and returns the corresponding scale object, and an error if there is any. // GetScale takes name of the replicaSet, and returns the corresponding scale object, and an error if there is any.
func (c *FakeReplicaSets) GetScale(ctx context.Context, replicaSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { func (c *fakeReplicaSets) GetScale(ctx context.Context, replicaSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
emptyResult := &autoscalingv1.Scale{} emptyResult := &autoscalingv1.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewGetSubresourceActionWithOptions(replicasetsResource, c.ns, "scale", replicaSetName, options), emptyResult) Invokes(testing.NewGetSubresourceActionWithOptions(c.Resource(), c.Namespace(), "scale", replicaSetName, options), emptyResult)
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err
@@ -211,10 +70,10 @@ func (c *FakeReplicaSets) GetScale(ctx context.Context, replicaSetName string, o
} }
// 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. // 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 *FakeReplicaSets) UpdateScale(ctx context.Context, replicaSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { func (c *fakeReplicaSets) UpdateScale(ctx context.Context, replicaSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
emptyResult := &autoscalingv1.Scale{} emptyResult := &autoscalingv1.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(replicasetsResource, "scale", c.ns, scale, opts), &autoscalingv1.Scale{}) Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "scale", c.Namespace(), scale, opts), &autoscalingv1.Scale{})
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err
@@ -224,7 +83,7 @@ func (c *FakeReplicaSets) UpdateScale(ctx context.Context, replicaSetName string
// ApplyScale takes top resource name and the apply declarative configuration for scale, // ApplyScale takes top resource name and the apply declarative configuration for scale,
// applies it and returns the applied scale, and an error, if there is any. // applies it and returns the applied scale, and an error, if there is any.
func (c *FakeReplicaSets) ApplyScale(ctx context.Context, replicaSetName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) { func (c *fakeReplicaSets) ApplyScale(ctx context.Context, replicaSetName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) {
if scale == nil { if scale == nil {
return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
} }
@@ -234,7 +93,7 @@ func (c *FakeReplicaSets) ApplyScale(ctx context.Context, replicaSetName string,
} }
emptyResult := &autoscalingv1.Scale{} emptyResult := &autoscalingv1.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(replicasetsResource, c.ns, replicaSetName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult) Invokes(testing.NewPatchSubresourceActionWithOptions(c.Resource(), c.Namespace(), replicaSetName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult)
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err

View File

@@ -26,183 +26,42 @@ import (
v1 "k8s.io/api/apps/v1" v1 "k8s.io/api/apps/v1"
autoscalingv1 "k8s.io/api/autoscaling/v1" autoscalingv1 "k8s.io/api/autoscaling/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
appsv1 "k8s.io/client-go/applyconfigurations/apps/v1" appsv1 "k8s.io/client-go/applyconfigurations/apps/v1"
applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1"
gentype "k8s.io/client-go/gentype"
typedappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
// FakeStatefulSets implements StatefulSetInterface // fakeStatefulSets implements StatefulSetInterface
type FakeStatefulSets struct { type fakeStatefulSets struct {
*gentype.FakeClientWithListAndApply[*v1.StatefulSet, *v1.StatefulSetList, *appsv1.StatefulSetApplyConfiguration]
Fake *FakeAppsV1 Fake *FakeAppsV1
ns string
} }
var statefulsetsResource = v1.SchemeGroupVersion.WithResource("statefulsets") func newFakeStatefulSets(fake *FakeAppsV1, namespace string) typedappsv1.StatefulSetInterface {
return &fakeStatefulSets{
var statefulsetsKind = v1.SchemeGroupVersion.WithKind("StatefulSet") gentype.NewFakeClientWithListAndApply[*v1.StatefulSet, *v1.StatefulSetList, *appsv1.StatefulSetApplyConfiguration](
fake.Fake,
// Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any. namespace,
func (c *FakeStatefulSets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.StatefulSet, err error) { v1.SchemeGroupVersion.WithResource("statefulsets"),
emptyResult := &v1.StatefulSet{} v1.SchemeGroupVersion.WithKind("StatefulSet"),
obj, err := c.Fake. func() *v1.StatefulSet { return &v1.StatefulSet{} },
Invokes(testing.NewGetActionWithOptions(statefulsetsResource, c.ns, name, options), emptyResult) func() *v1.StatefulSetList { return &v1.StatefulSetList{} },
func(dst, src *v1.StatefulSetList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.StatefulSetList) []*v1.StatefulSet { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.StatefulSetList, items []*v1.StatefulSet) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.StatefulSet), err
}
// List takes label and field selectors, and returns the list of StatefulSets that match those selectors.
func (c *FakeStatefulSets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.StatefulSetList, err error) {
emptyResult := &v1.StatefulSetList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(statefulsetsResource, statefulsetsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.StatefulSetList{ListMeta: obj.(*v1.StatefulSetList).ListMeta}
for _, item := range obj.(*v1.StatefulSetList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested statefulSets.
func (c *FakeStatefulSets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(statefulsetsResource, c.ns, opts))
}
// Create takes the representation of a statefulSet and creates it. Returns the server's representation of the statefulSet, and an error, if there is any.
func (c *FakeStatefulSets) Create(ctx context.Context, statefulSet *v1.StatefulSet, opts metav1.CreateOptions) (result *v1.StatefulSet, err error) {
emptyResult := &v1.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(statefulsetsResource, c.ns, statefulSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.StatefulSet), err
}
// Update takes the representation of a statefulSet and updates it. Returns the server's representation of the statefulSet, and an error, if there is any.
func (c *FakeStatefulSets) Update(ctx context.Context, statefulSet *v1.StatefulSet, opts metav1.UpdateOptions) (result *v1.StatefulSet, err error) {
emptyResult := &v1.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(statefulsetsResource, c.ns, statefulSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.StatefulSet), 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 *FakeStatefulSets) UpdateStatus(ctx context.Context, statefulSet *v1.StatefulSet, opts metav1.UpdateOptions) (result *v1.StatefulSet, err error) {
emptyResult := &v1.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(statefulsetsResource, "status", c.ns, statefulSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.StatefulSet), err
}
// Delete takes name of the statefulSet and deletes it. Returns an error if one occurs.
func (c *FakeStatefulSets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(statefulsetsResource, c.ns, name, opts), &v1.StatefulSet{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeStatefulSets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(statefulsetsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.StatefulSetList{})
return err
}
// Patch applies the patch and returns the patched statefulSet.
func (c *FakeStatefulSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.StatefulSet, err error) {
emptyResult := &v1.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(statefulsetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.StatefulSet), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied statefulSet.
func (c *FakeStatefulSets) Apply(ctx context.Context, statefulSet *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.StatefulSet, err error) {
if statefulSet == nil {
return nil, fmt.Errorf("statefulSet provided to Apply must not be nil")
}
data, err := json.Marshal(statefulSet)
if err != nil {
return nil, err
}
name := statefulSet.Name
if name == nil {
return nil, fmt.Errorf("statefulSet.Name must be provided to Apply")
}
emptyResult := &v1.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(statefulsetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.StatefulSet), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeStatefulSets) ApplyStatus(ctx context.Context, statefulSet *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.StatefulSet, err error) {
if statefulSet == nil {
return nil, fmt.Errorf("statefulSet provided to Apply must not be nil")
}
data, err := json.Marshal(statefulSet)
if err != nil {
return nil, err
}
name := statefulSet.Name
if name == nil {
return nil, fmt.Errorf("statefulSet.Name must be provided to Apply")
}
emptyResult := &v1.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(statefulsetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.StatefulSet), err
} }
// GetScale takes name of the statefulSet, and returns the corresponding scale object, and an error if there is any. // GetScale takes name of the statefulSet, and returns the corresponding scale object, and an error if there is any.
func (c *FakeStatefulSets) GetScale(ctx context.Context, statefulSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { func (c *fakeStatefulSets) GetScale(ctx context.Context, statefulSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
emptyResult := &autoscalingv1.Scale{} emptyResult := &autoscalingv1.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewGetSubresourceActionWithOptions(statefulsetsResource, c.ns, "scale", statefulSetName, options), emptyResult) Invokes(testing.NewGetSubresourceActionWithOptions(c.Resource(), c.Namespace(), "scale", statefulSetName, options), emptyResult)
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err
@@ -211,10 +70,10 @@ func (c *FakeStatefulSets) GetScale(ctx context.Context, statefulSetName string,
} }
// 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. // 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 *FakeStatefulSets) UpdateScale(ctx context.Context, statefulSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { func (c *fakeStatefulSets) UpdateScale(ctx context.Context, statefulSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
emptyResult := &autoscalingv1.Scale{} emptyResult := &autoscalingv1.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(statefulsetsResource, "scale", c.ns, scale, opts), &autoscalingv1.Scale{}) Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "scale", c.Namespace(), scale, opts), &autoscalingv1.Scale{})
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err
@@ -224,7 +83,7 @@ func (c *FakeStatefulSets) UpdateScale(ctx context.Context, statefulSetName stri
// ApplyScale takes top resource name and the apply declarative configuration for scale, // ApplyScale takes top resource name and the apply declarative configuration for scale,
// applies it and returns the applied scale, and an error, if there is any. // applies it and returns the applied scale, and an error, if there is any.
func (c *FakeStatefulSets) ApplyScale(ctx context.Context, statefulSetName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) { func (c *fakeStatefulSets) ApplyScale(ctx context.Context, statefulSetName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) {
if scale == nil { if scale == nil {
return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
} }
@@ -234,7 +93,7 @@ func (c *FakeStatefulSets) ApplyScale(ctx context.Context, statefulSetName strin
} }
emptyResult := &autoscalingv1.Scale{} emptyResult := &autoscalingv1.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(statefulsetsResource, c.ns, statefulSetName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult) Invokes(testing.NewPatchSubresourceActionWithOptions(c.Resource(), c.Namespace(), statefulSetName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult)
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err

View File

@@ -29,15 +29,15 @@ type FakeAppsV1beta1 struct {
} }
func (c *FakeAppsV1beta1) ControllerRevisions(namespace string) v1beta1.ControllerRevisionInterface { func (c *FakeAppsV1beta1) ControllerRevisions(namespace string) v1beta1.ControllerRevisionInterface {
return &FakeControllerRevisions{c, namespace} return newFakeControllerRevisions(c, namespace)
} }
func (c *FakeAppsV1beta1) Deployments(namespace string) v1beta1.DeploymentInterface { func (c *FakeAppsV1beta1) Deployments(namespace string) v1beta1.DeploymentInterface {
return &FakeDeployments{c, namespace} return newFakeDeployments(c, namespace)
} }
func (c *FakeAppsV1beta1) StatefulSets(namespace string) v1beta1.StatefulSetInterface { func (c *FakeAppsV1beta1) StatefulSets(namespace string) v1beta1.StatefulSetInterface {
return &FakeStatefulSets{c, namespace} return newFakeStatefulSets(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,142 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta1 "k8s.io/api/apps/v1beta1" v1beta1 "k8s.io/api/apps/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
appsv1beta1 "k8s.io/client-go/applyconfigurations/apps/v1beta1" appsv1beta1 "k8s.io/client-go/applyconfigurations/apps/v1beta1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1"
) )
// FakeControllerRevisions implements ControllerRevisionInterface // fakeControllerRevisions implements ControllerRevisionInterface
type FakeControllerRevisions struct { type fakeControllerRevisions struct {
*gentype.FakeClientWithListAndApply[*v1beta1.ControllerRevision, *v1beta1.ControllerRevisionList, *appsv1beta1.ControllerRevisionApplyConfiguration]
Fake *FakeAppsV1beta1 Fake *FakeAppsV1beta1
ns string
} }
var controllerrevisionsResource = v1beta1.SchemeGroupVersion.WithResource("controllerrevisions") func newFakeControllerRevisions(fake *FakeAppsV1beta1, namespace string) typedappsv1beta1.ControllerRevisionInterface {
return &fakeControllerRevisions{
var controllerrevisionsKind = v1beta1.SchemeGroupVersion.WithKind("ControllerRevision") gentype.NewFakeClientWithListAndApply[*v1beta1.ControllerRevision, *v1beta1.ControllerRevisionList, *appsv1beta1.ControllerRevisionApplyConfiguration](
fake.Fake,
// Get takes name of the controllerRevision, and returns the corresponding controllerRevision object, and an error if there is any. namespace,
func (c *FakeControllerRevisions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ControllerRevision, err error) { v1beta1.SchemeGroupVersion.WithResource("controllerrevisions"),
emptyResult := &v1beta1.ControllerRevision{} v1beta1.SchemeGroupVersion.WithKind("ControllerRevision"),
obj, err := c.Fake. func() *v1beta1.ControllerRevision { return &v1beta1.ControllerRevision{} },
Invokes(testing.NewGetActionWithOptions(controllerrevisionsResource, c.ns, name, options), emptyResult) func() *v1beta1.ControllerRevisionList { return &v1beta1.ControllerRevisionList{} },
func(dst, src *v1beta1.ControllerRevisionList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1beta1.ControllerRevisionList) []*v1beta1.ControllerRevision {
return emptyResult, err return gentype.ToPointerSlice(list.Items)
},
func(list *v1beta1.ControllerRevisionList, items []*v1beta1.ControllerRevision) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta1.ControllerRevision), err
}
// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors.
func (c *FakeControllerRevisions) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ControllerRevisionList, err error) {
emptyResult := &v1beta1.ControllerRevisionList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(controllerrevisionsResource, controllerrevisionsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.ControllerRevisionList{ListMeta: obj.(*v1beta1.ControllerRevisionList).ListMeta}
for _, item := range obj.(*v1beta1.ControllerRevisionList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested controllerRevisions.
func (c *FakeControllerRevisions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(controllerrevisionsResource, c.ns, opts))
}
// Create takes the representation of a controllerRevision and creates it. Returns the server's representation of the controllerRevision, and an error, if there is any.
func (c *FakeControllerRevisions) Create(ctx context.Context, controllerRevision *v1beta1.ControllerRevision, opts v1.CreateOptions) (result *v1beta1.ControllerRevision, err error) {
emptyResult := &v1beta1.ControllerRevision{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(controllerrevisionsResource, c.ns, controllerRevision, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ControllerRevision), err
}
// Update takes the representation of a controllerRevision and updates it. Returns the server's representation of the controllerRevision, and an error, if there is any.
func (c *FakeControllerRevisions) Update(ctx context.Context, controllerRevision *v1beta1.ControllerRevision, opts v1.UpdateOptions) (result *v1beta1.ControllerRevision, err error) {
emptyResult := &v1beta1.ControllerRevision{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(controllerrevisionsResource, c.ns, controllerRevision, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ControllerRevision), err
}
// Delete takes name of the controllerRevision and deletes it. Returns an error if one occurs.
func (c *FakeControllerRevisions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(controllerrevisionsResource, c.ns, name, opts), &v1beta1.ControllerRevision{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeControllerRevisions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(controllerrevisionsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.ControllerRevisionList{})
return err
}
// Patch applies the patch and returns the patched controllerRevision.
func (c *FakeControllerRevisions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ControllerRevision, err error) {
emptyResult := &v1beta1.ControllerRevision{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(controllerrevisionsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ControllerRevision), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied controllerRevision.
func (c *FakeControllerRevisions) Apply(ctx context.Context, controllerRevision *appsv1beta1.ControllerRevisionApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ControllerRevision, err error) {
if controllerRevision == nil {
return nil, fmt.Errorf("controllerRevision provided to Apply must not be nil")
}
data, err := json.Marshal(controllerRevision)
if err != nil {
return nil, err
}
name := controllerRevision.Name
if name == nil {
return nil, fmt.Errorf("controllerRevision.Name must be provided to Apply")
}
emptyResult := &v1beta1.ControllerRevision{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(controllerrevisionsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ControllerRevision), err
} }

View File

@@ -19,179 +19,33 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta1 "k8s.io/api/apps/v1beta1" v1beta1 "k8s.io/api/apps/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
appsv1beta1 "k8s.io/client-go/applyconfigurations/apps/v1beta1" appsv1beta1 "k8s.io/client-go/applyconfigurations/apps/v1beta1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1"
) )
// FakeDeployments implements DeploymentInterface // fakeDeployments implements DeploymentInterface
type FakeDeployments struct { type fakeDeployments struct {
*gentype.FakeClientWithListAndApply[*v1beta1.Deployment, *v1beta1.DeploymentList, *appsv1beta1.DeploymentApplyConfiguration]
Fake *FakeAppsV1beta1 Fake *FakeAppsV1beta1
ns string
} }
var deploymentsResource = v1beta1.SchemeGroupVersion.WithResource("deployments") func newFakeDeployments(fake *FakeAppsV1beta1, namespace string) typedappsv1beta1.DeploymentInterface {
return &fakeDeployments{
var deploymentsKind = v1beta1.SchemeGroupVersion.WithKind("Deployment") gentype.NewFakeClientWithListAndApply[*v1beta1.Deployment, *v1beta1.DeploymentList, *appsv1beta1.DeploymentApplyConfiguration](
fake.Fake,
// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any. namespace,
func (c *FakeDeployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Deployment, err error) { v1beta1.SchemeGroupVersion.WithResource("deployments"),
emptyResult := &v1beta1.Deployment{} v1beta1.SchemeGroupVersion.WithKind("Deployment"),
obj, err := c.Fake. func() *v1beta1.Deployment { return &v1beta1.Deployment{} },
Invokes(testing.NewGetActionWithOptions(deploymentsResource, c.ns, name, options), emptyResult) func() *v1beta1.DeploymentList { return &v1beta1.DeploymentList{} },
func(dst, src *v1beta1.DeploymentList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1beta1.DeploymentList) []*v1beta1.Deployment { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1beta1.DeploymentList, items []*v1beta1.Deployment) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta1.Deployment), err
}
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
func (c *FakeDeployments) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DeploymentList, err error) {
emptyResult := &v1beta1.DeploymentList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(deploymentsResource, deploymentsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.DeploymentList{ListMeta: obj.(*v1beta1.DeploymentList).ListMeta}
for _, item := range obj.(*v1beta1.DeploymentList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested deployments.
func (c *FakeDeployments) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(deploymentsResource, c.ns, opts))
}
// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any.
func (c *FakeDeployments) Create(ctx context.Context, deployment *v1beta1.Deployment, opts v1.CreateOptions) (result *v1beta1.Deployment, err error) {
emptyResult := &v1beta1.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(deploymentsResource, c.ns, deployment, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.Deployment), err
}
// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any.
func (c *FakeDeployments) Update(ctx context.Context, deployment *v1beta1.Deployment, opts v1.UpdateOptions) (result *v1beta1.Deployment, err error) {
emptyResult := &v1beta1.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(deploymentsResource, c.ns, deployment, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.Deployment), 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 *FakeDeployments) UpdateStatus(ctx context.Context, deployment *v1beta1.Deployment, opts v1.UpdateOptions) (result *v1beta1.Deployment, err error) {
emptyResult := &v1beta1.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(deploymentsResource, "status", c.ns, deployment, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.Deployment), err
}
// Delete takes name of the deployment and deletes it. Returns an error if one occurs.
func (c *FakeDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(deploymentsResource, c.ns, name, opts), &v1beta1.Deployment{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeDeployments) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(deploymentsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.DeploymentList{})
return err
}
// Patch applies the patch and returns the patched deployment.
func (c *FakeDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Deployment, err error) {
emptyResult := &v1beta1.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(deploymentsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.Deployment), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied deployment.
func (c *FakeDeployments) Apply(ctx context.Context, deployment *appsv1beta1.DeploymentApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Deployment, err error) {
if deployment == nil {
return nil, fmt.Errorf("deployment provided to Apply must not be nil")
}
data, err := json.Marshal(deployment)
if err != nil {
return nil, err
}
name := deployment.Name
if name == nil {
return nil, fmt.Errorf("deployment.Name must be provided to Apply")
}
emptyResult := &v1beta1.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(deploymentsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.Deployment), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeDeployments) ApplyStatus(ctx context.Context, deployment *appsv1beta1.DeploymentApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Deployment, err error) {
if deployment == nil {
return nil, fmt.Errorf("deployment provided to Apply must not be nil")
}
data, err := json.Marshal(deployment)
if err != nil {
return nil, err
}
name := deployment.Name
if name == nil {
return nil, fmt.Errorf("deployment.Name must be provided to Apply")
}
emptyResult := &v1beta1.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(deploymentsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.Deployment), err
} }

View File

@@ -19,179 +19,33 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta1 "k8s.io/api/apps/v1beta1" v1beta1 "k8s.io/api/apps/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
appsv1beta1 "k8s.io/client-go/applyconfigurations/apps/v1beta1" appsv1beta1 "k8s.io/client-go/applyconfigurations/apps/v1beta1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1"
) )
// FakeStatefulSets implements StatefulSetInterface // fakeStatefulSets implements StatefulSetInterface
type FakeStatefulSets struct { type fakeStatefulSets struct {
*gentype.FakeClientWithListAndApply[*v1beta1.StatefulSet, *v1beta1.StatefulSetList, *appsv1beta1.StatefulSetApplyConfiguration]
Fake *FakeAppsV1beta1 Fake *FakeAppsV1beta1
ns string
} }
var statefulsetsResource = v1beta1.SchemeGroupVersion.WithResource("statefulsets") func newFakeStatefulSets(fake *FakeAppsV1beta1, namespace string) typedappsv1beta1.StatefulSetInterface {
return &fakeStatefulSets{
var statefulsetsKind = v1beta1.SchemeGroupVersion.WithKind("StatefulSet") gentype.NewFakeClientWithListAndApply[*v1beta1.StatefulSet, *v1beta1.StatefulSetList, *appsv1beta1.StatefulSetApplyConfiguration](
fake.Fake,
// Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any. namespace,
func (c *FakeStatefulSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.StatefulSet, err error) { v1beta1.SchemeGroupVersion.WithResource("statefulsets"),
emptyResult := &v1beta1.StatefulSet{} v1beta1.SchemeGroupVersion.WithKind("StatefulSet"),
obj, err := c.Fake. func() *v1beta1.StatefulSet { return &v1beta1.StatefulSet{} },
Invokes(testing.NewGetActionWithOptions(statefulsetsResource, c.ns, name, options), emptyResult) func() *v1beta1.StatefulSetList { return &v1beta1.StatefulSetList{} },
func(dst, src *v1beta1.StatefulSetList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1beta1.StatefulSetList) []*v1beta1.StatefulSet { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1beta1.StatefulSetList, items []*v1beta1.StatefulSet) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta1.StatefulSet), err
}
// List takes label and field selectors, and returns the list of StatefulSets that match those selectors.
func (c *FakeStatefulSets) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.StatefulSetList, err error) {
emptyResult := &v1beta1.StatefulSetList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(statefulsetsResource, statefulsetsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.StatefulSetList{ListMeta: obj.(*v1beta1.StatefulSetList).ListMeta}
for _, item := range obj.(*v1beta1.StatefulSetList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested statefulSets.
func (c *FakeStatefulSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(statefulsetsResource, c.ns, opts))
}
// Create takes the representation of a statefulSet and creates it. Returns the server's representation of the statefulSet, and an error, if there is any.
func (c *FakeStatefulSets) Create(ctx context.Context, statefulSet *v1beta1.StatefulSet, opts v1.CreateOptions) (result *v1beta1.StatefulSet, err error) {
emptyResult := &v1beta1.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(statefulsetsResource, c.ns, statefulSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.StatefulSet), err
}
// Update takes the representation of a statefulSet and updates it. Returns the server's representation of the statefulSet, and an error, if there is any.
func (c *FakeStatefulSets) Update(ctx context.Context, statefulSet *v1beta1.StatefulSet, opts v1.UpdateOptions) (result *v1beta1.StatefulSet, err error) {
emptyResult := &v1beta1.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(statefulsetsResource, c.ns, statefulSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.StatefulSet), 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 *FakeStatefulSets) UpdateStatus(ctx context.Context, statefulSet *v1beta1.StatefulSet, opts v1.UpdateOptions) (result *v1beta1.StatefulSet, err error) {
emptyResult := &v1beta1.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(statefulsetsResource, "status", c.ns, statefulSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.StatefulSet), err
}
// Delete takes name of the statefulSet and deletes it. Returns an error if one occurs.
func (c *FakeStatefulSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(statefulsetsResource, c.ns, name, opts), &v1beta1.StatefulSet{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeStatefulSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(statefulsetsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.StatefulSetList{})
return err
}
// Patch applies the patch and returns the patched statefulSet.
func (c *FakeStatefulSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.StatefulSet, err error) {
emptyResult := &v1beta1.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(statefulsetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.StatefulSet), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied statefulSet.
func (c *FakeStatefulSets) Apply(ctx context.Context, statefulSet *appsv1beta1.StatefulSetApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.StatefulSet, err error) {
if statefulSet == nil {
return nil, fmt.Errorf("statefulSet provided to Apply must not be nil")
}
data, err := json.Marshal(statefulSet)
if err != nil {
return nil, err
}
name := statefulSet.Name
if name == nil {
return nil, fmt.Errorf("statefulSet.Name must be provided to Apply")
}
emptyResult := &v1beta1.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(statefulsetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.StatefulSet), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeStatefulSets) ApplyStatus(ctx context.Context, statefulSet *appsv1beta1.StatefulSetApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.StatefulSet, err error) {
if statefulSet == nil {
return nil, fmt.Errorf("statefulSet provided to Apply must not be nil")
}
data, err := json.Marshal(statefulSet)
if err != nil {
return nil, err
}
name := statefulSet.Name
if name == nil {
return nil, fmt.Errorf("statefulSet.Name must be provided to Apply")
}
emptyResult := &v1beta1.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(statefulsetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.StatefulSet), err
} }

View File

@@ -29,23 +29,23 @@ type FakeAppsV1beta2 struct {
} }
func (c *FakeAppsV1beta2) ControllerRevisions(namespace string) v1beta2.ControllerRevisionInterface { func (c *FakeAppsV1beta2) ControllerRevisions(namespace string) v1beta2.ControllerRevisionInterface {
return &FakeControllerRevisions{c, namespace} return newFakeControllerRevisions(c, namespace)
} }
func (c *FakeAppsV1beta2) DaemonSets(namespace string) v1beta2.DaemonSetInterface { func (c *FakeAppsV1beta2) DaemonSets(namespace string) v1beta2.DaemonSetInterface {
return &FakeDaemonSets{c, namespace} return newFakeDaemonSets(c, namespace)
} }
func (c *FakeAppsV1beta2) Deployments(namespace string) v1beta2.DeploymentInterface { func (c *FakeAppsV1beta2) Deployments(namespace string) v1beta2.DeploymentInterface {
return &FakeDeployments{c, namespace} return newFakeDeployments(c, namespace)
} }
func (c *FakeAppsV1beta2) ReplicaSets(namespace string) v1beta2.ReplicaSetInterface { func (c *FakeAppsV1beta2) ReplicaSets(namespace string) v1beta2.ReplicaSetInterface {
return &FakeReplicaSets{c, namespace} return newFakeReplicaSets(c, namespace)
} }
func (c *FakeAppsV1beta2) StatefulSets(namespace string) v1beta2.StatefulSetInterface { func (c *FakeAppsV1beta2) StatefulSets(namespace string) v1beta2.StatefulSetInterface {
return &FakeStatefulSets{c, namespace} return newFakeStatefulSets(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,142 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta2 "k8s.io/api/apps/v1beta2" v1beta2 "k8s.io/api/apps/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2" appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
) )
// FakeControllerRevisions implements ControllerRevisionInterface // fakeControllerRevisions implements ControllerRevisionInterface
type FakeControllerRevisions struct { type fakeControllerRevisions struct {
*gentype.FakeClientWithListAndApply[*v1beta2.ControllerRevision, *v1beta2.ControllerRevisionList, *appsv1beta2.ControllerRevisionApplyConfiguration]
Fake *FakeAppsV1beta2 Fake *FakeAppsV1beta2
ns string
} }
var controllerrevisionsResource = v1beta2.SchemeGroupVersion.WithResource("controllerrevisions") func newFakeControllerRevisions(fake *FakeAppsV1beta2, namespace string) typedappsv1beta2.ControllerRevisionInterface {
return &fakeControllerRevisions{
var controllerrevisionsKind = v1beta2.SchemeGroupVersion.WithKind("ControllerRevision") gentype.NewFakeClientWithListAndApply[*v1beta2.ControllerRevision, *v1beta2.ControllerRevisionList, *appsv1beta2.ControllerRevisionApplyConfiguration](
fake.Fake,
// Get takes name of the controllerRevision, and returns the corresponding controllerRevision object, and an error if there is any. namespace,
func (c *FakeControllerRevisions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.ControllerRevision, err error) { v1beta2.SchemeGroupVersion.WithResource("controllerrevisions"),
emptyResult := &v1beta2.ControllerRevision{} v1beta2.SchemeGroupVersion.WithKind("ControllerRevision"),
obj, err := c.Fake. func() *v1beta2.ControllerRevision { return &v1beta2.ControllerRevision{} },
Invokes(testing.NewGetActionWithOptions(controllerrevisionsResource, c.ns, name, options), emptyResult) func() *v1beta2.ControllerRevisionList { return &v1beta2.ControllerRevisionList{} },
func(dst, src *v1beta2.ControllerRevisionList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1beta2.ControllerRevisionList) []*v1beta2.ControllerRevision {
return emptyResult, err return gentype.ToPointerSlice(list.Items)
},
func(list *v1beta2.ControllerRevisionList, items []*v1beta2.ControllerRevision) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta2.ControllerRevision), err
}
// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors.
func (c *FakeControllerRevisions) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.ControllerRevisionList, err error) {
emptyResult := &v1beta2.ControllerRevisionList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(controllerrevisionsResource, controllerrevisionsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta2.ControllerRevisionList{ListMeta: obj.(*v1beta2.ControllerRevisionList).ListMeta}
for _, item := range obj.(*v1beta2.ControllerRevisionList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested controllerRevisions.
func (c *FakeControllerRevisions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(controllerrevisionsResource, c.ns, opts))
}
// Create takes the representation of a controllerRevision and creates it. Returns the server's representation of the controllerRevision, and an error, if there is any.
func (c *FakeControllerRevisions) Create(ctx context.Context, controllerRevision *v1beta2.ControllerRevision, opts v1.CreateOptions) (result *v1beta2.ControllerRevision, err error) {
emptyResult := &v1beta2.ControllerRevision{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(controllerrevisionsResource, c.ns, controllerRevision, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.ControllerRevision), err
}
// Update takes the representation of a controllerRevision and updates it. Returns the server's representation of the controllerRevision, and an error, if there is any.
func (c *FakeControllerRevisions) Update(ctx context.Context, controllerRevision *v1beta2.ControllerRevision, opts v1.UpdateOptions) (result *v1beta2.ControllerRevision, err error) {
emptyResult := &v1beta2.ControllerRevision{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(controllerrevisionsResource, c.ns, controllerRevision, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.ControllerRevision), err
}
// Delete takes name of the controllerRevision and deletes it. Returns an error if one occurs.
func (c *FakeControllerRevisions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(controllerrevisionsResource, c.ns, name, opts), &v1beta2.ControllerRevision{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeControllerRevisions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(controllerrevisionsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta2.ControllerRevisionList{})
return err
}
// Patch applies the patch and returns the patched controllerRevision.
func (c *FakeControllerRevisions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.ControllerRevision, err error) {
emptyResult := &v1beta2.ControllerRevision{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(controllerrevisionsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.ControllerRevision), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied controllerRevision.
func (c *FakeControllerRevisions) Apply(ctx context.Context, controllerRevision *appsv1beta2.ControllerRevisionApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.ControllerRevision, err error) {
if controllerRevision == nil {
return nil, fmt.Errorf("controllerRevision provided to Apply must not be nil")
}
data, err := json.Marshal(controllerRevision)
if err != nil {
return nil, err
}
name := controllerRevision.Name
if name == nil {
return nil, fmt.Errorf("controllerRevision.Name must be provided to Apply")
}
emptyResult := &v1beta2.ControllerRevision{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(controllerrevisionsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.ControllerRevision), err
} }

View File

@@ -19,179 +19,33 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta2 "k8s.io/api/apps/v1beta2" v1beta2 "k8s.io/api/apps/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2" appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
) )
// FakeDaemonSets implements DaemonSetInterface // fakeDaemonSets implements DaemonSetInterface
type FakeDaemonSets struct { type fakeDaemonSets struct {
*gentype.FakeClientWithListAndApply[*v1beta2.DaemonSet, *v1beta2.DaemonSetList, *appsv1beta2.DaemonSetApplyConfiguration]
Fake *FakeAppsV1beta2 Fake *FakeAppsV1beta2
ns string
} }
var daemonsetsResource = v1beta2.SchemeGroupVersion.WithResource("daemonsets") func newFakeDaemonSets(fake *FakeAppsV1beta2, namespace string) typedappsv1beta2.DaemonSetInterface {
return &fakeDaemonSets{
var daemonsetsKind = v1beta2.SchemeGroupVersion.WithKind("DaemonSet") gentype.NewFakeClientWithListAndApply[*v1beta2.DaemonSet, *v1beta2.DaemonSetList, *appsv1beta2.DaemonSetApplyConfiguration](
fake.Fake,
// Get takes name of the daemonSet, and returns the corresponding daemonSet object, and an error if there is any. namespace,
func (c *FakeDaemonSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.DaemonSet, err error) { v1beta2.SchemeGroupVersion.WithResource("daemonsets"),
emptyResult := &v1beta2.DaemonSet{} v1beta2.SchemeGroupVersion.WithKind("DaemonSet"),
obj, err := c.Fake. func() *v1beta2.DaemonSet { return &v1beta2.DaemonSet{} },
Invokes(testing.NewGetActionWithOptions(daemonsetsResource, c.ns, name, options), emptyResult) func() *v1beta2.DaemonSetList { return &v1beta2.DaemonSetList{} },
func(dst, src *v1beta2.DaemonSetList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1beta2.DaemonSetList) []*v1beta2.DaemonSet { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1beta2.DaemonSetList, items []*v1beta2.DaemonSet) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta2.DaemonSet), err
}
// List takes label and field selectors, and returns the list of DaemonSets that match those selectors.
func (c *FakeDaemonSets) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.DaemonSetList, err error) {
emptyResult := &v1beta2.DaemonSetList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(daemonsetsResource, daemonsetsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta2.DaemonSetList{ListMeta: obj.(*v1beta2.DaemonSetList).ListMeta}
for _, item := range obj.(*v1beta2.DaemonSetList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested daemonSets.
func (c *FakeDaemonSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(daemonsetsResource, c.ns, opts))
}
// Create takes the representation of a daemonSet and creates it. Returns the server's representation of the daemonSet, and an error, if there is any.
func (c *FakeDaemonSets) Create(ctx context.Context, daemonSet *v1beta2.DaemonSet, opts v1.CreateOptions) (result *v1beta2.DaemonSet, err error) {
emptyResult := &v1beta2.DaemonSet{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(daemonsetsResource, c.ns, daemonSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.DaemonSet), err
}
// Update takes the representation of a daemonSet and updates it. Returns the server's representation of the daemonSet, and an error, if there is any.
func (c *FakeDaemonSets) Update(ctx context.Context, daemonSet *v1beta2.DaemonSet, opts v1.UpdateOptions) (result *v1beta2.DaemonSet, err error) {
emptyResult := &v1beta2.DaemonSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(daemonsetsResource, c.ns, daemonSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.DaemonSet), 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 *FakeDaemonSets) UpdateStatus(ctx context.Context, daemonSet *v1beta2.DaemonSet, opts v1.UpdateOptions) (result *v1beta2.DaemonSet, err error) {
emptyResult := &v1beta2.DaemonSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(daemonsetsResource, "status", c.ns, daemonSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.DaemonSet), err
}
// Delete takes name of the daemonSet and deletes it. Returns an error if one occurs.
func (c *FakeDaemonSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(daemonsetsResource, c.ns, name, opts), &v1beta2.DaemonSet{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeDaemonSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(daemonsetsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta2.DaemonSetList{})
return err
}
// Patch applies the patch and returns the patched daemonSet.
func (c *FakeDaemonSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.DaemonSet, err error) {
emptyResult := &v1beta2.DaemonSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(daemonsetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.DaemonSet), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied daemonSet.
func (c *FakeDaemonSets) Apply(ctx context.Context, daemonSet *appsv1beta2.DaemonSetApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.DaemonSet, err error) {
if daemonSet == nil {
return nil, fmt.Errorf("daemonSet provided to Apply must not be nil")
}
data, err := json.Marshal(daemonSet)
if err != nil {
return nil, err
}
name := daemonSet.Name
if name == nil {
return nil, fmt.Errorf("daemonSet.Name must be provided to Apply")
}
emptyResult := &v1beta2.DaemonSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(daemonsetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.DaemonSet), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeDaemonSets) ApplyStatus(ctx context.Context, daemonSet *appsv1beta2.DaemonSetApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.DaemonSet, err error) {
if daemonSet == nil {
return nil, fmt.Errorf("daemonSet provided to Apply must not be nil")
}
data, err := json.Marshal(daemonSet)
if err != nil {
return nil, err
}
name := daemonSet.Name
if name == nil {
return nil, fmt.Errorf("daemonSet.Name must be provided to Apply")
}
emptyResult := &v1beta2.DaemonSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(daemonsetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.DaemonSet), err
} }

View File

@@ -19,179 +19,33 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta2 "k8s.io/api/apps/v1beta2" v1beta2 "k8s.io/api/apps/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2" appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
) )
// FakeDeployments implements DeploymentInterface // fakeDeployments implements DeploymentInterface
type FakeDeployments struct { type fakeDeployments struct {
*gentype.FakeClientWithListAndApply[*v1beta2.Deployment, *v1beta2.DeploymentList, *appsv1beta2.DeploymentApplyConfiguration]
Fake *FakeAppsV1beta2 Fake *FakeAppsV1beta2
ns string
} }
var deploymentsResource = v1beta2.SchemeGroupVersion.WithResource("deployments") func newFakeDeployments(fake *FakeAppsV1beta2, namespace string) typedappsv1beta2.DeploymentInterface {
return &fakeDeployments{
var deploymentsKind = v1beta2.SchemeGroupVersion.WithKind("Deployment") gentype.NewFakeClientWithListAndApply[*v1beta2.Deployment, *v1beta2.DeploymentList, *appsv1beta2.DeploymentApplyConfiguration](
fake.Fake,
// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any. namespace,
func (c *FakeDeployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Deployment, err error) { v1beta2.SchemeGroupVersion.WithResource("deployments"),
emptyResult := &v1beta2.Deployment{} v1beta2.SchemeGroupVersion.WithKind("Deployment"),
obj, err := c.Fake. func() *v1beta2.Deployment { return &v1beta2.Deployment{} },
Invokes(testing.NewGetActionWithOptions(deploymentsResource, c.ns, name, options), emptyResult) func() *v1beta2.DeploymentList { return &v1beta2.DeploymentList{} },
func(dst, src *v1beta2.DeploymentList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1beta2.DeploymentList) []*v1beta2.Deployment { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1beta2.DeploymentList, items []*v1beta2.Deployment) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta2.Deployment), err
}
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
func (c *FakeDeployments) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.DeploymentList, err error) {
emptyResult := &v1beta2.DeploymentList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(deploymentsResource, deploymentsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta2.DeploymentList{ListMeta: obj.(*v1beta2.DeploymentList).ListMeta}
for _, item := range obj.(*v1beta2.DeploymentList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested deployments.
func (c *FakeDeployments) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(deploymentsResource, c.ns, opts))
}
// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any.
func (c *FakeDeployments) Create(ctx context.Context, deployment *v1beta2.Deployment, opts v1.CreateOptions) (result *v1beta2.Deployment, err error) {
emptyResult := &v1beta2.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(deploymentsResource, c.ns, deployment, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.Deployment), err
}
// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any.
func (c *FakeDeployments) Update(ctx context.Context, deployment *v1beta2.Deployment, opts v1.UpdateOptions) (result *v1beta2.Deployment, err error) {
emptyResult := &v1beta2.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(deploymentsResource, c.ns, deployment, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.Deployment), 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 *FakeDeployments) UpdateStatus(ctx context.Context, deployment *v1beta2.Deployment, opts v1.UpdateOptions) (result *v1beta2.Deployment, err error) {
emptyResult := &v1beta2.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(deploymentsResource, "status", c.ns, deployment, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.Deployment), err
}
// Delete takes name of the deployment and deletes it. Returns an error if one occurs.
func (c *FakeDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(deploymentsResource, c.ns, name, opts), &v1beta2.Deployment{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeDeployments) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(deploymentsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta2.DeploymentList{})
return err
}
// Patch applies the patch and returns the patched deployment.
func (c *FakeDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Deployment, err error) {
emptyResult := &v1beta2.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(deploymentsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.Deployment), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied deployment.
func (c *FakeDeployments) Apply(ctx context.Context, deployment *appsv1beta2.DeploymentApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Deployment, err error) {
if deployment == nil {
return nil, fmt.Errorf("deployment provided to Apply must not be nil")
}
data, err := json.Marshal(deployment)
if err != nil {
return nil, err
}
name := deployment.Name
if name == nil {
return nil, fmt.Errorf("deployment.Name must be provided to Apply")
}
emptyResult := &v1beta2.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(deploymentsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.Deployment), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeDeployments) ApplyStatus(ctx context.Context, deployment *appsv1beta2.DeploymentApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Deployment, err error) {
if deployment == nil {
return nil, fmt.Errorf("deployment provided to Apply must not be nil")
}
data, err := json.Marshal(deployment)
if err != nil {
return nil, err
}
name := deployment.Name
if name == nil {
return nil, fmt.Errorf("deployment.Name must be provided to Apply")
}
emptyResult := &v1beta2.Deployment{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(deploymentsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.Deployment), err
} }

View File

@@ -19,179 +19,33 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta2 "k8s.io/api/apps/v1beta2" v1beta2 "k8s.io/api/apps/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2" appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
) )
// FakeReplicaSets implements ReplicaSetInterface // fakeReplicaSets implements ReplicaSetInterface
type FakeReplicaSets struct { type fakeReplicaSets struct {
*gentype.FakeClientWithListAndApply[*v1beta2.ReplicaSet, *v1beta2.ReplicaSetList, *appsv1beta2.ReplicaSetApplyConfiguration]
Fake *FakeAppsV1beta2 Fake *FakeAppsV1beta2
ns string
} }
var replicasetsResource = v1beta2.SchemeGroupVersion.WithResource("replicasets") func newFakeReplicaSets(fake *FakeAppsV1beta2, namespace string) typedappsv1beta2.ReplicaSetInterface {
return &fakeReplicaSets{
var replicasetsKind = v1beta2.SchemeGroupVersion.WithKind("ReplicaSet") gentype.NewFakeClientWithListAndApply[*v1beta2.ReplicaSet, *v1beta2.ReplicaSetList, *appsv1beta2.ReplicaSetApplyConfiguration](
fake.Fake,
// Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any. namespace,
func (c *FakeReplicaSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.ReplicaSet, err error) { v1beta2.SchemeGroupVersion.WithResource("replicasets"),
emptyResult := &v1beta2.ReplicaSet{} v1beta2.SchemeGroupVersion.WithKind("ReplicaSet"),
obj, err := c.Fake. func() *v1beta2.ReplicaSet { return &v1beta2.ReplicaSet{} },
Invokes(testing.NewGetActionWithOptions(replicasetsResource, c.ns, name, options), emptyResult) func() *v1beta2.ReplicaSetList { return &v1beta2.ReplicaSetList{} },
func(dst, src *v1beta2.ReplicaSetList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1beta2.ReplicaSetList) []*v1beta2.ReplicaSet { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1beta2.ReplicaSetList, items []*v1beta2.ReplicaSet) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta2.ReplicaSet), err
}
// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors.
func (c *FakeReplicaSets) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.ReplicaSetList, err error) {
emptyResult := &v1beta2.ReplicaSetList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(replicasetsResource, replicasetsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta2.ReplicaSetList{ListMeta: obj.(*v1beta2.ReplicaSetList).ListMeta}
for _, item := range obj.(*v1beta2.ReplicaSetList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested replicaSets.
func (c *FakeReplicaSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(replicasetsResource, c.ns, opts))
}
// Create takes the representation of a replicaSet and creates it. Returns the server's representation of the replicaSet, and an error, if there is any.
func (c *FakeReplicaSets) Create(ctx context.Context, replicaSet *v1beta2.ReplicaSet, opts v1.CreateOptions) (result *v1beta2.ReplicaSet, err error) {
emptyResult := &v1beta2.ReplicaSet{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(replicasetsResource, c.ns, replicaSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.ReplicaSet), err
}
// Update takes the representation of a replicaSet and updates it. Returns the server's representation of the replicaSet, and an error, if there is any.
func (c *FakeReplicaSets) Update(ctx context.Context, replicaSet *v1beta2.ReplicaSet, opts v1.UpdateOptions) (result *v1beta2.ReplicaSet, err error) {
emptyResult := &v1beta2.ReplicaSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(replicasetsResource, c.ns, replicaSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.ReplicaSet), 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 *FakeReplicaSets) UpdateStatus(ctx context.Context, replicaSet *v1beta2.ReplicaSet, opts v1.UpdateOptions) (result *v1beta2.ReplicaSet, err error) {
emptyResult := &v1beta2.ReplicaSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(replicasetsResource, "status", c.ns, replicaSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.ReplicaSet), err
}
// Delete takes name of the replicaSet and deletes it. Returns an error if one occurs.
func (c *FakeReplicaSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(replicasetsResource, c.ns, name, opts), &v1beta2.ReplicaSet{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeReplicaSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(replicasetsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta2.ReplicaSetList{})
return err
}
// Patch applies the patch and returns the patched replicaSet.
func (c *FakeReplicaSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.ReplicaSet, err error) {
emptyResult := &v1beta2.ReplicaSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(replicasetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.ReplicaSet), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied replicaSet.
func (c *FakeReplicaSets) Apply(ctx context.Context, replicaSet *appsv1beta2.ReplicaSetApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.ReplicaSet, err error) {
if replicaSet == nil {
return nil, fmt.Errorf("replicaSet provided to Apply must not be nil")
}
data, err := json.Marshal(replicaSet)
if err != nil {
return nil, err
}
name := replicaSet.Name
if name == nil {
return nil, fmt.Errorf("replicaSet.Name must be provided to Apply")
}
emptyResult := &v1beta2.ReplicaSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(replicasetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.ReplicaSet), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeReplicaSets) ApplyStatus(ctx context.Context, replicaSet *appsv1beta2.ReplicaSetApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.ReplicaSet, err error) {
if replicaSet == nil {
return nil, fmt.Errorf("replicaSet provided to Apply must not be nil")
}
data, err := json.Marshal(replicaSet)
if err != nil {
return nil, err
}
name := replicaSet.Name
if name == nil {
return nil, fmt.Errorf("replicaSet.Name must be provided to Apply")
}
emptyResult := &v1beta2.ReplicaSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(replicasetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.ReplicaSet), err
} }

View File

@@ -25,182 +25,43 @@ import (
v1beta2 "k8s.io/api/apps/v1beta2" v1beta2 "k8s.io/api/apps/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2" appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2"
gentype "k8s.io/client-go/gentype"
typedappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
// FakeStatefulSets implements StatefulSetInterface // fakeStatefulSets implements StatefulSetInterface
type FakeStatefulSets struct { type fakeStatefulSets struct {
*gentype.FakeClientWithListAndApply[*v1beta2.StatefulSet, *v1beta2.StatefulSetList, *appsv1beta2.StatefulSetApplyConfiguration]
Fake *FakeAppsV1beta2 Fake *FakeAppsV1beta2
ns string
} }
var statefulsetsResource = v1beta2.SchemeGroupVersion.WithResource("statefulsets") func newFakeStatefulSets(fake *FakeAppsV1beta2, namespace string) typedappsv1beta2.StatefulSetInterface {
return &fakeStatefulSets{
var statefulsetsKind = v1beta2.SchemeGroupVersion.WithKind("StatefulSet") gentype.NewFakeClientWithListAndApply[*v1beta2.StatefulSet, *v1beta2.StatefulSetList, *appsv1beta2.StatefulSetApplyConfiguration](
fake.Fake,
// Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any. namespace,
func (c *FakeStatefulSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.StatefulSet, err error) { v1beta2.SchemeGroupVersion.WithResource("statefulsets"),
emptyResult := &v1beta2.StatefulSet{} v1beta2.SchemeGroupVersion.WithKind("StatefulSet"),
obj, err := c.Fake. func() *v1beta2.StatefulSet { return &v1beta2.StatefulSet{} },
Invokes(testing.NewGetActionWithOptions(statefulsetsResource, c.ns, name, options), emptyResult) func() *v1beta2.StatefulSetList { return &v1beta2.StatefulSetList{} },
func(dst, src *v1beta2.StatefulSetList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1beta2.StatefulSetList) []*v1beta2.StatefulSet { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1beta2.StatefulSetList, items []*v1beta2.StatefulSet) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta2.StatefulSet), err
}
// List takes label and field selectors, and returns the list of StatefulSets that match those selectors.
func (c *FakeStatefulSets) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.StatefulSetList, err error) {
emptyResult := &v1beta2.StatefulSetList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(statefulsetsResource, statefulsetsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta2.StatefulSetList{ListMeta: obj.(*v1beta2.StatefulSetList).ListMeta}
for _, item := range obj.(*v1beta2.StatefulSetList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested statefulSets.
func (c *FakeStatefulSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(statefulsetsResource, c.ns, opts))
}
// Create takes the representation of a statefulSet and creates it. Returns the server's representation of the statefulSet, and an error, if there is any.
func (c *FakeStatefulSets) Create(ctx context.Context, statefulSet *v1beta2.StatefulSet, opts v1.CreateOptions) (result *v1beta2.StatefulSet, err error) {
emptyResult := &v1beta2.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(statefulsetsResource, c.ns, statefulSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.StatefulSet), err
}
// Update takes the representation of a statefulSet and updates it. Returns the server's representation of the statefulSet, and an error, if there is any.
func (c *FakeStatefulSets) Update(ctx context.Context, statefulSet *v1beta2.StatefulSet, opts v1.UpdateOptions) (result *v1beta2.StatefulSet, err error) {
emptyResult := &v1beta2.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(statefulsetsResource, c.ns, statefulSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.StatefulSet), 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 *FakeStatefulSets) UpdateStatus(ctx context.Context, statefulSet *v1beta2.StatefulSet, opts v1.UpdateOptions) (result *v1beta2.StatefulSet, err error) {
emptyResult := &v1beta2.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(statefulsetsResource, "status", c.ns, statefulSet, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.StatefulSet), err
}
// Delete takes name of the statefulSet and deletes it. Returns an error if one occurs.
func (c *FakeStatefulSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(statefulsetsResource, c.ns, name, opts), &v1beta2.StatefulSet{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeStatefulSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(statefulsetsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta2.StatefulSetList{})
return err
}
// Patch applies the patch and returns the patched statefulSet.
func (c *FakeStatefulSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.StatefulSet, err error) {
emptyResult := &v1beta2.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(statefulsetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.StatefulSet), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied statefulSet.
func (c *FakeStatefulSets) Apply(ctx context.Context, statefulSet *appsv1beta2.StatefulSetApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.StatefulSet, err error) {
if statefulSet == nil {
return nil, fmt.Errorf("statefulSet provided to Apply must not be nil")
}
data, err := json.Marshal(statefulSet)
if err != nil {
return nil, err
}
name := statefulSet.Name
if name == nil {
return nil, fmt.Errorf("statefulSet.Name must be provided to Apply")
}
emptyResult := &v1beta2.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(statefulsetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.StatefulSet), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeStatefulSets) ApplyStatus(ctx context.Context, statefulSet *appsv1beta2.StatefulSetApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.StatefulSet, err error) {
if statefulSet == nil {
return nil, fmt.Errorf("statefulSet provided to Apply must not be nil")
}
data, err := json.Marshal(statefulSet)
if err != nil {
return nil, err
}
name := statefulSet.Name
if name == nil {
return nil, fmt.Errorf("statefulSet.Name must be provided to Apply")
}
emptyResult := &v1beta2.StatefulSet{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(statefulsetsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta2.StatefulSet), err
} }
// GetScale takes name of the statefulSet, and returns the corresponding scale object, and an error if there is any. // GetScale takes name of the statefulSet, and returns the corresponding scale object, and an error if there is any.
func (c *FakeStatefulSets) GetScale(ctx context.Context, statefulSetName string, options v1.GetOptions) (result *v1beta2.Scale, err error) { func (c *fakeStatefulSets) GetScale(ctx context.Context, statefulSetName string, options v1.GetOptions) (result *v1beta2.Scale, err error) {
emptyResult := &v1beta2.Scale{} emptyResult := &v1beta2.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewGetSubresourceActionWithOptions(statefulsetsResource, c.ns, "scale", statefulSetName, options), emptyResult) Invokes(testing.NewGetSubresourceActionWithOptions(c.Resource(), c.Namespace(), "scale", statefulSetName, options), emptyResult)
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err
@@ -209,10 +70,10 @@ func (c *FakeStatefulSets) GetScale(ctx context.Context, statefulSetName string,
} }
// 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. // 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 *FakeStatefulSets) UpdateScale(ctx context.Context, statefulSetName string, scale *v1beta2.Scale, opts v1.UpdateOptions) (result *v1beta2.Scale, err error) { func (c *fakeStatefulSets) UpdateScale(ctx context.Context, statefulSetName string, scale *v1beta2.Scale, opts v1.UpdateOptions) (result *v1beta2.Scale, err error) {
emptyResult := &v1beta2.Scale{} emptyResult := &v1beta2.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(statefulsetsResource, "scale", c.ns, scale, opts), &v1beta2.Scale{}) Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "scale", c.Namespace(), scale, opts), &v1beta2.Scale{})
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err
@@ -222,7 +83,7 @@ func (c *FakeStatefulSets) UpdateScale(ctx context.Context, statefulSetName stri
// ApplyScale takes top resource name and the apply declarative configuration for scale, // ApplyScale takes top resource name and the apply declarative configuration for scale,
// applies it and returns the applied scale, and an error, if there is any. // applies it and returns the applied scale, and an error, if there is any.
func (c *FakeStatefulSets) ApplyScale(ctx context.Context, statefulSetName string, scale *appsv1beta2.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Scale, err error) { func (c *fakeStatefulSets) ApplyScale(ctx context.Context, statefulSetName string, scale *appsv1beta2.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Scale, err error) {
if scale == nil { if scale == nil {
return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
} }
@@ -232,7 +93,7 @@ func (c *FakeStatefulSets) ApplyScale(ctx context.Context, statefulSetName strin
} }
emptyResult := &v1beta2.Scale{} emptyResult := &v1beta2.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(statefulsetsResource, c.ns, statefulSetName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult) Invokes(testing.NewPatchSubresourceActionWithOptions(c.Resource(), c.Namespace(), statefulSetName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult)
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err

View File

@@ -29,11 +29,11 @@ type FakeAuthenticationV1 struct {
} }
func (c *FakeAuthenticationV1) SelfSubjectReviews() v1.SelfSubjectReviewInterface { func (c *FakeAuthenticationV1) SelfSubjectReviews() v1.SelfSubjectReviewInterface {
return &FakeSelfSubjectReviews{c} return newFakeSelfSubjectReviews(c)
} }
func (c *FakeAuthenticationV1) TokenReviews() v1.TokenReviewInterface { func (c *FakeAuthenticationV1) TokenReviews() v1.TokenReviewInterface {
return &FakeTokenReviews{c} return newFakeTokenReviews(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,29 +19,26 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
v1 "k8s.io/api/authentication/v1" v1 "k8s.io/api/authentication/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" gentype "k8s.io/client-go/gentype"
testing "k8s.io/client-go/testing" authenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1"
) )
// FakeSelfSubjectReviews implements SelfSubjectReviewInterface // fakeSelfSubjectReviews implements SelfSubjectReviewInterface
type FakeSelfSubjectReviews struct { type fakeSelfSubjectReviews struct {
*gentype.FakeClient[*v1.SelfSubjectReview]
Fake *FakeAuthenticationV1 Fake *FakeAuthenticationV1
} }
var selfsubjectreviewsResource = v1.SchemeGroupVersion.WithResource("selfsubjectreviews") func newFakeSelfSubjectReviews(fake *FakeAuthenticationV1) authenticationv1.SelfSubjectReviewInterface {
return &fakeSelfSubjectReviews{
var selfsubjectreviewsKind = v1.SchemeGroupVersion.WithKind("SelfSubjectReview") gentype.NewFakeClient[*v1.SelfSubjectReview](
fake.Fake,
// Create takes the representation of a selfSubjectReview and creates it. Returns the server's representation of the selfSubjectReview, and an error, if there is any. "",
func (c *FakeSelfSubjectReviews) Create(ctx context.Context, selfSubjectReview *v1.SelfSubjectReview, opts metav1.CreateOptions) (result *v1.SelfSubjectReview, err error) { v1.SchemeGroupVersion.WithResource("selfsubjectreviews"),
emptyResult := &v1.SelfSubjectReview{} v1.SchemeGroupVersion.WithKind("SelfSubjectReview"),
obj, err := c.Fake. func() *v1.SelfSubjectReview { return &v1.SelfSubjectReview{} },
Invokes(testing.NewRootCreateActionWithOptions(selfsubjectreviewsResource, selfSubjectReview, opts), emptyResult) ),
if obj == nil { fake,
return emptyResult, err
} }
return obj.(*v1.SelfSubjectReview), err
} }

View File

@@ -19,29 +19,26 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
v1 "k8s.io/api/authentication/v1" v1 "k8s.io/api/authentication/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" gentype "k8s.io/client-go/gentype"
testing "k8s.io/client-go/testing" authenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1"
) )
// FakeTokenReviews implements TokenReviewInterface // fakeTokenReviews implements TokenReviewInterface
type FakeTokenReviews struct { type fakeTokenReviews struct {
*gentype.FakeClient[*v1.TokenReview]
Fake *FakeAuthenticationV1 Fake *FakeAuthenticationV1
} }
var tokenreviewsResource = v1.SchemeGroupVersion.WithResource("tokenreviews") func newFakeTokenReviews(fake *FakeAuthenticationV1) authenticationv1.TokenReviewInterface {
return &fakeTokenReviews{
var tokenreviewsKind = v1.SchemeGroupVersion.WithKind("TokenReview") gentype.NewFakeClient[*v1.TokenReview](
fake.Fake,
// Create takes the representation of a tokenReview and creates it. Returns the server's representation of the tokenReview, and an error, if there is any. "",
func (c *FakeTokenReviews) Create(ctx context.Context, tokenReview *v1.TokenReview, opts metav1.CreateOptions) (result *v1.TokenReview, err error) { v1.SchemeGroupVersion.WithResource("tokenreviews"),
emptyResult := &v1.TokenReview{} v1.SchemeGroupVersion.WithKind("TokenReview"),
obj, err := c.Fake. func() *v1.TokenReview { return &v1.TokenReview{} },
Invokes(testing.NewRootCreateActionWithOptions(tokenreviewsResource, tokenReview, opts), emptyResult) ),
if obj == nil { fake,
return emptyResult, err
} }
return obj.(*v1.TokenReview), err
} }

View File

@@ -29,7 +29,7 @@ type FakeAuthenticationV1alpha1 struct {
} }
func (c *FakeAuthenticationV1alpha1) SelfSubjectReviews() v1alpha1.SelfSubjectReviewInterface { func (c *FakeAuthenticationV1alpha1) SelfSubjectReviews() v1alpha1.SelfSubjectReviewInterface {
return &FakeSelfSubjectReviews{c} return newFakeSelfSubjectReviews(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,29 +19,26 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
v1alpha1 "k8s.io/api/authentication/v1alpha1" v1alpha1 "k8s.io/api/authentication/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" gentype "k8s.io/client-go/gentype"
testing "k8s.io/client-go/testing" authenticationv1alpha1 "k8s.io/client-go/kubernetes/typed/authentication/v1alpha1"
) )
// FakeSelfSubjectReviews implements SelfSubjectReviewInterface // fakeSelfSubjectReviews implements SelfSubjectReviewInterface
type FakeSelfSubjectReviews struct { type fakeSelfSubjectReviews struct {
*gentype.FakeClient[*v1alpha1.SelfSubjectReview]
Fake *FakeAuthenticationV1alpha1 Fake *FakeAuthenticationV1alpha1
} }
var selfsubjectreviewsResource = v1alpha1.SchemeGroupVersion.WithResource("selfsubjectreviews") func newFakeSelfSubjectReviews(fake *FakeAuthenticationV1alpha1) authenticationv1alpha1.SelfSubjectReviewInterface {
return &fakeSelfSubjectReviews{
var selfsubjectreviewsKind = v1alpha1.SchemeGroupVersion.WithKind("SelfSubjectReview") gentype.NewFakeClient[*v1alpha1.SelfSubjectReview](
fake.Fake,
// Create takes the representation of a selfSubjectReview and creates it. Returns the server's representation of the selfSubjectReview, and an error, if there is any. "",
func (c *FakeSelfSubjectReviews) Create(ctx context.Context, selfSubjectReview *v1alpha1.SelfSubjectReview, opts v1.CreateOptions) (result *v1alpha1.SelfSubjectReview, err error) { v1alpha1.SchemeGroupVersion.WithResource("selfsubjectreviews"),
emptyResult := &v1alpha1.SelfSubjectReview{} v1alpha1.SchemeGroupVersion.WithKind("SelfSubjectReview"),
obj, err := c.Fake. func() *v1alpha1.SelfSubjectReview { return &v1alpha1.SelfSubjectReview{} },
Invokes(testing.NewRootCreateActionWithOptions(selfsubjectreviewsResource, selfSubjectReview, opts), emptyResult) ),
if obj == nil { fake,
return emptyResult, err
} }
return obj.(*v1alpha1.SelfSubjectReview), err
} }

View File

@@ -29,11 +29,11 @@ type FakeAuthenticationV1beta1 struct {
} }
func (c *FakeAuthenticationV1beta1) SelfSubjectReviews() v1beta1.SelfSubjectReviewInterface { func (c *FakeAuthenticationV1beta1) SelfSubjectReviews() v1beta1.SelfSubjectReviewInterface {
return &FakeSelfSubjectReviews{c} return newFakeSelfSubjectReviews(c)
} }
func (c *FakeAuthenticationV1beta1) TokenReviews() v1beta1.TokenReviewInterface { func (c *FakeAuthenticationV1beta1) TokenReviews() v1beta1.TokenReviewInterface {
return &FakeTokenReviews{c} return newFakeTokenReviews(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,29 +19,26 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
v1beta1 "k8s.io/api/authentication/v1beta1" v1beta1 "k8s.io/api/authentication/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" gentype "k8s.io/client-go/gentype"
testing "k8s.io/client-go/testing" authenticationv1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1"
) )
// FakeSelfSubjectReviews implements SelfSubjectReviewInterface // fakeSelfSubjectReviews implements SelfSubjectReviewInterface
type FakeSelfSubjectReviews struct { type fakeSelfSubjectReviews struct {
*gentype.FakeClient[*v1beta1.SelfSubjectReview]
Fake *FakeAuthenticationV1beta1 Fake *FakeAuthenticationV1beta1
} }
var selfsubjectreviewsResource = v1beta1.SchemeGroupVersion.WithResource("selfsubjectreviews") func newFakeSelfSubjectReviews(fake *FakeAuthenticationV1beta1) authenticationv1beta1.SelfSubjectReviewInterface {
return &fakeSelfSubjectReviews{
var selfsubjectreviewsKind = v1beta1.SchemeGroupVersion.WithKind("SelfSubjectReview") gentype.NewFakeClient[*v1beta1.SelfSubjectReview](
fake.Fake,
// Create takes the representation of a selfSubjectReview and creates it. Returns the server's representation of the selfSubjectReview, and an error, if there is any. "",
func (c *FakeSelfSubjectReviews) Create(ctx context.Context, selfSubjectReview *v1beta1.SelfSubjectReview, opts v1.CreateOptions) (result *v1beta1.SelfSubjectReview, err error) { v1beta1.SchemeGroupVersion.WithResource("selfsubjectreviews"),
emptyResult := &v1beta1.SelfSubjectReview{} v1beta1.SchemeGroupVersion.WithKind("SelfSubjectReview"),
obj, err := c.Fake. func() *v1beta1.SelfSubjectReview { return &v1beta1.SelfSubjectReview{} },
Invokes(testing.NewRootCreateActionWithOptions(selfsubjectreviewsResource, selfSubjectReview, opts), emptyResult) ),
if obj == nil { fake,
return emptyResult, err
} }
return obj.(*v1beta1.SelfSubjectReview), err
} }

View File

@@ -19,29 +19,26 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
v1beta1 "k8s.io/api/authentication/v1beta1" v1beta1 "k8s.io/api/authentication/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" gentype "k8s.io/client-go/gentype"
testing "k8s.io/client-go/testing" authenticationv1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1"
) )
// FakeTokenReviews implements TokenReviewInterface // fakeTokenReviews implements TokenReviewInterface
type FakeTokenReviews struct { type fakeTokenReviews struct {
*gentype.FakeClient[*v1beta1.TokenReview]
Fake *FakeAuthenticationV1beta1 Fake *FakeAuthenticationV1beta1
} }
var tokenreviewsResource = v1beta1.SchemeGroupVersion.WithResource("tokenreviews") func newFakeTokenReviews(fake *FakeAuthenticationV1beta1) authenticationv1beta1.TokenReviewInterface {
return &fakeTokenReviews{
var tokenreviewsKind = v1beta1.SchemeGroupVersion.WithKind("TokenReview") gentype.NewFakeClient[*v1beta1.TokenReview](
fake.Fake,
// Create takes the representation of a tokenReview and creates it. Returns the server's representation of the tokenReview, and an error, if there is any. "",
func (c *FakeTokenReviews) Create(ctx context.Context, tokenReview *v1beta1.TokenReview, opts v1.CreateOptions) (result *v1beta1.TokenReview, err error) { v1beta1.SchemeGroupVersion.WithResource("tokenreviews"),
emptyResult := &v1beta1.TokenReview{} v1beta1.SchemeGroupVersion.WithKind("TokenReview"),
obj, err := c.Fake. func() *v1beta1.TokenReview { return &v1beta1.TokenReview{} },
Invokes(testing.NewRootCreateActionWithOptions(tokenreviewsResource, tokenReview, opts), emptyResult) ),
if obj == nil { fake,
return emptyResult, err
} }
return obj.(*v1beta1.TokenReview), err
} }

View File

@@ -29,19 +29,19 @@ type FakeAuthorizationV1 struct {
} }
func (c *FakeAuthorizationV1) LocalSubjectAccessReviews(namespace string) v1.LocalSubjectAccessReviewInterface { func (c *FakeAuthorizationV1) LocalSubjectAccessReviews(namespace string) v1.LocalSubjectAccessReviewInterface {
return &FakeLocalSubjectAccessReviews{c, namespace} return newFakeLocalSubjectAccessReviews(c, namespace)
} }
func (c *FakeAuthorizationV1) SelfSubjectAccessReviews() v1.SelfSubjectAccessReviewInterface { func (c *FakeAuthorizationV1) SelfSubjectAccessReviews() v1.SelfSubjectAccessReviewInterface {
return &FakeSelfSubjectAccessReviews{c} return newFakeSelfSubjectAccessReviews(c)
} }
func (c *FakeAuthorizationV1) SelfSubjectRulesReviews() v1.SelfSubjectRulesReviewInterface { func (c *FakeAuthorizationV1) SelfSubjectRulesReviews() v1.SelfSubjectRulesReviewInterface {
return &FakeSelfSubjectRulesReviews{c} return newFakeSelfSubjectRulesReviews(c)
} }
func (c *FakeAuthorizationV1) SubjectAccessReviews() v1.SubjectAccessReviewInterface { func (c *FakeAuthorizationV1) SubjectAccessReviews() v1.SubjectAccessReviewInterface {
return &FakeSubjectAccessReviews{c} return newFakeSubjectAccessReviews(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,31 +19,26 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
v1 "k8s.io/api/authorization/v1" v1 "k8s.io/api/authorization/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" gentype "k8s.io/client-go/gentype"
testing "k8s.io/client-go/testing" authorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1"
) )
// FakeLocalSubjectAccessReviews implements LocalSubjectAccessReviewInterface // fakeLocalSubjectAccessReviews implements LocalSubjectAccessReviewInterface
type FakeLocalSubjectAccessReviews struct { type fakeLocalSubjectAccessReviews struct {
*gentype.FakeClient[*v1.LocalSubjectAccessReview]
Fake *FakeAuthorizationV1 Fake *FakeAuthorizationV1
ns string
} }
var localsubjectaccessreviewsResource = v1.SchemeGroupVersion.WithResource("localsubjectaccessreviews") func newFakeLocalSubjectAccessReviews(fake *FakeAuthorizationV1, namespace string) authorizationv1.LocalSubjectAccessReviewInterface {
return &fakeLocalSubjectAccessReviews{
var localsubjectaccessreviewsKind = v1.SchemeGroupVersion.WithKind("LocalSubjectAccessReview") gentype.NewFakeClient[*v1.LocalSubjectAccessReview](
fake.Fake,
// Create takes the representation of a localSubjectAccessReview and creates it. Returns the server's representation of the localSubjectAccessReview, and an error, if there is any. namespace,
func (c *FakeLocalSubjectAccessReviews) Create(ctx context.Context, localSubjectAccessReview *v1.LocalSubjectAccessReview, opts metav1.CreateOptions) (result *v1.LocalSubjectAccessReview, err error) { v1.SchemeGroupVersion.WithResource("localsubjectaccessreviews"),
emptyResult := &v1.LocalSubjectAccessReview{} v1.SchemeGroupVersion.WithKind("LocalSubjectAccessReview"),
obj, err := c.Fake. func() *v1.LocalSubjectAccessReview { return &v1.LocalSubjectAccessReview{} },
Invokes(testing.NewCreateActionWithOptions(localsubjectaccessreviewsResource, c.ns, localSubjectAccessReview, opts), emptyResult) ),
fake,
if obj == nil {
return emptyResult, err
} }
return obj.(*v1.LocalSubjectAccessReview), err
} }

View File

@@ -19,29 +19,26 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
v1 "k8s.io/api/authorization/v1" v1 "k8s.io/api/authorization/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" gentype "k8s.io/client-go/gentype"
testing "k8s.io/client-go/testing" authorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1"
) )
// FakeSelfSubjectAccessReviews implements SelfSubjectAccessReviewInterface // fakeSelfSubjectAccessReviews implements SelfSubjectAccessReviewInterface
type FakeSelfSubjectAccessReviews struct { type fakeSelfSubjectAccessReviews struct {
*gentype.FakeClient[*v1.SelfSubjectAccessReview]
Fake *FakeAuthorizationV1 Fake *FakeAuthorizationV1
} }
var selfsubjectaccessreviewsResource = v1.SchemeGroupVersion.WithResource("selfsubjectaccessreviews") func newFakeSelfSubjectAccessReviews(fake *FakeAuthorizationV1) authorizationv1.SelfSubjectAccessReviewInterface {
return &fakeSelfSubjectAccessReviews{
var selfsubjectaccessreviewsKind = v1.SchemeGroupVersion.WithKind("SelfSubjectAccessReview") gentype.NewFakeClient[*v1.SelfSubjectAccessReview](
fake.Fake,
// Create takes the representation of a selfSubjectAccessReview and creates it. Returns the server's representation of the selfSubjectAccessReview, and an error, if there is any. "",
func (c *FakeSelfSubjectAccessReviews) Create(ctx context.Context, selfSubjectAccessReview *v1.SelfSubjectAccessReview, opts metav1.CreateOptions) (result *v1.SelfSubjectAccessReview, err error) { v1.SchemeGroupVersion.WithResource("selfsubjectaccessreviews"),
emptyResult := &v1.SelfSubjectAccessReview{} v1.SchemeGroupVersion.WithKind("SelfSubjectAccessReview"),
obj, err := c.Fake. func() *v1.SelfSubjectAccessReview { return &v1.SelfSubjectAccessReview{} },
Invokes(testing.NewRootCreateActionWithOptions(selfsubjectaccessreviewsResource, selfSubjectAccessReview, opts), emptyResult) ),
if obj == nil { fake,
return emptyResult, err
} }
return obj.(*v1.SelfSubjectAccessReview), err
} }

View File

@@ -19,29 +19,26 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
v1 "k8s.io/api/authorization/v1" v1 "k8s.io/api/authorization/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" gentype "k8s.io/client-go/gentype"
testing "k8s.io/client-go/testing" authorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1"
) )
// FakeSelfSubjectRulesReviews implements SelfSubjectRulesReviewInterface // fakeSelfSubjectRulesReviews implements SelfSubjectRulesReviewInterface
type FakeSelfSubjectRulesReviews struct { type fakeSelfSubjectRulesReviews struct {
*gentype.FakeClient[*v1.SelfSubjectRulesReview]
Fake *FakeAuthorizationV1 Fake *FakeAuthorizationV1
} }
var selfsubjectrulesreviewsResource = v1.SchemeGroupVersion.WithResource("selfsubjectrulesreviews") func newFakeSelfSubjectRulesReviews(fake *FakeAuthorizationV1) authorizationv1.SelfSubjectRulesReviewInterface {
return &fakeSelfSubjectRulesReviews{
var selfsubjectrulesreviewsKind = v1.SchemeGroupVersion.WithKind("SelfSubjectRulesReview") gentype.NewFakeClient[*v1.SelfSubjectRulesReview](
fake.Fake,
// Create takes the representation of a selfSubjectRulesReview and creates it. Returns the server's representation of the selfSubjectRulesReview, and an error, if there is any. "",
func (c *FakeSelfSubjectRulesReviews) Create(ctx context.Context, selfSubjectRulesReview *v1.SelfSubjectRulesReview, opts metav1.CreateOptions) (result *v1.SelfSubjectRulesReview, err error) { v1.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"),
emptyResult := &v1.SelfSubjectRulesReview{} v1.SchemeGroupVersion.WithKind("SelfSubjectRulesReview"),
obj, err := c.Fake. func() *v1.SelfSubjectRulesReview { return &v1.SelfSubjectRulesReview{} },
Invokes(testing.NewRootCreateActionWithOptions(selfsubjectrulesreviewsResource, selfSubjectRulesReview, opts), emptyResult) ),
if obj == nil { fake,
return emptyResult, err
} }
return obj.(*v1.SelfSubjectRulesReview), err
} }

View File

@@ -19,29 +19,26 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
v1 "k8s.io/api/authorization/v1" v1 "k8s.io/api/authorization/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" gentype "k8s.io/client-go/gentype"
testing "k8s.io/client-go/testing" authorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1"
) )
// FakeSubjectAccessReviews implements SubjectAccessReviewInterface // fakeSubjectAccessReviews implements SubjectAccessReviewInterface
type FakeSubjectAccessReviews struct { type fakeSubjectAccessReviews struct {
*gentype.FakeClient[*v1.SubjectAccessReview]
Fake *FakeAuthorizationV1 Fake *FakeAuthorizationV1
} }
var subjectaccessreviewsResource = v1.SchemeGroupVersion.WithResource("subjectaccessreviews") func newFakeSubjectAccessReviews(fake *FakeAuthorizationV1) authorizationv1.SubjectAccessReviewInterface {
return &fakeSubjectAccessReviews{
var subjectaccessreviewsKind = v1.SchemeGroupVersion.WithKind("SubjectAccessReview") gentype.NewFakeClient[*v1.SubjectAccessReview](
fake.Fake,
// Create takes the representation of a subjectAccessReview and creates it. Returns the server's representation of the subjectAccessReview, and an error, if there is any. "",
func (c *FakeSubjectAccessReviews) Create(ctx context.Context, subjectAccessReview *v1.SubjectAccessReview, opts metav1.CreateOptions) (result *v1.SubjectAccessReview, err error) { v1.SchemeGroupVersion.WithResource("subjectaccessreviews"),
emptyResult := &v1.SubjectAccessReview{} v1.SchemeGroupVersion.WithKind("SubjectAccessReview"),
obj, err := c.Fake. func() *v1.SubjectAccessReview { return &v1.SubjectAccessReview{} },
Invokes(testing.NewRootCreateActionWithOptions(subjectaccessreviewsResource, subjectAccessReview, opts), emptyResult) ),
if obj == nil { fake,
return emptyResult, err
} }
return obj.(*v1.SubjectAccessReview), err
} }

View File

@@ -29,19 +29,19 @@ type FakeAuthorizationV1beta1 struct {
} }
func (c *FakeAuthorizationV1beta1) LocalSubjectAccessReviews(namespace string) v1beta1.LocalSubjectAccessReviewInterface { func (c *FakeAuthorizationV1beta1) LocalSubjectAccessReviews(namespace string) v1beta1.LocalSubjectAccessReviewInterface {
return &FakeLocalSubjectAccessReviews{c, namespace} return newFakeLocalSubjectAccessReviews(c, namespace)
} }
func (c *FakeAuthorizationV1beta1) SelfSubjectAccessReviews() v1beta1.SelfSubjectAccessReviewInterface { func (c *FakeAuthorizationV1beta1) SelfSubjectAccessReviews() v1beta1.SelfSubjectAccessReviewInterface {
return &FakeSelfSubjectAccessReviews{c} return newFakeSelfSubjectAccessReviews(c)
} }
func (c *FakeAuthorizationV1beta1) SelfSubjectRulesReviews() v1beta1.SelfSubjectRulesReviewInterface { func (c *FakeAuthorizationV1beta1) SelfSubjectRulesReviews() v1beta1.SelfSubjectRulesReviewInterface {
return &FakeSelfSubjectRulesReviews{c} return newFakeSelfSubjectRulesReviews(c)
} }
func (c *FakeAuthorizationV1beta1) SubjectAccessReviews() v1beta1.SubjectAccessReviewInterface { func (c *FakeAuthorizationV1beta1) SubjectAccessReviews() v1beta1.SubjectAccessReviewInterface {
return &FakeSubjectAccessReviews{c} return newFakeSubjectAccessReviews(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,31 +19,26 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
v1beta1 "k8s.io/api/authorization/v1beta1" v1beta1 "k8s.io/api/authorization/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" gentype "k8s.io/client-go/gentype"
testing "k8s.io/client-go/testing" authorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1"
) )
// FakeLocalSubjectAccessReviews implements LocalSubjectAccessReviewInterface // fakeLocalSubjectAccessReviews implements LocalSubjectAccessReviewInterface
type FakeLocalSubjectAccessReviews struct { type fakeLocalSubjectAccessReviews struct {
*gentype.FakeClient[*v1beta1.LocalSubjectAccessReview]
Fake *FakeAuthorizationV1beta1 Fake *FakeAuthorizationV1beta1
ns string
} }
var localsubjectaccessreviewsResource = v1beta1.SchemeGroupVersion.WithResource("localsubjectaccessreviews") func newFakeLocalSubjectAccessReviews(fake *FakeAuthorizationV1beta1, namespace string) authorizationv1beta1.LocalSubjectAccessReviewInterface {
return &fakeLocalSubjectAccessReviews{
var localsubjectaccessreviewsKind = v1beta1.SchemeGroupVersion.WithKind("LocalSubjectAccessReview") gentype.NewFakeClient[*v1beta1.LocalSubjectAccessReview](
fake.Fake,
// Create takes the representation of a localSubjectAccessReview and creates it. Returns the server's representation of the localSubjectAccessReview, and an error, if there is any. namespace,
func (c *FakeLocalSubjectAccessReviews) Create(ctx context.Context, localSubjectAccessReview *v1beta1.LocalSubjectAccessReview, opts v1.CreateOptions) (result *v1beta1.LocalSubjectAccessReview, err error) { v1beta1.SchemeGroupVersion.WithResource("localsubjectaccessreviews"),
emptyResult := &v1beta1.LocalSubjectAccessReview{} v1beta1.SchemeGroupVersion.WithKind("LocalSubjectAccessReview"),
obj, err := c.Fake. func() *v1beta1.LocalSubjectAccessReview { return &v1beta1.LocalSubjectAccessReview{} },
Invokes(testing.NewCreateActionWithOptions(localsubjectaccessreviewsResource, c.ns, localSubjectAccessReview, opts), emptyResult) ),
fake,
if obj == nil {
return emptyResult, err
} }
return obj.(*v1beta1.LocalSubjectAccessReview), err
} }

View File

@@ -19,29 +19,26 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
v1beta1 "k8s.io/api/authorization/v1beta1" v1beta1 "k8s.io/api/authorization/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" gentype "k8s.io/client-go/gentype"
testing "k8s.io/client-go/testing" authorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1"
) )
// FakeSelfSubjectAccessReviews implements SelfSubjectAccessReviewInterface // fakeSelfSubjectAccessReviews implements SelfSubjectAccessReviewInterface
type FakeSelfSubjectAccessReviews struct { type fakeSelfSubjectAccessReviews struct {
*gentype.FakeClient[*v1beta1.SelfSubjectAccessReview]
Fake *FakeAuthorizationV1beta1 Fake *FakeAuthorizationV1beta1
} }
var selfsubjectaccessreviewsResource = v1beta1.SchemeGroupVersion.WithResource("selfsubjectaccessreviews") func newFakeSelfSubjectAccessReviews(fake *FakeAuthorizationV1beta1) authorizationv1beta1.SelfSubjectAccessReviewInterface {
return &fakeSelfSubjectAccessReviews{
var selfsubjectaccessreviewsKind = v1beta1.SchemeGroupVersion.WithKind("SelfSubjectAccessReview") gentype.NewFakeClient[*v1beta1.SelfSubjectAccessReview](
fake.Fake,
// Create takes the representation of a selfSubjectAccessReview and creates it. Returns the server's representation of the selfSubjectAccessReview, and an error, if there is any. "",
func (c *FakeSelfSubjectAccessReviews) Create(ctx context.Context, selfSubjectAccessReview *v1beta1.SelfSubjectAccessReview, opts v1.CreateOptions) (result *v1beta1.SelfSubjectAccessReview, err error) { v1beta1.SchemeGroupVersion.WithResource("selfsubjectaccessreviews"),
emptyResult := &v1beta1.SelfSubjectAccessReview{} v1beta1.SchemeGroupVersion.WithKind("SelfSubjectAccessReview"),
obj, err := c.Fake. func() *v1beta1.SelfSubjectAccessReview { return &v1beta1.SelfSubjectAccessReview{} },
Invokes(testing.NewRootCreateActionWithOptions(selfsubjectaccessreviewsResource, selfSubjectAccessReview, opts), emptyResult) ),
if obj == nil { fake,
return emptyResult, err
} }
return obj.(*v1beta1.SelfSubjectAccessReview), err
} }

View File

@@ -19,29 +19,26 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
v1beta1 "k8s.io/api/authorization/v1beta1" v1beta1 "k8s.io/api/authorization/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" gentype "k8s.io/client-go/gentype"
testing "k8s.io/client-go/testing" authorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1"
) )
// FakeSelfSubjectRulesReviews implements SelfSubjectRulesReviewInterface // fakeSelfSubjectRulesReviews implements SelfSubjectRulesReviewInterface
type FakeSelfSubjectRulesReviews struct { type fakeSelfSubjectRulesReviews struct {
*gentype.FakeClient[*v1beta1.SelfSubjectRulesReview]
Fake *FakeAuthorizationV1beta1 Fake *FakeAuthorizationV1beta1
} }
var selfsubjectrulesreviewsResource = v1beta1.SchemeGroupVersion.WithResource("selfsubjectrulesreviews") func newFakeSelfSubjectRulesReviews(fake *FakeAuthorizationV1beta1) authorizationv1beta1.SelfSubjectRulesReviewInterface {
return &fakeSelfSubjectRulesReviews{
var selfsubjectrulesreviewsKind = v1beta1.SchemeGroupVersion.WithKind("SelfSubjectRulesReview") gentype.NewFakeClient[*v1beta1.SelfSubjectRulesReview](
fake.Fake,
// Create takes the representation of a selfSubjectRulesReview and creates it. Returns the server's representation of the selfSubjectRulesReview, and an error, if there is any. "",
func (c *FakeSelfSubjectRulesReviews) Create(ctx context.Context, selfSubjectRulesReview *v1beta1.SelfSubjectRulesReview, opts v1.CreateOptions) (result *v1beta1.SelfSubjectRulesReview, err error) { v1beta1.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"),
emptyResult := &v1beta1.SelfSubjectRulesReview{} v1beta1.SchemeGroupVersion.WithKind("SelfSubjectRulesReview"),
obj, err := c.Fake. func() *v1beta1.SelfSubjectRulesReview { return &v1beta1.SelfSubjectRulesReview{} },
Invokes(testing.NewRootCreateActionWithOptions(selfsubjectrulesreviewsResource, selfSubjectRulesReview, opts), emptyResult) ),
if obj == nil { fake,
return emptyResult, err
} }
return obj.(*v1beta1.SelfSubjectRulesReview), err
} }

View File

@@ -19,29 +19,26 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
v1beta1 "k8s.io/api/authorization/v1beta1" v1beta1 "k8s.io/api/authorization/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" gentype "k8s.io/client-go/gentype"
testing "k8s.io/client-go/testing" authorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1"
) )
// FakeSubjectAccessReviews implements SubjectAccessReviewInterface // fakeSubjectAccessReviews implements SubjectAccessReviewInterface
type FakeSubjectAccessReviews struct { type fakeSubjectAccessReviews struct {
*gentype.FakeClient[*v1beta1.SubjectAccessReview]
Fake *FakeAuthorizationV1beta1 Fake *FakeAuthorizationV1beta1
} }
var subjectaccessreviewsResource = v1beta1.SchemeGroupVersion.WithResource("subjectaccessreviews") func newFakeSubjectAccessReviews(fake *FakeAuthorizationV1beta1) authorizationv1beta1.SubjectAccessReviewInterface {
return &fakeSubjectAccessReviews{
var subjectaccessreviewsKind = v1beta1.SchemeGroupVersion.WithKind("SubjectAccessReview") gentype.NewFakeClient[*v1beta1.SubjectAccessReview](
fake.Fake,
// Create takes the representation of a subjectAccessReview and creates it. Returns the server's representation of the subjectAccessReview, and an error, if there is any. "",
func (c *FakeSubjectAccessReviews) Create(ctx context.Context, subjectAccessReview *v1beta1.SubjectAccessReview, opts v1.CreateOptions) (result *v1beta1.SubjectAccessReview, err error) { v1beta1.SchemeGroupVersion.WithResource("subjectaccessreviews"),
emptyResult := &v1beta1.SubjectAccessReview{} v1beta1.SchemeGroupVersion.WithKind("SubjectAccessReview"),
obj, err := c.Fake. func() *v1beta1.SubjectAccessReview { return &v1beta1.SubjectAccessReview{} },
Invokes(testing.NewRootCreateActionWithOptions(subjectaccessreviewsResource, subjectAccessReview, opts), emptyResult) ),
if obj == nil { fake,
return emptyResult, err
} }
return obj.(*v1beta1.SubjectAccessReview), err
} }

View File

@@ -29,7 +29,7 @@ type FakeAutoscalingV1 struct {
} }
func (c *FakeAutoscalingV1) HorizontalPodAutoscalers(namespace string) v1.HorizontalPodAutoscalerInterface { func (c *FakeAutoscalingV1) HorizontalPodAutoscalers(namespace string) v1.HorizontalPodAutoscalerInterface {
return &FakeHorizontalPodAutoscalers{c, namespace} return newFakeHorizontalPodAutoscalers(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,179 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/autoscaling/v1" v1 "k8s.io/api/autoscaling/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
autoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" autoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedautoscalingv1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1"
) )
// FakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface // fakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface
type FakeHorizontalPodAutoscalers struct { type fakeHorizontalPodAutoscalers struct {
*gentype.FakeClientWithListAndApply[*v1.HorizontalPodAutoscaler, *v1.HorizontalPodAutoscalerList, *autoscalingv1.HorizontalPodAutoscalerApplyConfiguration]
Fake *FakeAutoscalingV1 Fake *FakeAutoscalingV1
ns string
} }
var horizontalpodautoscalersResource = v1.SchemeGroupVersion.WithResource("horizontalpodautoscalers") func newFakeHorizontalPodAutoscalers(fake *FakeAutoscalingV1, namespace string) typedautoscalingv1.HorizontalPodAutoscalerInterface {
return &fakeHorizontalPodAutoscalers{
var horizontalpodautoscalersKind = v1.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler") gentype.NewFakeClientWithListAndApply[*v1.HorizontalPodAutoscaler, *v1.HorizontalPodAutoscalerList, *autoscalingv1.HorizontalPodAutoscalerApplyConfiguration](
fake.Fake,
// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any. namespace,
func (c *FakeHorizontalPodAutoscalers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.HorizontalPodAutoscaler, err error) { v1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"),
emptyResult := &v1.HorizontalPodAutoscaler{} v1.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler"),
obj, err := c.Fake. func() *v1.HorizontalPodAutoscaler { return &v1.HorizontalPodAutoscaler{} },
Invokes(testing.NewGetActionWithOptions(horizontalpodautoscalersResource, c.ns, name, options), emptyResult) func() *v1.HorizontalPodAutoscalerList { return &v1.HorizontalPodAutoscalerList{} },
func(dst, src *v1.HorizontalPodAutoscalerList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.HorizontalPodAutoscalerList) []*v1.HorizontalPodAutoscaler {
return emptyResult, err return gentype.ToPointerSlice(list.Items)
},
func(list *v1.HorizontalPodAutoscalerList, items []*v1.HorizontalPodAutoscaler) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.HorizontalPodAutoscaler), err
}
// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors.
func (c *FakeHorizontalPodAutoscalers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.HorizontalPodAutoscalerList, err error) {
emptyResult := &v1.HorizontalPodAutoscalerList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(horizontalpodautoscalersResource, horizontalpodautoscalersKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.HorizontalPodAutoscalerList{ListMeta: obj.(*v1.HorizontalPodAutoscalerList).ListMeta}
for _, item := range obj.(*v1.HorizontalPodAutoscalerList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers.
func (c *FakeHorizontalPodAutoscalers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(horizontalpodautoscalersResource, c.ns, opts))
}
// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
func (c *FakeHorizontalPodAutoscalers) Create(ctx context.Context, horizontalPodAutoscaler *v1.HorizontalPodAutoscaler, opts metav1.CreateOptions) (result *v1.HorizontalPodAutoscaler, err error) {
emptyResult := &v1.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.HorizontalPodAutoscaler), err
}
// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
func (c *FakeHorizontalPodAutoscalers) Update(ctx context.Context, horizontalPodAutoscaler *v1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (result *v1.HorizontalPodAutoscaler, err error) {
emptyResult := &v1.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.HorizontalPodAutoscaler), 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 *FakeHorizontalPodAutoscalers) UpdateStatus(ctx context.Context, horizontalPodAutoscaler *v1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (result *v1.HorizontalPodAutoscaler, err error) {
emptyResult := &v1.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(horizontalpodautoscalersResource, "status", c.ns, horizontalPodAutoscaler, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.HorizontalPodAutoscaler), err
}
// Delete takes name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs.
func (c *FakeHorizontalPodAutoscalers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(horizontalpodautoscalersResource, c.ns, name, opts), &v1.HorizontalPodAutoscaler{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeHorizontalPodAutoscalers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(horizontalpodautoscalersResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.HorizontalPodAutoscalerList{})
return err
}
// Patch applies the patch and returns the patched horizontalPodAutoscaler.
func (c *FakeHorizontalPodAutoscalers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HorizontalPodAutoscaler, err error) {
emptyResult := &v1.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(horizontalpodautoscalersResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.HorizontalPodAutoscaler), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied horizontalPodAutoscaler.
func (c *FakeHorizontalPodAutoscalers) Apply(ctx context.Context, horizontalPodAutoscaler *autoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.HorizontalPodAutoscaler, err error) {
if horizontalPodAutoscaler == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil")
}
data, err := json.Marshal(horizontalPodAutoscaler)
if err != nil {
return nil, err
}
name := horizontalPodAutoscaler.Name
if name == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply")
}
emptyResult := &v1.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(horizontalpodautoscalersResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.HorizontalPodAutoscaler), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeHorizontalPodAutoscalers) ApplyStatus(ctx context.Context, horizontalPodAutoscaler *autoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.HorizontalPodAutoscaler, err error) {
if horizontalPodAutoscaler == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil")
}
data, err := json.Marshal(horizontalPodAutoscaler)
if err != nil {
return nil, err
}
name := horizontalPodAutoscaler.Name
if name == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply")
}
emptyResult := &v1.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(horizontalpodautoscalersResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.HorizontalPodAutoscaler), err
} }

View File

@@ -29,7 +29,7 @@ type FakeAutoscalingV2 struct {
} }
func (c *FakeAutoscalingV2) HorizontalPodAutoscalers(namespace string) v2.HorizontalPodAutoscalerInterface { func (c *FakeAutoscalingV2) HorizontalPodAutoscalers(namespace string) v2.HorizontalPodAutoscalerInterface {
return &FakeHorizontalPodAutoscalers{c, namespace} return newFakeHorizontalPodAutoscalers(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,179 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v2 "k8s.io/api/autoscaling/v2" v2 "k8s.io/api/autoscaling/v2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
autoscalingv2 "k8s.io/client-go/applyconfigurations/autoscaling/v2" autoscalingv2 "k8s.io/client-go/applyconfigurations/autoscaling/v2"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedautoscalingv2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2"
) )
// FakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface // fakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface
type FakeHorizontalPodAutoscalers struct { type fakeHorizontalPodAutoscalers struct {
*gentype.FakeClientWithListAndApply[*v2.HorizontalPodAutoscaler, *v2.HorizontalPodAutoscalerList, *autoscalingv2.HorizontalPodAutoscalerApplyConfiguration]
Fake *FakeAutoscalingV2 Fake *FakeAutoscalingV2
ns string
} }
var horizontalpodautoscalersResource = v2.SchemeGroupVersion.WithResource("horizontalpodautoscalers") func newFakeHorizontalPodAutoscalers(fake *FakeAutoscalingV2, namespace string) typedautoscalingv2.HorizontalPodAutoscalerInterface {
return &fakeHorizontalPodAutoscalers{
var horizontalpodautoscalersKind = v2.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler") gentype.NewFakeClientWithListAndApply[*v2.HorizontalPodAutoscaler, *v2.HorizontalPodAutoscalerList, *autoscalingv2.HorizontalPodAutoscalerApplyConfiguration](
fake.Fake,
// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any. namespace,
func (c *FakeHorizontalPodAutoscalers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.HorizontalPodAutoscaler, err error) { v2.SchemeGroupVersion.WithResource("horizontalpodautoscalers"),
emptyResult := &v2.HorizontalPodAutoscaler{} v2.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler"),
obj, err := c.Fake. func() *v2.HorizontalPodAutoscaler { return &v2.HorizontalPodAutoscaler{} },
Invokes(testing.NewGetActionWithOptions(horizontalpodautoscalersResource, c.ns, name, options), emptyResult) func() *v2.HorizontalPodAutoscalerList { return &v2.HorizontalPodAutoscalerList{} },
func(dst, src *v2.HorizontalPodAutoscalerList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v2.HorizontalPodAutoscalerList) []*v2.HorizontalPodAutoscaler {
return emptyResult, err return gentype.ToPointerSlice(list.Items)
},
func(list *v2.HorizontalPodAutoscalerList, items []*v2.HorizontalPodAutoscaler) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v2.HorizontalPodAutoscaler), err
}
// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors.
func (c *FakeHorizontalPodAutoscalers) List(ctx context.Context, opts v1.ListOptions) (result *v2.HorizontalPodAutoscalerList, err error) {
emptyResult := &v2.HorizontalPodAutoscalerList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(horizontalpodautoscalersResource, horizontalpodautoscalersKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v2.HorizontalPodAutoscalerList{ListMeta: obj.(*v2.HorizontalPodAutoscalerList).ListMeta}
for _, item := range obj.(*v2.HorizontalPodAutoscalerList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers.
func (c *FakeHorizontalPodAutoscalers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(horizontalpodautoscalersResource, c.ns, opts))
}
// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
func (c *FakeHorizontalPodAutoscalers) Create(ctx context.Context, horizontalPodAutoscaler *v2.HorizontalPodAutoscaler, opts v1.CreateOptions) (result *v2.HorizontalPodAutoscaler, err error) {
emptyResult := &v2.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2.HorizontalPodAutoscaler), err
}
// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
func (c *FakeHorizontalPodAutoscalers) Update(ctx context.Context, horizontalPodAutoscaler *v2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (result *v2.HorizontalPodAutoscaler, err error) {
emptyResult := &v2.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2.HorizontalPodAutoscaler), 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 *FakeHorizontalPodAutoscalers) UpdateStatus(ctx context.Context, horizontalPodAutoscaler *v2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (result *v2.HorizontalPodAutoscaler, err error) {
emptyResult := &v2.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(horizontalpodautoscalersResource, "status", c.ns, horizontalPodAutoscaler, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2.HorizontalPodAutoscaler), err
}
// Delete takes name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs.
func (c *FakeHorizontalPodAutoscalers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(horizontalpodautoscalersResource, c.ns, name, opts), &v2.HorizontalPodAutoscaler{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeHorizontalPodAutoscalers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(horizontalpodautoscalersResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v2.HorizontalPodAutoscalerList{})
return err
}
// Patch applies the patch and returns the patched horizontalPodAutoscaler.
func (c *FakeHorizontalPodAutoscalers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.HorizontalPodAutoscaler, err error) {
emptyResult := &v2.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(horizontalpodautoscalersResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2.HorizontalPodAutoscaler), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied horizontalPodAutoscaler.
func (c *FakeHorizontalPodAutoscalers) Apply(ctx context.Context, horizontalPodAutoscaler *autoscalingv2.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *v2.HorizontalPodAutoscaler, err error) {
if horizontalPodAutoscaler == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil")
}
data, err := json.Marshal(horizontalPodAutoscaler)
if err != nil {
return nil, err
}
name := horizontalPodAutoscaler.Name
if name == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply")
}
emptyResult := &v2.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(horizontalpodautoscalersResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2.HorizontalPodAutoscaler), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeHorizontalPodAutoscalers) ApplyStatus(ctx context.Context, horizontalPodAutoscaler *autoscalingv2.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *v2.HorizontalPodAutoscaler, err error) {
if horizontalPodAutoscaler == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil")
}
data, err := json.Marshal(horizontalPodAutoscaler)
if err != nil {
return nil, err
}
name := horizontalPodAutoscaler.Name
if name == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply")
}
emptyResult := &v2.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(horizontalpodautoscalersResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2.HorizontalPodAutoscaler), err
} }

View File

@@ -29,7 +29,7 @@ type FakeAutoscalingV2beta1 struct {
} }
func (c *FakeAutoscalingV2beta1) HorizontalPodAutoscalers(namespace string) v2beta1.HorizontalPodAutoscalerInterface { func (c *FakeAutoscalingV2beta1) HorizontalPodAutoscalers(namespace string) v2beta1.HorizontalPodAutoscalerInterface {
return &FakeHorizontalPodAutoscalers{c, namespace} return newFakeHorizontalPodAutoscalers(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,179 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v2beta1 "k8s.io/api/autoscaling/v2beta1" v2beta1 "k8s.io/api/autoscaling/v2beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
autoscalingv2beta1 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta1" autoscalingv2beta1 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedautoscalingv2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1"
) )
// FakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface // fakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface
type FakeHorizontalPodAutoscalers struct { type fakeHorizontalPodAutoscalers struct {
*gentype.FakeClientWithListAndApply[*v2beta1.HorizontalPodAutoscaler, *v2beta1.HorizontalPodAutoscalerList, *autoscalingv2beta1.HorizontalPodAutoscalerApplyConfiguration]
Fake *FakeAutoscalingV2beta1 Fake *FakeAutoscalingV2beta1
ns string
} }
var horizontalpodautoscalersResource = v2beta1.SchemeGroupVersion.WithResource("horizontalpodautoscalers") func newFakeHorizontalPodAutoscalers(fake *FakeAutoscalingV2beta1, namespace string) typedautoscalingv2beta1.HorizontalPodAutoscalerInterface {
return &fakeHorizontalPodAutoscalers{
var horizontalpodautoscalersKind = v2beta1.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler") gentype.NewFakeClientWithListAndApply[*v2beta1.HorizontalPodAutoscaler, *v2beta1.HorizontalPodAutoscalerList, *autoscalingv2beta1.HorizontalPodAutoscalerApplyConfiguration](
fake.Fake,
// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any. namespace,
func (c *FakeHorizontalPodAutoscalers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.HorizontalPodAutoscaler, err error) { v2beta1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"),
emptyResult := &v2beta1.HorizontalPodAutoscaler{} v2beta1.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler"),
obj, err := c.Fake. func() *v2beta1.HorizontalPodAutoscaler { return &v2beta1.HorizontalPodAutoscaler{} },
Invokes(testing.NewGetActionWithOptions(horizontalpodautoscalersResource, c.ns, name, options), emptyResult) func() *v2beta1.HorizontalPodAutoscalerList { return &v2beta1.HorizontalPodAutoscalerList{} },
func(dst, src *v2beta1.HorizontalPodAutoscalerList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v2beta1.HorizontalPodAutoscalerList) []*v2beta1.HorizontalPodAutoscaler {
return emptyResult, err return gentype.ToPointerSlice(list.Items)
},
func(list *v2beta1.HorizontalPodAutoscalerList, items []*v2beta1.HorizontalPodAutoscaler) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v2beta1.HorizontalPodAutoscaler), err
}
// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors.
func (c *FakeHorizontalPodAutoscalers) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.HorizontalPodAutoscalerList, err error) {
emptyResult := &v2beta1.HorizontalPodAutoscalerList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(horizontalpodautoscalersResource, horizontalpodautoscalersKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v2beta1.HorizontalPodAutoscalerList{ListMeta: obj.(*v2beta1.HorizontalPodAutoscalerList).ListMeta}
for _, item := range obj.(*v2beta1.HorizontalPodAutoscalerList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers.
func (c *FakeHorizontalPodAutoscalers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(horizontalpodautoscalersResource, c.ns, opts))
}
// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
func (c *FakeHorizontalPodAutoscalers) Create(ctx context.Context, horizontalPodAutoscaler *v2beta1.HorizontalPodAutoscaler, opts v1.CreateOptions) (result *v2beta1.HorizontalPodAutoscaler, err error) {
emptyResult := &v2beta1.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2beta1.HorizontalPodAutoscaler), err
}
// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
func (c *FakeHorizontalPodAutoscalers) Update(ctx context.Context, horizontalPodAutoscaler *v2beta1.HorizontalPodAutoscaler, opts v1.UpdateOptions) (result *v2beta1.HorizontalPodAutoscaler, err error) {
emptyResult := &v2beta1.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2beta1.HorizontalPodAutoscaler), 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 *FakeHorizontalPodAutoscalers) UpdateStatus(ctx context.Context, horizontalPodAutoscaler *v2beta1.HorizontalPodAutoscaler, opts v1.UpdateOptions) (result *v2beta1.HorizontalPodAutoscaler, err error) {
emptyResult := &v2beta1.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(horizontalpodautoscalersResource, "status", c.ns, horizontalPodAutoscaler, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2beta1.HorizontalPodAutoscaler), err
}
// Delete takes name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs.
func (c *FakeHorizontalPodAutoscalers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(horizontalpodautoscalersResource, c.ns, name, opts), &v2beta1.HorizontalPodAutoscaler{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeHorizontalPodAutoscalers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(horizontalpodautoscalersResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v2beta1.HorizontalPodAutoscalerList{})
return err
}
// Patch applies the patch and returns the patched horizontalPodAutoscaler.
func (c *FakeHorizontalPodAutoscalers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.HorizontalPodAutoscaler, err error) {
emptyResult := &v2beta1.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(horizontalpodautoscalersResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2beta1.HorizontalPodAutoscaler), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied horizontalPodAutoscaler.
func (c *FakeHorizontalPodAutoscalers) Apply(ctx context.Context, horizontalPodAutoscaler *autoscalingv2beta1.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *v2beta1.HorizontalPodAutoscaler, err error) {
if horizontalPodAutoscaler == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil")
}
data, err := json.Marshal(horizontalPodAutoscaler)
if err != nil {
return nil, err
}
name := horizontalPodAutoscaler.Name
if name == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply")
}
emptyResult := &v2beta1.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(horizontalpodautoscalersResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2beta1.HorizontalPodAutoscaler), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeHorizontalPodAutoscalers) ApplyStatus(ctx context.Context, horizontalPodAutoscaler *autoscalingv2beta1.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *v2beta1.HorizontalPodAutoscaler, err error) {
if horizontalPodAutoscaler == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil")
}
data, err := json.Marshal(horizontalPodAutoscaler)
if err != nil {
return nil, err
}
name := horizontalPodAutoscaler.Name
if name == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply")
}
emptyResult := &v2beta1.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(horizontalpodautoscalersResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2beta1.HorizontalPodAutoscaler), err
} }

View File

@@ -29,7 +29,7 @@ type FakeAutoscalingV2beta2 struct {
} }
func (c *FakeAutoscalingV2beta2) HorizontalPodAutoscalers(namespace string) v2beta2.HorizontalPodAutoscalerInterface { func (c *FakeAutoscalingV2beta2) HorizontalPodAutoscalers(namespace string) v2beta2.HorizontalPodAutoscalerInterface {
return &FakeHorizontalPodAutoscalers{c, namespace} return newFakeHorizontalPodAutoscalers(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,179 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v2beta2 "k8s.io/api/autoscaling/v2beta2" v2beta2 "k8s.io/api/autoscaling/v2beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
autoscalingv2beta2 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta2" autoscalingv2beta2 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta2"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedautoscalingv2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2"
) )
// FakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface // fakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface
type FakeHorizontalPodAutoscalers struct { type fakeHorizontalPodAutoscalers struct {
*gentype.FakeClientWithListAndApply[*v2beta2.HorizontalPodAutoscaler, *v2beta2.HorizontalPodAutoscalerList, *autoscalingv2beta2.HorizontalPodAutoscalerApplyConfiguration]
Fake *FakeAutoscalingV2beta2 Fake *FakeAutoscalingV2beta2
ns string
} }
var horizontalpodautoscalersResource = v2beta2.SchemeGroupVersion.WithResource("horizontalpodautoscalers") func newFakeHorizontalPodAutoscalers(fake *FakeAutoscalingV2beta2, namespace string) typedautoscalingv2beta2.HorizontalPodAutoscalerInterface {
return &fakeHorizontalPodAutoscalers{
var horizontalpodautoscalersKind = v2beta2.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler") gentype.NewFakeClientWithListAndApply[*v2beta2.HorizontalPodAutoscaler, *v2beta2.HorizontalPodAutoscalerList, *autoscalingv2beta2.HorizontalPodAutoscalerApplyConfiguration](
fake.Fake,
// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any. namespace,
func (c *FakeHorizontalPodAutoscalers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.HorizontalPodAutoscaler, err error) { v2beta2.SchemeGroupVersion.WithResource("horizontalpodautoscalers"),
emptyResult := &v2beta2.HorizontalPodAutoscaler{} v2beta2.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler"),
obj, err := c.Fake. func() *v2beta2.HorizontalPodAutoscaler { return &v2beta2.HorizontalPodAutoscaler{} },
Invokes(testing.NewGetActionWithOptions(horizontalpodautoscalersResource, c.ns, name, options), emptyResult) func() *v2beta2.HorizontalPodAutoscalerList { return &v2beta2.HorizontalPodAutoscalerList{} },
func(dst, src *v2beta2.HorizontalPodAutoscalerList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v2beta2.HorizontalPodAutoscalerList) []*v2beta2.HorizontalPodAutoscaler {
return emptyResult, err return gentype.ToPointerSlice(list.Items)
},
func(list *v2beta2.HorizontalPodAutoscalerList, items []*v2beta2.HorizontalPodAutoscaler) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v2beta2.HorizontalPodAutoscaler), err
}
// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors.
func (c *FakeHorizontalPodAutoscalers) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.HorizontalPodAutoscalerList, err error) {
emptyResult := &v2beta2.HorizontalPodAutoscalerList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(horizontalpodautoscalersResource, horizontalpodautoscalersKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v2beta2.HorizontalPodAutoscalerList{ListMeta: obj.(*v2beta2.HorizontalPodAutoscalerList).ListMeta}
for _, item := range obj.(*v2beta2.HorizontalPodAutoscalerList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers.
func (c *FakeHorizontalPodAutoscalers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(horizontalpodautoscalersResource, c.ns, opts))
}
// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
func (c *FakeHorizontalPodAutoscalers) Create(ctx context.Context, horizontalPodAutoscaler *v2beta2.HorizontalPodAutoscaler, opts v1.CreateOptions) (result *v2beta2.HorizontalPodAutoscaler, err error) {
emptyResult := &v2beta2.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2beta2.HorizontalPodAutoscaler), err
}
// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any.
func (c *FakeHorizontalPodAutoscalers) Update(ctx context.Context, horizontalPodAutoscaler *v2beta2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (result *v2beta2.HorizontalPodAutoscaler, err error) {
emptyResult := &v2beta2.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2beta2.HorizontalPodAutoscaler), 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 *FakeHorizontalPodAutoscalers) UpdateStatus(ctx context.Context, horizontalPodAutoscaler *v2beta2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (result *v2beta2.HorizontalPodAutoscaler, err error) {
emptyResult := &v2beta2.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(horizontalpodautoscalersResource, "status", c.ns, horizontalPodAutoscaler, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2beta2.HorizontalPodAutoscaler), err
}
// Delete takes name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs.
func (c *FakeHorizontalPodAutoscalers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(horizontalpodautoscalersResource, c.ns, name, opts), &v2beta2.HorizontalPodAutoscaler{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeHorizontalPodAutoscalers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(horizontalpodautoscalersResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v2beta2.HorizontalPodAutoscalerList{})
return err
}
// Patch applies the patch and returns the patched horizontalPodAutoscaler.
func (c *FakeHorizontalPodAutoscalers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.HorizontalPodAutoscaler, err error) {
emptyResult := &v2beta2.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(horizontalpodautoscalersResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2beta2.HorizontalPodAutoscaler), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied horizontalPodAutoscaler.
func (c *FakeHorizontalPodAutoscalers) Apply(ctx context.Context, horizontalPodAutoscaler *autoscalingv2beta2.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *v2beta2.HorizontalPodAutoscaler, err error) {
if horizontalPodAutoscaler == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil")
}
data, err := json.Marshal(horizontalPodAutoscaler)
if err != nil {
return nil, err
}
name := horizontalPodAutoscaler.Name
if name == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply")
}
emptyResult := &v2beta2.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(horizontalpodautoscalersResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2beta2.HorizontalPodAutoscaler), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeHorizontalPodAutoscalers) ApplyStatus(ctx context.Context, horizontalPodAutoscaler *autoscalingv2beta2.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *v2beta2.HorizontalPodAutoscaler, err error) {
if horizontalPodAutoscaler == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil")
}
data, err := json.Marshal(horizontalPodAutoscaler)
if err != nil {
return nil, err
}
name := horizontalPodAutoscaler.Name
if name == nil {
return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply")
}
emptyResult := &v2beta2.HorizontalPodAutoscaler{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(horizontalpodautoscalersResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v2beta2.HorizontalPodAutoscaler), err
} }

View File

@@ -29,11 +29,11 @@ type FakeBatchV1 struct {
} }
func (c *FakeBatchV1) CronJobs(namespace string) v1.CronJobInterface { func (c *FakeBatchV1) CronJobs(namespace string) v1.CronJobInterface {
return &FakeCronJobs{c, namespace} return newFakeCronJobs(c, namespace)
} }
func (c *FakeBatchV1) Jobs(namespace string) v1.JobInterface { func (c *FakeBatchV1) Jobs(namespace string) v1.JobInterface {
return &FakeJobs{c, namespace} return newFakeJobs(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,179 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/batch/v1" v1 "k8s.io/api/batch/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
batchv1 "k8s.io/client-go/applyconfigurations/batch/v1" batchv1 "k8s.io/client-go/applyconfigurations/batch/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedbatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1"
) )
// FakeCronJobs implements CronJobInterface // fakeCronJobs implements CronJobInterface
type FakeCronJobs struct { type fakeCronJobs struct {
*gentype.FakeClientWithListAndApply[*v1.CronJob, *v1.CronJobList, *batchv1.CronJobApplyConfiguration]
Fake *FakeBatchV1 Fake *FakeBatchV1
ns string
} }
var cronjobsResource = v1.SchemeGroupVersion.WithResource("cronjobs") func newFakeCronJobs(fake *FakeBatchV1, namespace string) typedbatchv1.CronJobInterface {
return &fakeCronJobs{
var cronjobsKind = v1.SchemeGroupVersion.WithKind("CronJob") gentype.NewFakeClientWithListAndApply[*v1.CronJob, *v1.CronJobList, *batchv1.CronJobApplyConfiguration](
fake.Fake,
// Get takes name of the cronJob, and returns the corresponding cronJob object, and an error if there is any. namespace,
func (c *FakeCronJobs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CronJob, err error) { v1.SchemeGroupVersion.WithResource("cronjobs"),
emptyResult := &v1.CronJob{} v1.SchemeGroupVersion.WithKind("CronJob"),
obj, err := c.Fake. func() *v1.CronJob { return &v1.CronJob{} },
Invokes(testing.NewGetActionWithOptions(cronjobsResource, c.ns, name, options), emptyResult) func() *v1.CronJobList { return &v1.CronJobList{} },
func(dst, src *v1.CronJobList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.CronJobList) []*v1.CronJob { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.CronJobList, items []*v1.CronJob) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.CronJob), err
}
// List takes label and field selectors, and returns the list of CronJobs that match those selectors.
func (c *FakeCronJobs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CronJobList, err error) {
emptyResult := &v1.CronJobList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(cronjobsResource, cronjobsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.CronJobList{ListMeta: obj.(*v1.CronJobList).ListMeta}
for _, item := range obj.(*v1.CronJobList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested cronJobs.
func (c *FakeCronJobs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(cronjobsResource, c.ns, opts))
}
// Create takes the representation of a cronJob and creates it. Returns the server's representation of the cronJob, and an error, if there is any.
func (c *FakeCronJobs) Create(ctx context.Context, cronJob *v1.CronJob, opts metav1.CreateOptions) (result *v1.CronJob, err error) {
emptyResult := &v1.CronJob{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(cronjobsResource, c.ns, cronJob, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CronJob), err
}
// Update takes the representation of a cronJob and updates it. Returns the server's representation of the cronJob, and an error, if there is any.
func (c *FakeCronJobs) Update(ctx context.Context, cronJob *v1.CronJob, opts metav1.UpdateOptions) (result *v1.CronJob, err error) {
emptyResult := &v1.CronJob{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(cronjobsResource, c.ns, cronJob, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CronJob), 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 *FakeCronJobs) UpdateStatus(ctx context.Context, cronJob *v1.CronJob, opts metav1.UpdateOptions) (result *v1.CronJob, err error) {
emptyResult := &v1.CronJob{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(cronjobsResource, "status", c.ns, cronJob, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CronJob), err
}
// Delete takes name of the cronJob and deletes it. Returns an error if one occurs.
func (c *FakeCronJobs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(cronjobsResource, c.ns, name, opts), &v1.CronJob{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeCronJobs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(cronjobsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.CronJobList{})
return err
}
// Patch applies the patch and returns the patched cronJob.
func (c *FakeCronJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CronJob, err error) {
emptyResult := &v1.CronJob{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(cronjobsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CronJob), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied cronJob.
func (c *FakeCronJobs) Apply(ctx context.Context, cronJob *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CronJob, err error) {
if cronJob == nil {
return nil, fmt.Errorf("cronJob provided to Apply must not be nil")
}
data, err := json.Marshal(cronJob)
if err != nil {
return nil, err
}
name := cronJob.Name
if name == nil {
return nil, fmt.Errorf("cronJob.Name must be provided to Apply")
}
emptyResult := &v1.CronJob{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(cronjobsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CronJob), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeCronJobs) ApplyStatus(ctx context.Context, cronJob *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CronJob, err error) {
if cronJob == nil {
return nil, fmt.Errorf("cronJob provided to Apply must not be nil")
}
data, err := json.Marshal(cronJob)
if err != nil {
return nil, err
}
name := cronJob.Name
if name == nil {
return nil, fmt.Errorf("cronJob.Name must be provided to Apply")
}
emptyResult := &v1.CronJob{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(cronjobsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CronJob), err
} }

View File

@@ -19,179 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/batch/v1" v1 "k8s.io/api/batch/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
batchv1 "k8s.io/client-go/applyconfigurations/batch/v1" batchv1 "k8s.io/client-go/applyconfigurations/batch/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedbatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1"
) )
// FakeJobs implements JobInterface // fakeJobs implements JobInterface
type FakeJobs struct { type fakeJobs struct {
*gentype.FakeClientWithListAndApply[*v1.Job, *v1.JobList, *batchv1.JobApplyConfiguration]
Fake *FakeBatchV1 Fake *FakeBatchV1
ns string
} }
var jobsResource = v1.SchemeGroupVersion.WithResource("jobs") func newFakeJobs(fake *FakeBatchV1, namespace string) typedbatchv1.JobInterface {
return &fakeJobs{
var jobsKind = v1.SchemeGroupVersion.WithKind("Job") gentype.NewFakeClientWithListAndApply[*v1.Job, *v1.JobList, *batchv1.JobApplyConfiguration](
fake.Fake,
// Get takes name of the job, and returns the corresponding job object, and an error if there is any. namespace,
func (c *FakeJobs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Job, err error) { v1.SchemeGroupVersion.WithResource("jobs"),
emptyResult := &v1.Job{} v1.SchemeGroupVersion.WithKind("Job"),
obj, err := c.Fake. func() *v1.Job { return &v1.Job{} },
Invokes(testing.NewGetActionWithOptions(jobsResource, c.ns, name, options), emptyResult) func() *v1.JobList { return &v1.JobList{} },
func(dst, src *v1.JobList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.JobList) []*v1.Job { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.JobList, items []*v1.Job) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.Job), err
}
// List takes label and field selectors, and returns the list of Jobs that match those selectors.
func (c *FakeJobs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.JobList, err error) {
emptyResult := &v1.JobList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(jobsResource, jobsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.JobList{ListMeta: obj.(*v1.JobList).ListMeta}
for _, item := range obj.(*v1.JobList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested jobs.
func (c *FakeJobs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(jobsResource, c.ns, opts))
}
// Create takes the representation of a job and creates it. Returns the server's representation of the job, and an error, if there is any.
func (c *FakeJobs) Create(ctx context.Context, job *v1.Job, opts metav1.CreateOptions) (result *v1.Job, err error) {
emptyResult := &v1.Job{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(jobsResource, c.ns, job, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Job), err
}
// Update takes the representation of a job and updates it. Returns the server's representation of the job, and an error, if there is any.
func (c *FakeJobs) Update(ctx context.Context, job *v1.Job, opts metav1.UpdateOptions) (result *v1.Job, err error) {
emptyResult := &v1.Job{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(jobsResource, c.ns, job, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Job), 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 *FakeJobs) UpdateStatus(ctx context.Context, job *v1.Job, opts metav1.UpdateOptions) (result *v1.Job, err error) {
emptyResult := &v1.Job{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(jobsResource, "status", c.ns, job, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Job), err
}
// Delete takes name of the job and deletes it. Returns an error if one occurs.
func (c *FakeJobs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(jobsResource, c.ns, name, opts), &v1.Job{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeJobs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(jobsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.JobList{})
return err
}
// Patch applies the patch and returns the patched job.
func (c *FakeJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Job, err error) {
emptyResult := &v1.Job{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(jobsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Job), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied job.
func (c *FakeJobs) Apply(ctx context.Context, job *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Job, err error) {
if job == nil {
return nil, fmt.Errorf("job provided to Apply must not be nil")
}
data, err := json.Marshal(job)
if err != nil {
return nil, err
}
name := job.Name
if name == nil {
return nil, fmt.Errorf("job.Name must be provided to Apply")
}
emptyResult := &v1.Job{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(jobsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Job), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeJobs) ApplyStatus(ctx context.Context, job *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Job, err error) {
if job == nil {
return nil, fmt.Errorf("job provided to Apply must not be nil")
}
data, err := json.Marshal(job)
if err != nil {
return nil, err
}
name := job.Name
if name == nil {
return nil, fmt.Errorf("job.Name must be provided to Apply")
}
emptyResult := &v1.Job{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(jobsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Job), err
} }

View File

@@ -29,7 +29,7 @@ type FakeBatchV1beta1 struct {
} }
func (c *FakeBatchV1beta1) CronJobs(namespace string) v1beta1.CronJobInterface { func (c *FakeBatchV1beta1) CronJobs(namespace string) v1beta1.CronJobInterface {
return &FakeCronJobs{c, namespace} return newFakeCronJobs(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,179 +19,33 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta1 "k8s.io/api/batch/v1beta1" v1beta1 "k8s.io/api/batch/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
batchv1beta1 "k8s.io/client-go/applyconfigurations/batch/v1beta1" batchv1beta1 "k8s.io/client-go/applyconfigurations/batch/v1beta1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedbatchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1"
) )
// FakeCronJobs implements CronJobInterface // fakeCronJobs implements CronJobInterface
type FakeCronJobs struct { type fakeCronJobs struct {
*gentype.FakeClientWithListAndApply[*v1beta1.CronJob, *v1beta1.CronJobList, *batchv1beta1.CronJobApplyConfiguration]
Fake *FakeBatchV1beta1 Fake *FakeBatchV1beta1
ns string
} }
var cronjobsResource = v1beta1.SchemeGroupVersion.WithResource("cronjobs") func newFakeCronJobs(fake *FakeBatchV1beta1, namespace string) typedbatchv1beta1.CronJobInterface {
return &fakeCronJobs{
var cronjobsKind = v1beta1.SchemeGroupVersion.WithKind("CronJob") gentype.NewFakeClientWithListAndApply[*v1beta1.CronJob, *v1beta1.CronJobList, *batchv1beta1.CronJobApplyConfiguration](
fake.Fake,
// Get takes name of the cronJob, and returns the corresponding cronJob object, and an error if there is any. namespace,
func (c *FakeCronJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.CronJob, err error) { v1beta1.SchemeGroupVersion.WithResource("cronjobs"),
emptyResult := &v1beta1.CronJob{} v1beta1.SchemeGroupVersion.WithKind("CronJob"),
obj, err := c.Fake. func() *v1beta1.CronJob { return &v1beta1.CronJob{} },
Invokes(testing.NewGetActionWithOptions(cronjobsResource, c.ns, name, options), emptyResult) func() *v1beta1.CronJobList { return &v1beta1.CronJobList{} },
func(dst, src *v1beta1.CronJobList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1beta1.CronJobList) []*v1beta1.CronJob { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1beta1.CronJobList, items []*v1beta1.CronJob) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta1.CronJob), err
}
// List takes label and field selectors, and returns the list of CronJobs that match those selectors.
func (c *FakeCronJobs) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.CronJobList, err error) {
emptyResult := &v1beta1.CronJobList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(cronjobsResource, cronjobsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.CronJobList{ListMeta: obj.(*v1beta1.CronJobList).ListMeta}
for _, item := range obj.(*v1beta1.CronJobList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested cronJobs.
func (c *FakeCronJobs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(cronjobsResource, c.ns, opts))
}
// Create takes the representation of a cronJob and creates it. Returns the server's representation of the cronJob, and an error, if there is any.
func (c *FakeCronJobs) Create(ctx context.Context, cronJob *v1beta1.CronJob, opts v1.CreateOptions) (result *v1beta1.CronJob, err error) {
emptyResult := &v1beta1.CronJob{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(cronjobsResource, c.ns, cronJob, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CronJob), err
}
// Update takes the representation of a cronJob and updates it. Returns the server's representation of the cronJob, and an error, if there is any.
func (c *FakeCronJobs) Update(ctx context.Context, cronJob *v1beta1.CronJob, opts v1.UpdateOptions) (result *v1beta1.CronJob, err error) {
emptyResult := &v1beta1.CronJob{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(cronjobsResource, c.ns, cronJob, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CronJob), 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 *FakeCronJobs) UpdateStatus(ctx context.Context, cronJob *v1beta1.CronJob, opts v1.UpdateOptions) (result *v1beta1.CronJob, err error) {
emptyResult := &v1beta1.CronJob{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(cronjobsResource, "status", c.ns, cronJob, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CronJob), err
}
// Delete takes name of the cronJob and deletes it. Returns an error if one occurs.
func (c *FakeCronJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(cronjobsResource, c.ns, name, opts), &v1beta1.CronJob{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeCronJobs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(cronjobsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.CronJobList{})
return err
}
// Patch applies the patch and returns the patched cronJob.
func (c *FakeCronJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.CronJob, err error) {
emptyResult := &v1beta1.CronJob{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(cronjobsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CronJob), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied cronJob.
func (c *FakeCronJobs) Apply(ctx context.Context, cronJob *batchv1beta1.CronJobApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.CronJob, err error) {
if cronJob == nil {
return nil, fmt.Errorf("cronJob provided to Apply must not be nil")
}
data, err := json.Marshal(cronJob)
if err != nil {
return nil, err
}
name := cronJob.Name
if name == nil {
return nil, fmt.Errorf("cronJob.Name must be provided to Apply")
}
emptyResult := &v1beta1.CronJob{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(cronjobsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CronJob), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeCronJobs) ApplyStatus(ctx context.Context, cronJob *batchv1beta1.CronJobApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.CronJob, err error) {
if cronJob == nil {
return nil, fmt.Errorf("cronJob provided to Apply must not be nil")
}
data, err := json.Marshal(cronJob)
if err != nil {
return nil, err
}
name := cronJob.Name
if name == nil {
return nil, fmt.Errorf("cronJob.Name must be provided to Apply")
}
emptyResult := &v1beta1.CronJob{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(cronjobsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CronJob), err
} }

View File

@@ -29,7 +29,7 @@ type FakeCertificatesV1 struct {
} }
func (c *FakeCertificatesV1) CertificateSigningRequests() v1.CertificateSigningRequestInterface { func (c *FakeCertificatesV1) CertificateSigningRequests() v1.CertificateSigningRequestInterface {
return &FakeCertificateSigningRequests{c} return newFakeCertificateSigningRequests(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -20,176 +20,47 @@ package fake
import ( import (
context "context" context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/certificates/v1" v1 "k8s.io/api/certificates/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
certificatesv1 "k8s.io/client-go/applyconfigurations/certificates/v1" certificatesv1 "k8s.io/client-go/applyconfigurations/certificates/v1"
gentype "k8s.io/client-go/gentype"
typedcertificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
// FakeCertificateSigningRequests implements CertificateSigningRequestInterface // fakeCertificateSigningRequests implements CertificateSigningRequestInterface
type FakeCertificateSigningRequests struct { type fakeCertificateSigningRequests struct {
*gentype.FakeClientWithListAndApply[*v1.CertificateSigningRequest, *v1.CertificateSigningRequestList, *certificatesv1.CertificateSigningRequestApplyConfiguration]
Fake *FakeCertificatesV1 Fake *FakeCertificatesV1
} }
var certificatesigningrequestsResource = v1.SchemeGroupVersion.WithResource("certificatesigningrequests") func newFakeCertificateSigningRequests(fake *FakeCertificatesV1) typedcertificatesv1.CertificateSigningRequestInterface {
return &fakeCertificateSigningRequests{
var certificatesigningrequestsKind = v1.SchemeGroupVersion.WithKind("CertificateSigningRequest") gentype.NewFakeClientWithListAndApply[*v1.CertificateSigningRequest, *v1.CertificateSigningRequestList, *certificatesv1.CertificateSigningRequestApplyConfiguration](
fake.Fake,
// Get takes name of the certificateSigningRequest, and returns the corresponding certificateSigningRequest object, and an error if there is any. "",
func (c *FakeCertificateSigningRequests) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CertificateSigningRequest, err error) { v1.SchemeGroupVersion.WithResource("certificatesigningrequests"),
emptyResult := &v1.CertificateSigningRequest{} v1.SchemeGroupVersion.WithKind("CertificateSigningRequest"),
obj, err := c.Fake. func() *v1.CertificateSigningRequest { return &v1.CertificateSigningRequest{} },
Invokes(testing.NewRootGetActionWithOptions(certificatesigningrequestsResource, name, options), emptyResult) func() *v1.CertificateSigningRequestList { return &v1.CertificateSigningRequestList{} },
if obj == nil { func(dst, src *v1.CertificateSigningRequestList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1.CertificateSigningRequestList) []*v1.CertificateSigningRequest {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1.CertificateSigningRequestList, items []*v1.CertificateSigningRequest) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.CertificateSigningRequest), err
}
// List takes label and field selectors, and returns the list of CertificateSigningRequests that match those selectors.
func (c *FakeCertificateSigningRequests) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CertificateSigningRequestList, err error) {
emptyResult := &v1.CertificateSigningRequestList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(certificatesigningrequestsResource, certificatesigningrequestsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.CertificateSigningRequestList{ListMeta: obj.(*v1.CertificateSigningRequestList).ListMeta}
for _, item := range obj.(*v1.CertificateSigningRequestList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested certificateSigningRequests.
func (c *FakeCertificateSigningRequests) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(certificatesigningrequestsResource, opts))
}
// Create takes the representation of a certificateSigningRequest and creates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any.
func (c *FakeCertificateSigningRequests) Create(ctx context.Context, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.CreateOptions) (result *v1.CertificateSigningRequest, err error) {
emptyResult := &v1.CertificateSigningRequest{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(certificatesigningrequestsResource, certificateSigningRequest, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CertificateSigningRequest), err
}
// Update takes the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any.
func (c *FakeCertificateSigningRequests) Update(ctx context.Context, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (result *v1.CertificateSigningRequest, err error) {
emptyResult := &v1.CertificateSigningRequest{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(certificatesigningrequestsResource, certificateSigningRequest, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CertificateSigningRequest), 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 *FakeCertificateSigningRequests) UpdateStatus(ctx context.Context, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (result *v1.CertificateSigningRequest, err error) {
emptyResult := &v1.CertificateSigningRequest{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(certificatesigningrequestsResource, "status", certificateSigningRequest, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CertificateSigningRequest), err
}
// Delete takes name of the certificateSigningRequest and deletes it. Returns an error if one occurs.
func (c *FakeCertificateSigningRequests) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(certificatesigningrequestsResource, name, opts), &v1.CertificateSigningRequest{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeCertificateSigningRequests) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(certificatesigningrequestsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.CertificateSigningRequestList{})
return err
}
// Patch applies the patch and returns the patched certificateSigningRequest.
func (c *FakeCertificateSigningRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CertificateSigningRequest, err error) {
emptyResult := &v1.CertificateSigningRequest{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(certificatesigningrequestsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CertificateSigningRequest), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied certificateSigningRequest.
func (c *FakeCertificateSigningRequests) Apply(ctx context.Context, certificateSigningRequest *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CertificateSigningRequest, err error) {
if certificateSigningRequest == nil {
return nil, fmt.Errorf("certificateSigningRequest provided to Apply must not be nil")
}
data, err := json.Marshal(certificateSigningRequest)
if err != nil {
return nil, err
}
name := certificateSigningRequest.Name
if name == nil {
return nil, fmt.Errorf("certificateSigningRequest.Name must be provided to Apply")
}
emptyResult := &v1.CertificateSigningRequest{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(certificatesigningrequestsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CertificateSigningRequest), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeCertificateSigningRequests) ApplyStatus(ctx context.Context, certificateSigningRequest *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CertificateSigningRequest, err error) {
if certificateSigningRequest == nil {
return nil, fmt.Errorf("certificateSigningRequest provided to Apply must not be nil")
}
data, err := json.Marshal(certificateSigningRequest)
if err != nil {
return nil, err
}
name := certificateSigningRequest.Name
if name == nil {
return nil, fmt.Errorf("certificateSigningRequest.Name must be provided to Apply")
}
emptyResult := &v1.CertificateSigningRequest{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(certificatesigningrequestsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.CertificateSigningRequest), err
} }
// UpdateApproval takes the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any. // UpdateApproval takes the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any.
func (c *FakeCertificateSigningRequests) UpdateApproval(ctx context.Context, certificateSigningRequestName string, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (result *v1.CertificateSigningRequest, err error) { func (c *fakeCertificateSigningRequests) UpdateApproval(ctx context.Context, certificateSigningRequestName string, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (result *v1.CertificateSigningRequest, err error) {
emptyResult := &v1.CertificateSigningRequest{} emptyResult := &v1.CertificateSigningRequest{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(certificatesigningrequestsResource, "approval", certificateSigningRequest, opts), emptyResult) Invokes(testing.NewRootUpdateSubresourceActionWithOptions(c.Resource(), "approval", certificateSigningRequest, opts), emptyResult)
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err
} }

View File

@@ -29,7 +29,7 @@ type FakeCertificatesV1alpha1 struct {
} }
func (c *FakeCertificatesV1alpha1) ClusterTrustBundles() v1alpha1.ClusterTrustBundleInterface { func (c *FakeCertificatesV1alpha1) ClusterTrustBundles() v1alpha1.ClusterTrustBundleInterface {
return &FakeClusterTrustBundles{c} return newFakeClusterTrustBundles(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,133 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1alpha1 "k8s.io/api/certificates/v1alpha1" v1alpha1 "k8s.io/api/certificates/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
certificatesv1alpha1 "k8s.io/client-go/applyconfigurations/certificates/v1alpha1" certificatesv1alpha1 "k8s.io/client-go/applyconfigurations/certificates/v1alpha1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcertificatesv1alpha1 "k8s.io/client-go/kubernetes/typed/certificates/v1alpha1"
) )
// FakeClusterTrustBundles implements ClusterTrustBundleInterface // fakeClusterTrustBundles implements ClusterTrustBundleInterface
type FakeClusterTrustBundles struct { type fakeClusterTrustBundles struct {
*gentype.FakeClientWithListAndApply[*v1alpha1.ClusterTrustBundle, *v1alpha1.ClusterTrustBundleList, *certificatesv1alpha1.ClusterTrustBundleApplyConfiguration]
Fake *FakeCertificatesV1alpha1 Fake *FakeCertificatesV1alpha1
} }
var clustertrustbundlesResource = v1alpha1.SchemeGroupVersion.WithResource("clustertrustbundles") func newFakeClusterTrustBundles(fake *FakeCertificatesV1alpha1) typedcertificatesv1alpha1.ClusterTrustBundleInterface {
return &fakeClusterTrustBundles{
var clustertrustbundlesKind = v1alpha1.SchemeGroupVersion.WithKind("ClusterTrustBundle") gentype.NewFakeClientWithListAndApply[*v1alpha1.ClusterTrustBundle, *v1alpha1.ClusterTrustBundleList, *certificatesv1alpha1.ClusterTrustBundleApplyConfiguration](
fake.Fake,
// Get takes name of the clusterTrustBundle, and returns the corresponding clusterTrustBundle object, and an error if there is any. "",
func (c *FakeClusterTrustBundles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterTrustBundle, err error) { v1alpha1.SchemeGroupVersion.WithResource("clustertrustbundles"),
emptyResult := &v1alpha1.ClusterTrustBundle{} v1alpha1.SchemeGroupVersion.WithKind("ClusterTrustBundle"),
obj, err := c.Fake. func() *v1alpha1.ClusterTrustBundle { return &v1alpha1.ClusterTrustBundle{} },
Invokes(testing.NewRootGetActionWithOptions(clustertrustbundlesResource, name, options), emptyResult) func() *v1alpha1.ClusterTrustBundleList { return &v1alpha1.ClusterTrustBundleList{} },
if obj == nil { func(dst, src *v1alpha1.ClusterTrustBundleList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1alpha1.ClusterTrustBundleList) []*v1alpha1.ClusterTrustBundle {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1alpha1.ClusterTrustBundleList, items []*v1alpha1.ClusterTrustBundle) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1alpha1.ClusterTrustBundle), err
}
// List takes label and field selectors, and returns the list of ClusterTrustBundles that match those selectors.
func (c *FakeClusterTrustBundles) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterTrustBundleList, err error) {
emptyResult := &v1alpha1.ClusterTrustBundleList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(clustertrustbundlesResource, clustertrustbundlesKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ClusterTrustBundleList{ListMeta: obj.(*v1alpha1.ClusterTrustBundleList).ListMeta}
for _, item := range obj.(*v1alpha1.ClusterTrustBundleList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested clusterTrustBundles.
func (c *FakeClusterTrustBundles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(clustertrustbundlesResource, opts))
}
// Create takes the representation of a clusterTrustBundle and creates it. Returns the server's representation of the clusterTrustBundle, and an error, if there is any.
func (c *FakeClusterTrustBundles) Create(ctx context.Context, clusterTrustBundle *v1alpha1.ClusterTrustBundle, opts v1.CreateOptions) (result *v1alpha1.ClusterTrustBundle, err error) {
emptyResult := &v1alpha1.ClusterTrustBundle{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(clustertrustbundlesResource, clusterTrustBundle, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ClusterTrustBundle), err
}
// Update takes the representation of a clusterTrustBundle and updates it. Returns the server's representation of the clusterTrustBundle, and an error, if there is any.
func (c *FakeClusterTrustBundles) Update(ctx context.Context, clusterTrustBundle *v1alpha1.ClusterTrustBundle, opts v1.UpdateOptions) (result *v1alpha1.ClusterTrustBundle, err error) {
emptyResult := &v1alpha1.ClusterTrustBundle{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(clustertrustbundlesResource, clusterTrustBundle, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ClusterTrustBundle), err
}
// Delete takes name of the clusterTrustBundle and deletes it. Returns an error if one occurs.
func (c *FakeClusterTrustBundles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(clustertrustbundlesResource, name, opts), &v1alpha1.ClusterTrustBundle{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeClusterTrustBundles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(clustertrustbundlesResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterTrustBundleList{})
return err
}
// Patch applies the patch and returns the patched clusterTrustBundle.
func (c *FakeClusterTrustBundles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterTrustBundle, err error) {
emptyResult := &v1alpha1.ClusterTrustBundle{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertrustbundlesResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ClusterTrustBundle), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied clusterTrustBundle.
func (c *FakeClusterTrustBundles) Apply(ctx context.Context, clusterTrustBundle *certificatesv1alpha1.ClusterTrustBundleApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ClusterTrustBundle, err error) {
if clusterTrustBundle == nil {
return nil, fmt.Errorf("clusterTrustBundle provided to Apply must not be nil")
}
data, err := json.Marshal(clusterTrustBundle)
if err != nil {
return nil, err
}
name := clusterTrustBundle.Name
if name == nil {
return nil, fmt.Errorf("clusterTrustBundle.Name must be provided to Apply")
}
emptyResult := &v1alpha1.ClusterTrustBundle{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertrustbundlesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.ClusterTrustBundle), err
} }

View File

@@ -29,7 +29,7 @@ type FakeCertificatesV1beta1 struct {
} }
func (c *FakeCertificatesV1beta1) CertificateSigningRequests() v1beta1.CertificateSigningRequestInterface { func (c *FakeCertificatesV1beta1) CertificateSigningRequests() v1beta1.CertificateSigningRequestInterface {
return &FakeCertificateSigningRequests{c} return newFakeCertificateSigningRequests(c)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,168 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta1 "k8s.io/api/certificates/v1beta1" v1beta1 "k8s.io/api/certificates/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
certificatesv1beta1 "k8s.io/client-go/applyconfigurations/certificates/v1beta1" certificatesv1beta1 "k8s.io/client-go/applyconfigurations/certificates/v1beta1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcertificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1"
) )
// FakeCertificateSigningRequests implements CertificateSigningRequestInterface // fakeCertificateSigningRequests implements CertificateSigningRequestInterface
type FakeCertificateSigningRequests struct { type fakeCertificateSigningRequests struct {
*gentype.FakeClientWithListAndApply[*v1beta1.CertificateSigningRequest, *v1beta1.CertificateSigningRequestList, *certificatesv1beta1.CertificateSigningRequestApplyConfiguration]
Fake *FakeCertificatesV1beta1 Fake *FakeCertificatesV1beta1
} }
var certificatesigningrequestsResource = v1beta1.SchemeGroupVersion.WithResource("certificatesigningrequests") func newFakeCertificateSigningRequests(fake *FakeCertificatesV1beta1) typedcertificatesv1beta1.CertificateSigningRequestInterface {
return &fakeCertificateSigningRequests{
var certificatesigningrequestsKind = v1beta1.SchemeGroupVersion.WithKind("CertificateSigningRequest") gentype.NewFakeClientWithListAndApply[*v1beta1.CertificateSigningRequest, *v1beta1.CertificateSigningRequestList, *certificatesv1beta1.CertificateSigningRequestApplyConfiguration](
fake.Fake,
// Get takes name of the certificateSigningRequest, and returns the corresponding certificateSigningRequest object, and an error if there is any. "",
func (c *FakeCertificateSigningRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.CertificateSigningRequest, err error) { v1beta1.SchemeGroupVersion.WithResource("certificatesigningrequests"),
emptyResult := &v1beta1.CertificateSigningRequest{} v1beta1.SchemeGroupVersion.WithKind("CertificateSigningRequest"),
obj, err := c.Fake. func() *v1beta1.CertificateSigningRequest { return &v1beta1.CertificateSigningRequest{} },
Invokes(testing.NewRootGetActionWithOptions(certificatesigningrequestsResource, name, options), emptyResult) func() *v1beta1.CertificateSigningRequestList { return &v1beta1.CertificateSigningRequestList{} },
if obj == nil { func(dst, src *v1beta1.CertificateSigningRequestList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1beta1.CertificateSigningRequestList) []*v1beta1.CertificateSigningRequest {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1beta1.CertificateSigningRequestList, items []*v1beta1.CertificateSigningRequest) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1beta1.CertificateSigningRequest), err
}
// List takes label and field selectors, and returns the list of CertificateSigningRequests that match those selectors.
func (c *FakeCertificateSigningRequests) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.CertificateSigningRequestList, err error) {
emptyResult := &v1beta1.CertificateSigningRequestList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(certificatesigningrequestsResource, certificatesigningrequestsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.CertificateSigningRequestList{ListMeta: obj.(*v1beta1.CertificateSigningRequestList).ListMeta}
for _, item := range obj.(*v1beta1.CertificateSigningRequestList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested certificateSigningRequests.
func (c *FakeCertificateSigningRequests) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(certificatesigningrequestsResource, opts))
}
// Create takes the representation of a certificateSigningRequest and creates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any.
func (c *FakeCertificateSigningRequests) Create(ctx context.Context, certificateSigningRequest *v1beta1.CertificateSigningRequest, opts v1.CreateOptions) (result *v1beta1.CertificateSigningRequest, err error) {
emptyResult := &v1beta1.CertificateSigningRequest{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(certificatesigningrequestsResource, certificateSigningRequest, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CertificateSigningRequest), err
}
// Update takes the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any.
func (c *FakeCertificateSigningRequests) Update(ctx context.Context, certificateSigningRequest *v1beta1.CertificateSigningRequest, opts v1.UpdateOptions) (result *v1beta1.CertificateSigningRequest, err error) {
emptyResult := &v1beta1.CertificateSigningRequest{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(certificatesigningrequestsResource, certificateSigningRequest, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CertificateSigningRequest), 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 *FakeCertificateSigningRequests) UpdateStatus(ctx context.Context, certificateSigningRequest *v1beta1.CertificateSigningRequest, opts v1.UpdateOptions) (result *v1beta1.CertificateSigningRequest, err error) {
emptyResult := &v1beta1.CertificateSigningRequest{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(certificatesigningrequestsResource, "status", certificateSigningRequest, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CertificateSigningRequest), err
}
// Delete takes name of the certificateSigningRequest and deletes it. Returns an error if one occurs.
func (c *FakeCertificateSigningRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(certificatesigningrequestsResource, name, opts), &v1beta1.CertificateSigningRequest{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeCertificateSigningRequests) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(certificatesigningrequestsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.CertificateSigningRequestList{})
return err
}
// Patch applies the patch and returns the patched certificateSigningRequest.
func (c *FakeCertificateSigningRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.CertificateSigningRequest, err error) {
emptyResult := &v1beta1.CertificateSigningRequest{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(certificatesigningrequestsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CertificateSigningRequest), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied certificateSigningRequest.
func (c *FakeCertificateSigningRequests) Apply(ctx context.Context, certificateSigningRequest *certificatesv1beta1.CertificateSigningRequestApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.CertificateSigningRequest, err error) {
if certificateSigningRequest == nil {
return nil, fmt.Errorf("certificateSigningRequest provided to Apply must not be nil")
}
data, err := json.Marshal(certificateSigningRequest)
if err != nil {
return nil, err
}
name := certificateSigningRequest.Name
if name == nil {
return nil, fmt.Errorf("certificateSigningRequest.Name must be provided to Apply")
}
emptyResult := &v1beta1.CertificateSigningRequest{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(certificatesigningrequestsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CertificateSigningRequest), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeCertificateSigningRequests) ApplyStatus(ctx context.Context, certificateSigningRequest *certificatesv1beta1.CertificateSigningRequestApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.CertificateSigningRequest, err error) {
if certificateSigningRequest == nil {
return nil, fmt.Errorf("certificateSigningRequest provided to Apply must not be nil")
}
data, err := json.Marshal(certificateSigningRequest)
if err != nil {
return nil, err
}
name := certificateSigningRequest.Name
if name == nil {
return nil, fmt.Errorf("certificateSigningRequest.Name must be provided to Apply")
}
emptyResult := &v1beta1.CertificateSigningRequest{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(certificatesigningrequestsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.CertificateSigningRequest), err
} }

View File

@@ -29,7 +29,7 @@ type FakeCoordinationV1 struct {
} }
func (c *FakeCoordinationV1) Leases(namespace string) v1.LeaseInterface { func (c *FakeCoordinationV1) Leases(namespace string) v1.LeaseInterface {
return &FakeLeases{c, namespace} return newFakeLeases(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,142 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/coordination/v1" v1 "k8s.io/api/coordination/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
coordinationv1 "k8s.io/client-go/applyconfigurations/coordination/v1" coordinationv1 "k8s.io/client-go/applyconfigurations/coordination/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcoordinationv1 "k8s.io/client-go/kubernetes/typed/coordination/v1"
) )
// FakeLeases implements LeaseInterface // fakeLeases implements LeaseInterface
type FakeLeases struct { type fakeLeases struct {
*gentype.FakeClientWithListAndApply[*v1.Lease, *v1.LeaseList, *coordinationv1.LeaseApplyConfiguration]
Fake *FakeCoordinationV1 Fake *FakeCoordinationV1
ns string
} }
var leasesResource = v1.SchemeGroupVersion.WithResource("leases") func newFakeLeases(fake *FakeCoordinationV1, namespace string) typedcoordinationv1.LeaseInterface {
return &fakeLeases{
var leasesKind = v1.SchemeGroupVersion.WithKind("Lease") gentype.NewFakeClientWithListAndApply[*v1.Lease, *v1.LeaseList, *coordinationv1.LeaseApplyConfiguration](
fake.Fake,
// Get takes name of the lease, and returns the corresponding lease object, and an error if there is any. namespace,
func (c *FakeLeases) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Lease, err error) { v1.SchemeGroupVersion.WithResource("leases"),
emptyResult := &v1.Lease{} v1.SchemeGroupVersion.WithKind("Lease"),
obj, err := c.Fake. func() *v1.Lease { return &v1.Lease{} },
Invokes(testing.NewGetActionWithOptions(leasesResource, c.ns, name, options), emptyResult) func() *v1.LeaseList { return &v1.LeaseList{} },
func(dst, src *v1.LeaseList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.LeaseList) []*v1.Lease { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.LeaseList, items []*v1.Lease) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.Lease), err
}
// List takes label and field selectors, and returns the list of Leases that match those selectors.
func (c *FakeLeases) List(ctx context.Context, opts metav1.ListOptions) (result *v1.LeaseList, err error) {
emptyResult := &v1.LeaseList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(leasesResource, leasesKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.LeaseList{ListMeta: obj.(*v1.LeaseList).ListMeta}
for _, item := range obj.(*v1.LeaseList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested leases.
func (c *FakeLeases) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(leasesResource, c.ns, opts))
}
// Create takes the representation of a lease and creates it. Returns the server's representation of the lease, and an error, if there is any.
func (c *FakeLeases) Create(ctx context.Context, lease *v1.Lease, opts metav1.CreateOptions) (result *v1.Lease, err error) {
emptyResult := &v1.Lease{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(leasesResource, c.ns, lease, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Lease), err
}
// Update takes the representation of a lease and updates it. Returns the server's representation of the lease, and an error, if there is any.
func (c *FakeLeases) Update(ctx context.Context, lease *v1.Lease, opts metav1.UpdateOptions) (result *v1.Lease, err error) {
emptyResult := &v1.Lease{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(leasesResource, c.ns, lease, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Lease), err
}
// Delete takes name of the lease and deletes it. Returns an error if one occurs.
func (c *FakeLeases) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(leasesResource, c.ns, name, opts), &v1.Lease{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeLeases) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(leasesResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.LeaseList{})
return err
}
// Patch applies the patch and returns the patched lease.
func (c *FakeLeases) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Lease, err error) {
emptyResult := &v1.Lease{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(leasesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Lease), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied lease.
func (c *FakeLeases) Apply(ctx context.Context, lease *coordinationv1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Lease, err error) {
if lease == nil {
return nil, fmt.Errorf("lease provided to Apply must not be nil")
}
data, err := json.Marshal(lease)
if err != nil {
return nil, err
}
name := lease.Name
if name == nil {
return nil, fmt.Errorf("lease.Name must be provided to Apply")
}
emptyResult := &v1.Lease{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(leasesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Lease), err
} }

View File

@@ -29,7 +29,7 @@ type FakeCoordinationV1alpha2 struct {
} }
func (c *FakeCoordinationV1alpha2) LeaseCandidates(namespace string) v1alpha2.LeaseCandidateInterface { func (c *FakeCoordinationV1alpha2) LeaseCandidates(namespace string) v1alpha2.LeaseCandidateInterface {
return &FakeLeaseCandidates{c, namespace} return newFakeLeaseCandidates(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,142 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1alpha2 "k8s.io/api/coordination/v1alpha2" v1alpha2 "k8s.io/api/coordination/v1alpha2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
coordinationv1alpha2 "k8s.io/client-go/applyconfigurations/coordination/v1alpha2" coordinationv1alpha2 "k8s.io/client-go/applyconfigurations/coordination/v1alpha2"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcoordinationv1alpha2 "k8s.io/client-go/kubernetes/typed/coordination/v1alpha2"
) )
// FakeLeaseCandidates implements LeaseCandidateInterface // fakeLeaseCandidates implements LeaseCandidateInterface
type FakeLeaseCandidates struct { type fakeLeaseCandidates struct {
*gentype.FakeClientWithListAndApply[*v1alpha2.LeaseCandidate, *v1alpha2.LeaseCandidateList, *coordinationv1alpha2.LeaseCandidateApplyConfiguration]
Fake *FakeCoordinationV1alpha2 Fake *FakeCoordinationV1alpha2
ns string
} }
var leasecandidatesResource = v1alpha2.SchemeGroupVersion.WithResource("leasecandidates") func newFakeLeaseCandidates(fake *FakeCoordinationV1alpha2, namespace string) typedcoordinationv1alpha2.LeaseCandidateInterface {
return &fakeLeaseCandidates{
var leasecandidatesKind = v1alpha2.SchemeGroupVersion.WithKind("LeaseCandidate") gentype.NewFakeClientWithListAndApply[*v1alpha2.LeaseCandidate, *v1alpha2.LeaseCandidateList, *coordinationv1alpha2.LeaseCandidateApplyConfiguration](
fake.Fake,
// Get takes name of the leaseCandidate, and returns the corresponding leaseCandidate object, and an error if there is any. namespace,
func (c *FakeLeaseCandidates) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.LeaseCandidate, err error) { v1alpha2.SchemeGroupVersion.WithResource("leasecandidates"),
emptyResult := &v1alpha2.LeaseCandidate{} v1alpha2.SchemeGroupVersion.WithKind("LeaseCandidate"),
obj, err := c.Fake. func() *v1alpha2.LeaseCandidate { return &v1alpha2.LeaseCandidate{} },
Invokes(testing.NewGetActionWithOptions(leasecandidatesResource, c.ns, name, options), emptyResult) func() *v1alpha2.LeaseCandidateList { return &v1alpha2.LeaseCandidateList{} },
func(dst, src *v1alpha2.LeaseCandidateList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1alpha2.LeaseCandidateList) []*v1alpha2.LeaseCandidate {
return emptyResult, err return gentype.ToPointerSlice(list.Items)
},
func(list *v1alpha2.LeaseCandidateList, items []*v1alpha2.LeaseCandidate) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1alpha2.LeaseCandidate), err
}
// List takes label and field selectors, and returns the list of LeaseCandidates that match those selectors.
func (c *FakeLeaseCandidates) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.LeaseCandidateList, err error) {
emptyResult := &v1alpha2.LeaseCandidateList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(leasecandidatesResource, leasecandidatesKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha2.LeaseCandidateList{ListMeta: obj.(*v1alpha2.LeaseCandidateList).ListMeta}
for _, item := range obj.(*v1alpha2.LeaseCandidateList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested leaseCandidates.
func (c *FakeLeaseCandidates) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(leasecandidatesResource, c.ns, opts))
}
// Create takes the representation of a leaseCandidate and creates it. Returns the server's representation of the leaseCandidate, and an error, if there is any.
func (c *FakeLeaseCandidates) Create(ctx context.Context, leaseCandidate *v1alpha2.LeaseCandidate, opts v1.CreateOptions) (result *v1alpha2.LeaseCandidate, err error) {
emptyResult := &v1alpha2.LeaseCandidate{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(leasecandidatesResource, c.ns, leaseCandidate, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha2.LeaseCandidate), err
}
// Update takes the representation of a leaseCandidate and updates it. Returns the server's representation of the leaseCandidate, and an error, if there is any.
func (c *FakeLeaseCandidates) Update(ctx context.Context, leaseCandidate *v1alpha2.LeaseCandidate, opts v1.UpdateOptions) (result *v1alpha2.LeaseCandidate, err error) {
emptyResult := &v1alpha2.LeaseCandidate{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(leasecandidatesResource, c.ns, leaseCandidate, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha2.LeaseCandidate), err
}
// Delete takes name of the leaseCandidate and deletes it. Returns an error if one occurs.
func (c *FakeLeaseCandidates) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(leasecandidatesResource, c.ns, name, opts), &v1alpha2.LeaseCandidate{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeLeaseCandidates) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(leasecandidatesResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha2.LeaseCandidateList{})
return err
}
// Patch applies the patch and returns the patched leaseCandidate.
func (c *FakeLeaseCandidates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.LeaseCandidate, err error) {
emptyResult := &v1alpha2.LeaseCandidate{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(leasecandidatesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha2.LeaseCandidate), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied leaseCandidate.
func (c *FakeLeaseCandidates) Apply(ctx context.Context, leaseCandidate *coordinationv1alpha2.LeaseCandidateApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.LeaseCandidate, err error) {
if leaseCandidate == nil {
return nil, fmt.Errorf("leaseCandidate provided to Apply must not be nil")
}
data, err := json.Marshal(leaseCandidate)
if err != nil {
return nil, err
}
name := leaseCandidate.Name
if name == nil {
return nil, fmt.Errorf("leaseCandidate.Name must be provided to Apply")
}
emptyResult := &v1alpha2.LeaseCandidate{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(leasecandidatesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha2.LeaseCandidate), err
} }

View File

@@ -29,7 +29,7 @@ type FakeCoordinationV1beta1 struct {
} }
func (c *FakeCoordinationV1beta1) Leases(namespace string) v1beta1.LeaseInterface { func (c *FakeCoordinationV1beta1) Leases(namespace string) v1beta1.LeaseInterface {
return &FakeLeases{c, namespace} return newFakeLeases(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,142 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1beta1 "k8s.io/api/coordination/v1beta1" v1beta1 "k8s.io/api/coordination/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
coordinationv1beta1 "k8s.io/client-go/applyconfigurations/coordination/v1beta1" coordinationv1beta1 "k8s.io/client-go/applyconfigurations/coordination/v1beta1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcoordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1"
) )
// FakeLeases implements LeaseInterface // fakeLeases implements LeaseInterface
type FakeLeases struct { type fakeLeases struct {
*gentype.FakeClientWithListAndApply[*v1beta1.Lease, *v1beta1.LeaseList, *coordinationv1beta1.LeaseApplyConfiguration]
Fake *FakeCoordinationV1beta1 Fake *FakeCoordinationV1beta1
ns string
} }
var leasesResource = v1beta1.SchemeGroupVersion.WithResource("leases") func newFakeLeases(fake *FakeCoordinationV1beta1, namespace string) typedcoordinationv1beta1.LeaseInterface {
return &fakeLeases{
var leasesKind = v1beta1.SchemeGroupVersion.WithKind("Lease") gentype.NewFakeClientWithListAndApply[*v1beta1.Lease, *v1beta1.LeaseList, *coordinationv1beta1.LeaseApplyConfiguration](
fake.Fake,
// Get takes name of the lease, and returns the corresponding lease object, and an error if there is any. namespace,
func (c *FakeLeases) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Lease, err error) { v1beta1.SchemeGroupVersion.WithResource("leases"),
emptyResult := &v1beta1.Lease{} v1beta1.SchemeGroupVersion.WithKind("Lease"),
obj, err := c.Fake. func() *v1beta1.Lease { return &v1beta1.Lease{} },
Invokes(testing.NewGetActionWithOptions(leasesResource, c.ns, name, options), emptyResult) func() *v1beta1.LeaseList { return &v1beta1.LeaseList{} },
func(dst, src *v1beta1.LeaseList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1beta1.LeaseList) []*v1beta1.Lease { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1beta1.LeaseList, items []*v1beta1.Lease) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1beta1.Lease), err
}
// List takes label and field selectors, and returns the list of Leases that match those selectors.
func (c *FakeLeases) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.LeaseList, err error) {
emptyResult := &v1beta1.LeaseList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(leasesResource, leasesKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.LeaseList{ListMeta: obj.(*v1beta1.LeaseList).ListMeta}
for _, item := range obj.(*v1beta1.LeaseList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested leases.
func (c *FakeLeases) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(leasesResource, c.ns, opts))
}
// Create takes the representation of a lease and creates it. Returns the server's representation of the lease, and an error, if there is any.
func (c *FakeLeases) Create(ctx context.Context, lease *v1beta1.Lease, opts v1.CreateOptions) (result *v1beta1.Lease, err error) {
emptyResult := &v1beta1.Lease{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(leasesResource, c.ns, lease, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.Lease), err
}
// Update takes the representation of a lease and updates it. Returns the server's representation of the lease, and an error, if there is any.
func (c *FakeLeases) Update(ctx context.Context, lease *v1beta1.Lease, opts v1.UpdateOptions) (result *v1beta1.Lease, err error) {
emptyResult := &v1beta1.Lease{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(leasesResource, c.ns, lease, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.Lease), err
}
// Delete takes name of the lease and deletes it. Returns an error if one occurs.
func (c *FakeLeases) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(leasesResource, c.ns, name, opts), &v1beta1.Lease{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeLeases) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(leasesResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.LeaseList{})
return err
}
// Patch applies the patch and returns the patched lease.
func (c *FakeLeases) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Lease, err error) {
emptyResult := &v1beta1.Lease{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(leasesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.Lease), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied lease.
func (c *FakeLeases) Apply(ctx context.Context, lease *coordinationv1beta1.LeaseApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Lease, err error) {
if lease == nil {
return nil, fmt.Errorf("lease provided to Apply must not be nil")
}
data, err := json.Marshal(lease)
if err != nil {
return nil, err
}
name := lease.Name
if name == nil {
return nil, fmt.Errorf("lease.Name must be provided to Apply")
}
emptyResult := &v1beta1.Lease{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(leasesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.Lease), err
} }

View File

@@ -19,133 +19,33 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
) )
// FakeComponentStatuses implements ComponentStatusInterface // fakeComponentStatuses implements ComponentStatusInterface
type FakeComponentStatuses struct { type fakeComponentStatuses struct {
*gentype.FakeClientWithListAndApply[*v1.ComponentStatus, *v1.ComponentStatusList, *corev1.ComponentStatusApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
} }
var componentstatusesResource = v1.SchemeGroupVersion.WithResource("componentstatuses") func newFakeComponentStatuses(fake *FakeCoreV1) typedcorev1.ComponentStatusInterface {
return &fakeComponentStatuses{
var componentstatusesKind = v1.SchemeGroupVersion.WithKind("ComponentStatus") gentype.NewFakeClientWithListAndApply[*v1.ComponentStatus, *v1.ComponentStatusList, *corev1.ComponentStatusApplyConfiguration](
fake.Fake,
// Get takes name of the componentStatus, and returns the corresponding componentStatus object, and an error if there is any. "",
func (c *FakeComponentStatuses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ComponentStatus, err error) { v1.SchemeGroupVersion.WithResource("componentstatuses"),
emptyResult := &v1.ComponentStatus{} v1.SchemeGroupVersion.WithKind("ComponentStatus"),
obj, err := c.Fake. func() *v1.ComponentStatus { return &v1.ComponentStatus{} },
Invokes(testing.NewRootGetActionWithOptions(componentstatusesResource, name, options), emptyResult) func() *v1.ComponentStatusList { return &v1.ComponentStatusList{} },
if obj == nil { func(dst, src *v1.ComponentStatusList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1.ComponentStatusList) []*v1.ComponentStatus { return gentype.ToPointerSlice(list.Items) },
func(list *v1.ComponentStatusList, items []*v1.ComponentStatus) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.ComponentStatus), err
}
// List takes label and field selectors, and returns the list of ComponentStatuses that match those selectors.
func (c *FakeComponentStatuses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ComponentStatusList, err error) {
emptyResult := &v1.ComponentStatusList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(componentstatusesResource, componentstatusesKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ComponentStatusList{ListMeta: obj.(*v1.ComponentStatusList).ListMeta}
for _, item := range obj.(*v1.ComponentStatusList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested componentStatuses.
func (c *FakeComponentStatuses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(componentstatusesResource, opts))
}
// Create takes the representation of a componentStatus and creates it. Returns the server's representation of the componentStatus, and an error, if there is any.
func (c *FakeComponentStatuses) Create(ctx context.Context, componentStatus *v1.ComponentStatus, opts metav1.CreateOptions) (result *v1.ComponentStatus, err error) {
emptyResult := &v1.ComponentStatus{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(componentstatusesResource, componentStatus, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ComponentStatus), err
}
// Update takes the representation of a componentStatus and updates it. Returns the server's representation of the componentStatus, and an error, if there is any.
func (c *FakeComponentStatuses) Update(ctx context.Context, componentStatus *v1.ComponentStatus, opts metav1.UpdateOptions) (result *v1.ComponentStatus, err error) {
emptyResult := &v1.ComponentStatus{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(componentstatusesResource, componentStatus, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ComponentStatus), err
}
// Delete takes name of the componentStatus and deletes it. Returns an error if one occurs.
func (c *FakeComponentStatuses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(componentstatusesResource, name, opts), &v1.ComponentStatus{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeComponentStatuses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(componentstatusesResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.ComponentStatusList{})
return err
}
// Patch applies the patch and returns the patched componentStatus.
func (c *FakeComponentStatuses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ComponentStatus, err error) {
emptyResult := &v1.ComponentStatus{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(componentstatusesResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ComponentStatus), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied componentStatus.
func (c *FakeComponentStatuses) Apply(ctx context.Context, componentStatus *corev1.ComponentStatusApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ComponentStatus, err error) {
if componentStatus == nil {
return nil, fmt.Errorf("componentStatus provided to Apply must not be nil")
}
data, err := json.Marshal(componentStatus)
if err != nil {
return nil, err
}
name := componentStatus.Name
if name == nil {
return nil, fmt.Errorf("componentStatus.Name must be provided to Apply")
}
emptyResult := &v1.ComponentStatus{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(componentstatusesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ComponentStatus), err
} }

View File

@@ -19,142 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
) )
// FakeConfigMaps implements ConfigMapInterface // fakeConfigMaps implements ConfigMapInterface
type FakeConfigMaps struct { type fakeConfigMaps struct {
*gentype.FakeClientWithListAndApply[*v1.ConfigMap, *v1.ConfigMapList, *corev1.ConfigMapApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
ns string
} }
var configmapsResource = v1.SchemeGroupVersion.WithResource("configmaps") func newFakeConfigMaps(fake *FakeCoreV1, namespace string) typedcorev1.ConfigMapInterface {
return &fakeConfigMaps{
var configmapsKind = v1.SchemeGroupVersion.WithKind("ConfigMap") gentype.NewFakeClientWithListAndApply[*v1.ConfigMap, *v1.ConfigMapList, *corev1.ConfigMapApplyConfiguration](
fake.Fake,
// Get takes name of the configMap, and returns the corresponding configMap object, and an error if there is any. namespace,
func (c *FakeConfigMaps) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ConfigMap, err error) { v1.SchemeGroupVersion.WithResource("configmaps"),
emptyResult := &v1.ConfigMap{} v1.SchemeGroupVersion.WithKind("ConfigMap"),
obj, err := c.Fake. func() *v1.ConfigMap { return &v1.ConfigMap{} },
Invokes(testing.NewGetActionWithOptions(configmapsResource, c.ns, name, options), emptyResult) func() *v1.ConfigMapList { return &v1.ConfigMapList{} },
func(dst, src *v1.ConfigMapList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.ConfigMapList) []*v1.ConfigMap { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.ConfigMapList, items []*v1.ConfigMap) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.ConfigMap), err
}
// List takes label and field selectors, and returns the list of ConfigMaps that match those selectors.
func (c *FakeConfigMaps) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ConfigMapList, err error) {
emptyResult := &v1.ConfigMapList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(configmapsResource, configmapsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ConfigMapList{ListMeta: obj.(*v1.ConfigMapList).ListMeta}
for _, item := range obj.(*v1.ConfigMapList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested configMaps.
func (c *FakeConfigMaps) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(configmapsResource, c.ns, opts))
}
// Create takes the representation of a configMap and creates it. Returns the server's representation of the configMap, and an error, if there is any.
func (c *FakeConfigMaps) Create(ctx context.Context, configMap *v1.ConfigMap, opts metav1.CreateOptions) (result *v1.ConfigMap, err error) {
emptyResult := &v1.ConfigMap{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(configmapsResource, c.ns, configMap, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ConfigMap), err
}
// Update takes the representation of a configMap and updates it. Returns the server's representation of the configMap, and an error, if there is any.
func (c *FakeConfigMaps) Update(ctx context.Context, configMap *v1.ConfigMap, opts metav1.UpdateOptions) (result *v1.ConfigMap, err error) {
emptyResult := &v1.ConfigMap{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(configmapsResource, c.ns, configMap, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ConfigMap), err
}
// Delete takes name of the configMap and deletes it. Returns an error if one occurs.
func (c *FakeConfigMaps) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(configmapsResource, c.ns, name, opts), &v1.ConfigMap{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeConfigMaps) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(configmapsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.ConfigMapList{})
return err
}
// Patch applies the patch and returns the patched configMap.
func (c *FakeConfigMaps) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ConfigMap, err error) {
emptyResult := &v1.ConfigMap{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(configmapsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ConfigMap), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied configMap.
func (c *FakeConfigMaps) Apply(ctx context.Context, configMap *corev1.ConfigMapApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ConfigMap, err error) {
if configMap == nil {
return nil, fmt.Errorf("configMap provided to Apply must not be nil")
}
data, err := json.Marshal(configMap)
if err != nil {
return nil, err
}
name := configMap.Name
if name == nil {
return nil, fmt.Errorf("configMap.Name must be provided to Apply")
}
emptyResult := &v1.ConfigMap{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(configmapsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ConfigMap), err
} }

View File

@@ -29,67 +29,67 @@ type FakeCoreV1 struct {
} }
func (c *FakeCoreV1) ComponentStatuses() v1.ComponentStatusInterface { func (c *FakeCoreV1) ComponentStatuses() v1.ComponentStatusInterface {
return &FakeComponentStatuses{c} return newFakeComponentStatuses(c)
} }
func (c *FakeCoreV1) ConfigMaps(namespace string) v1.ConfigMapInterface { func (c *FakeCoreV1) ConfigMaps(namespace string) v1.ConfigMapInterface {
return &FakeConfigMaps{c, namespace} return newFakeConfigMaps(c, namespace)
} }
func (c *FakeCoreV1) Endpoints(namespace string) v1.EndpointsInterface { func (c *FakeCoreV1) Endpoints(namespace string) v1.EndpointsInterface {
return &FakeEndpoints{c, namespace} return newFakeEndpoints(c, namespace)
} }
func (c *FakeCoreV1) Events(namespace string) v1.EventInterface { func (c *FakeCoreV1) Events(namespace string) v1.EventInterface {
return &FakeEvents{c, namespace} return newFakeEvents(c, namespace)
} }
func (c *FakeCoreV1) LimitRanges(namespace string) v1.LimitRangeInterface { func (c *FakeCoreV1) LimitRanges(namespace string) v1.LimitRangeInterface {
return &FakeLimitRanges{c, namespace} return newFakeLimitRanges(c, namespace)
} }
func (c *FakeCoreV1) Namespaces() v1.NamespaceInterface { func (c *FakeCoreV1) Namespaces() v1.NamespaceInterface {
return &FakeNamespaces{c} return newFakeNamespaces(c)
} }
func (c *FakeCoreV1) Nodes() v1.NodeInterface { func (c *FakeCoreV1) Nodes() v1.NodeInterface {
return &FakeNodes{c} return newFakeNodes(c)
} }
func (c *FakeCoreV1) PersistentVolumes() v1.PersistentVolumeInterface { func (c *FakeCoreV1) PersistentVolumes() v1.PersistentVolumeInterface {
return &FakePersistentVolumes{c} return newFakePersistentVolumes(c)
} }
func (c *FakeCoreV1) PersistentVolumeClaims(namespace string) v1.PersistentVolumeClaimInterface { func (c *FakeCoreV1) PersistentVolumeClaims(namespace string) v1.PersistentVolumeClaimInterface {
return &FakePersistentVolumeClaims{c, namespace} return newFakePersistentVolumeClaims(c, namespace)
} }
func (c *FakeCoreV1) Pods(namespace string) v1.PodInterface { func (c *FakeCoreV1) Pods(namespace string) v1.PodInterface {
return &FakePods{c, namespace} return newFakePods(c, namespace)
} }
func (c *FakeCoreV1) PodTemplates(namespace string) v1.PodTemplateInterface { func (c *FakeCoreV1) PodTemplates(namespace string) v1.PodTemplateInterface {
return &FakePodTemplates{c, namespace} return newFakePodTemplates(c, namespace)
} }
func (c *FakeCoreV1) ReplicationControllers(namespace string) v1.ReplicationControllerInterface { func (c *FakeCoreV1) ReplicationControllers(namespace string) v1.ReplicationControllerInterface {
return &FakeReplicationControllers{c, namespace} return newFakeReplicationControllers(c, namespace)
} }
func (c *FakeCoreV1) ResourceQuotas(namespace string) v1.ResourceQuotaInterface { func (c *FakeCoreV1) ResourceQuotas(namespace string) v1.ResourceQuotaInterface {
return &FakeResourceQuotas{c, namespace} return newFakeResourceQuotas(c, namespace)
} }
func (c *FakeCoreV1) Secrets(namespace string) v1.SecretInterface { func (c *FakeCoreV1) Secrets(namespace string) v1.SecretInterface {
return &FakeSecrets{c, namespace} return newFakeSecrets(c, namespace)
} }
func (c *FakeCoreV1) Services(namespace string) v1.ServiceInterface { func (c *FakeCoreV1) Services(namespace string) v1.ServiceInterface {
return &FakeServices{c, namespace} return newFakeServices(c, namespace)
} }
func (c *FakeCoreV1) ServiceAccounts(namespace string) v1.ServiceAccountInterface { func (c *FakeCoreV1) ServiceAccounts(namespace string) v1.ServiceAccountInterface {
return &FakeServiceAccounts{c, namespace} return newFakeServiceAccounts(c, namespace)
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@@ -19,142 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
) )
// FakeEndpoints implements EndpointsInterface // fakeEndpoints implements EndpointsInterface
type FakeEndpoints struct { type fakeEndpoints struct {
*gentype.FakeClientWithListAndApply[*v1.Endpoints, *v1.EndpointsList, *corev1.EndpointsApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
ns string
} }
var endpointsResource = v1.SchemeGroupVersion.WithResource("endpoints") func newFakeEndpoints(fake *FakeCoreV1, namespace string) typedcorev1.EndpointsInterface {
return &fakeEndpoints{
var endpointsKind = v1.SchemeGroupVersion.WithKind("Endpoints") gentype.NewFakeClientWithListAndApply[*v1.Endpoints, *v1.EndpointsList, *corev1.EndpointsApplyConfiguration](
fake.Fake,
// Get takes name of the endpoints, and returns the corresponding endpoints object, and an error if there is any. namespace,
func (c *FakeEndpoints) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Endpoints, err error) { v1.SchemeGroupVersion.WithResource("endpoints"),
emptyResult := &v1.Endpoints{} v1.SchemeGroupVersion.WithKind("Endpoints"),
obj, err := c.Fake. func() *v1.Endpoints { return &v1.Endpoints{} },
Invokes(testing.NewGetActionWithOptions(endpointsResource, c.ns, name, options), emptyResult) func() *v1.EndpointsList { return &v1.EndpointsList{} },
func(dst, src *v1.EndpointsList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.EndpointsList) []*v1.Endpoints { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.EndpointsList, items []*v1.Endpoints) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.Endpoints), err
}
// List takes label and field selectors, and returns the list of Endpoints that match those selectors.
func (c *FakeEndpoints) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EndpointsList, err error) {
emptyResult := &v1.EndpointsList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(endpointsResource, endpointsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.EndpointsList{ListMeta: obj.(*v1.EndpointsList).ListMeta}
for _, item := range obj.(*v1.EndpointsList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested endpoints.
func (c *FakeEndpoints) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(endpointsResource, c.ns, opts))
}
// Create takes the representation of a endpoints and creates it. Returns the server's representation of the endpoints, and an error, if there is any.
func (c *FakeEndpoints) Create(ctx context.Context, endpoints *v1.Endpoints, opts metav1.CreateOptions) (result *v1.Endpoints, err error) {
emptyResult := &v1.Endpoints{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(endpointsResource, c.ns, endpoints, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Endpoints), err
}
// Update takes the representation of a endpoints and updates it. Returns the server's representation of the endpoints, and an error, if there is any.
func (c *FakeEndpoints) Update(ctx context.Context, endpoints *v1.Endpoints, opts metav1.UpdateOptions) (result *v1.Endpoints, err error) {
emptyResult := &v1.Endpoints{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(endpointsResource, c.ns, endpoints, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Endpoints), err
}
// Delete takes name of the endpoints and deletes it. Returns an error if one occurs.
func (c *FakeEndpoints) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(endpointsResource, c.ns, name, opts), &v1.Endpoints{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeEndpoints) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(endpointsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.EndpointsList{})
return err
}
// Patch applies the patch and returns the patched endpoints.
func (c *FakeEndpoints) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Endpoints, err error) {
emptyResult := &v1.Endpoints{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(endpointsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Endpoints), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied endpoints.
func (c *FakeEndpoints) Apply(ctx context.Context, endpoints *corev1.EndpointsApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Endpoints, err error) {
if endpoints == nil {
return nil, fmt.Errorf("endpoints provided to Apply must not be nil")
}
data, err := json.Marshal(endpoints)
if err != nil {
return nil, err
}
name := endpoints.Name
if name == nil {
return nil, fmt.Errorf("endpoints.Name must be provided to Apply")
}
emptyResult := &v1.Endpoints{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(endpointsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Endpoints), err
} }

View File

@@ -19,142 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
) )
// FakeEvents implements EventInterface // fakeEvents implements EventInterface
type FakeEvents struct { type fakeEvents struct {
*gentype.FakeClientWithListAndApply[*v1.Event, *v1.EventList, *corev1.EventApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
ns string
} }
var eventsResource = v1.SchemeGroupVersion.WithResource("events") func newFakeEvents(fake *FakeCoreV1, namespace string) typedcorev1.EventInterface {
return &fakeEvents{
var eventsKind = v1.SchemeGroupVersion.WithKind("Event") gentype.NewFakeClientWithListAndApply[*v1.Event, *v1.EventList, *corev1.EventApplyConfiguration](
fake.Fake,
// Get takes name of the event, and returns the corresponding event object, and an error if there is any. namespace,
func (c *FakeEvents) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Event, err error) { v1.SchemeGroupVersion.WithResource("events"),
emptyResult := &v1.Event{} v1.SchemeGroupVersion.WithKind("Event"),
obj, err := c.Fake. func() *v1.Event { return &v1.Event{} },
Invokes(testing.NewGetActionWithOptions(eventsResource, c.ns, name, options), emptyResult) func() *v1.EventList { return &v1.EventList{} },
func(dst, src *v1.EventList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.EventList) []*v1.Event { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.EventList, items []*v1.Event) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.Event), err
}
// List takes label and field selectors, and returns the list of Events that match those selectors.
func (c *FakeEvents) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EventList, err error) {
emptyResult := &v1.EventList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(eventsResource, eventsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.EventList{ListMeta: obj.(*v1.EventList).ListMeta}
for _, item := range obj.(*v1.EventList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested events.
func (c *FakeEvents) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(eventsResource, c.ns, opts))
}
// Create takes the representation of a event and creates it. Returns the server's representation of the event, and an error, if there is any.
func (c *FakeEvents) Create(ctx context.Context, event *v1.Event, opts metav1.CreateOptions) (result *v1.Event, err error) {
emptyResult := &v1.Event{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(eventsResource, c.ns, event, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Event), err
}
// Update takes the representation of a event and updates it. Returns the server's representation of the event, and an error, if there is any.
func (c *FakeEvents) Update(ctx context.Context, event *v1.Event, opts metav1.UpdateOptions) (result *v1.Event, err error) {
emptyResult := &v1.Event{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(eventsResource, c.ns, event, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Event), err
}
// Delete takes name of the event and deletes it. Returns an error if one occurs.
func (c *FakeEvents) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(eventsResource, c.ns, name, opts), &v1.Event{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeEvents) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(eventsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.EventList{})
return err
}
// Patch applies the patch and returns the patched event.
func (c *FakeEvents) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Event, err error) {
emptyResult := &v1.Event{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(eventsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Event), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied event.
func (c *FakeEvents) Apply(ctx context.Context, event *corev1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Event, err error) {
if event == nil {
return nil, fmt.Errorf("event provided to Apply must not be nil")
}
data, err := json.Marshal(event)
if err != nil {
return nil, err
}
name := event.Name
if name == nil {
return nil, fmt.Errorf("event.Name must be provided to Apply")
}
emptyResult := &v1.Event{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(eventsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Event), err
} }

View File

@@ -19,142 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
) )
// FakeLimitRanges implements LimitRangeInterface // fakeLimitRanges implements LimitRangeInterface
type FakeLimitRanges struct { type fakeLimitRanges struct {
*gentype.FakeClientWithListAndApply[*v1.LimitRange, *v1.LimitRangeList, *corev1.LimitRangeApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
ns string
} }
var limitrangesResource = v1.SchemeGroupVersion.WithResource("limitranges") func newFakeLimitRanges(fake *FakeCoreV1, namespace string) typedcorev1.LimitRangeInterface {
return &fakeLimitRanges{
var limitrangesKind = v1.SchemeGroupVersion.WithKind("LimitRange") gentype.NewFakeClientWithListAndApply[*v1.LimitRange, *v1.LimitRangeList, *corev1.LimitRangeApplyConfiguration](
fake.Fake,
// Get takes name of the limitRange, and returns the corresponding limitRange object, and an error if there is any. namespace,
func (c *FakeLimitRanges) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.LimitRange, err error) { v1.SchemeGroupVersion.WithResource("limitranges"),
emptyResult := &v1.LimitRange{} v1.SchemeGroupVersion.WithKind("LimitRange"),
obj, err := c.Fake. func() *v1.LimitRange { return &v1.LimitRange{} },
Invokes(testing.NewGetActionWithOptions(limitrangesResource, c.ns, name, options), emptyResult) func() *v1.LimitRangeList { return &v1.LimitRangeList{} },
func(dst, src *v1.LimitRangeList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.LimitRangeList) []*v1.LimitRange { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.LimitRangeList, items []*v1.LimitRange) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.LimitRange), err
}
// List takes label and field selectors, and returns the list of LimitRanges that match those selectors.
func (c *FakeLimitRanges) List(ctx context.Context, opts metav1.ListOptions) (result *v1.LimitRangeList, err error) {
emptyResult := &v1.LimitRangeList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(limitrangesResource, limitrangesKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.LimitRangeList{ListMeta: obj.(*v1.LimitRangeList).ListMeta}
for _, item := range obj.(*v1.LimitRangeList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested limitRanges.
func (c *FakeLimitRanges) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(limitrangesResource, c.ns, opts))
}
// Create takes the representation of a limitRange and creates it. Returns the server's representation of the limitRange, and an error, if there is any.
func (c *FakeLimitRanges) Create(ctx context.Context, limitRange *v1.LimitRange, opts metav1.CreateOptions) (result *v1.LimitRange, err error) {
emptyResult := &v1.LimitRange{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(limitrangesResource, c.ns, limitRange, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.LimitRange), err
}
// Update takes the representation of a limitRange and updates it. Returns the server's representation of the limitRange, and an error, if there is any.
func (c *FakeLimitRanges) Update(ctx context.Context, limitRange *v1.LimitRange, opts metav1.UpdateOptions) (result *v1.LimitRange, err error) {
emptyResult := &v1.LimitRange{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(limitrangesResource, c.ns, limitRange, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.LimitRange), err
}
// Delete takes name of the limitRange and deletes it. Returns an error if one occurs.
func (c *FakeLimitRanges) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(limitrangesResource, c.ns, name, opts), &v1.LimitRange{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeLimitRanges) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(limitrangesResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.LimitRangeList{})
return err
}
// Patch applies the patch and returns the patched limitRange.
func (c *FakeLimitRanges) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.LimitRange, err error) {
emptyResult := &v1.LimitRange{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(limitrangesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.LimitRange), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied limitRange.
func (c *FakeLimitRanges) Apply(ctx context.Context, limitRange *corev1.LimitRangeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.LimitRange, err error) {
if limitRange == nil {
return nil, fmt.Errorf("limitRange provided to Apply must not be nil")
}
data, err := json.Marshal(limitRange)
if err != nil {
return nil, err
}
name := limitRange.Name
if name == nil {
return nil, fmt.Errorf("limitRange.Name must be provided to Apply")
}
emptyResult := &v1.LimitRange{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(limitrangesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.LimitRange), err
} }

View File

@@ -19,160 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
) )
// FakeNamespaces implements NamespaceInterface // fakeNamespaces implements NamespaceInterface
type FakeNamespaces struct { type fakeNamespaces struct {
*gentype.FakeClientWithListAndApply[*v1.Namespace, *v1.NamespaceList, *corev1.NamespaceApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
} }
var namespacesResource = v1.SchemeGroupVersion.WithResource("namespaces") func newFakeNamespaces(fake *FakeCoreV1) typedcorev1.NamespaceInterface {
return &fakeNamespaces{
var namespacesKind = v1.SchemeGroupVersion.WithKind("Namespace") gentype.NewFakeClientWithListAndApply[*v1.Namespace, *v1.NamespaceList, *corev1.NamespaceApplyConfiguration](
fake.Fake,
// Get takes name of the namespace, and returns the corresponding namespace object, and an error if there is any. "",
func (c *FakeNamespaces) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Namespace, err error) { v1.SchemeGroupVersion.WithResource("namespaces"),
emptyResult := &v1.Namespace{} v1.SchemeGroupVersion.WithKind("Namespace"),
obj, err := c.Fake. func() *v1.Namespace { return &v1.Namespace{} },
Invokes(testing.NewRootGetActionWithOptions(namespacesResource, name, options), emptyResult) func() *v1.NamespaceList { return &v1.NamespaceList{} },
if obj == nil { func(dst, src *v1.NamespaceList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1.NamespaceList) []*v1.Namespace { return gentype.ToPointerSlice(list.Items) },
func(list *v1.NamespaceList, items []*v1.Namespace) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.Namespace), err
}
// List takes label and field selectors, and returns the list of Namespaces that match those selectors.
func (c *FakeNamespaces) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NamespaceList, err error) {
emptyResult := &v1.NamespaceList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(namespacesResource, namespacesKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.NamespaceList{ListMeta: obj.(*v1.NamespaceList).ListMeta}
for _, item := range obj.(*v1.NamespaceList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested namespaces.
func (c *FakeNamespaces) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(namespacesResource, opts))
}
// Create takes the representation of a namespace and creates it. Returns the server's representation of the namespace, and an error, if there is any.
func (c *FakeNamespaces) Create(ctx context.Context, namespace *v1.Namespace, opts metav1.CreateOptions) (result *v1.Namespace, err error) {
emptyResult := &v1.Namespace{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(namespacesResource, namespace, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Namespace), err
}
// Update takes the representation of a namespace and updates it. Returns the server's representation of the namespace, and an error, if there is any.
func (c *FakeNamespaces) Update(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (result *v1.Namespace, err error) {
emptyResult := &v1.Namespace{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(namespacesResource, namespace, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Namespace), 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 *FakeNamespaces) UpdateStatus(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (result *v1.Namespace, err error) {
emptyResult := &v1.Namespace{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(namespacesResource, "status", namespace, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Namespace), err
}
// Delete takes name of the namespace and deletes it. Returns an error if one occurs.
func (c *FakeNamespaces) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(namespacesResource, name, opts), &v1.Namespace{})
return err
}
// Patch applies the patch and returns the patched namespace.
func (c *FakeNamespaces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Namespace, err error) {
emptyResult := &v1.Namespace{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(namespacesResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Namespace), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied namespace.
func (c *FakeNamespaces) Apply(ctx context.Context, namespace *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Namespace, err error) {
if namespace == nil {
return nil, fmt.Errorf("namespace provided to Apply must not be nil")
}
data, err := json.Marshal(namespace)
if err != nil {
return nil, err
}
name := namespace.Name
if name == nil {
return nil, fmt.Errorf("namespace.Name must be provided to Apply")
}
emptyResult := &v1.Namespace{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(namespacesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Namespace), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeNamespaces) ApplyStatus(ctx context.Context, namespace *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Namespace, err error) {
if namespace == nil {
return nil, fmt.Errorf("namespace provided to Apply must not be nil")
}
data, err := json.Marshal(namespace)
if err != nil {
return nil, err
}
name := namespace.Name
if name == nil {
return nil, fmt.Errorf("namespace.Name must be provided to Apply")
}
emptyResult := &v1.Namespace{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(namespacesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Namespace), err
} }

View File

@@ -19,168 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
) )
// FakeNodes implements NodeInterface // fakeNodes implements NodeInterface
type FakeNodes struct { type fakeNodes struct {
*gentype.FakeClientWithListAndApply[*v1.Node, *v1.NodeList, *corev1.NodeApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
} }
var nodesResource = v1.SchemeGroupVersion.WithResource("nodes") func newFakeNodes(fake *FakeCoreV1) typedcorev1.NodeInterface {
return &fakeNodes{
var nodesKind = v1.SchemeGroupVersion.WithKind("Node") gentype.NewFakeClientWithListAndApply[*v1.Node, *v1.NodeList, *corev1.NodeApplyConfiguration](
fake.Fake,
// Get takes name of the node, and returns the corresponding node object, and an error if there is any. "",
func (c *FakeNodes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Node, err error) { v1.SchemeGroupVersion.WithResource("nodes"),
emptyResult := &v1.Node{} v1.SchemeGroupVersion.WithKind("Node"),
obj, err := c.Fake. func() *v1.Node { return &v1.Node{} },
Invokes(testing.NewRootGetActionWithOptions(nodesResource, name, options), emptyResult) func() *v1.NodeList { return &v1.NodeList{} },
if obj == nil { func(dst, src *v1.NodeList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1.NodeList) []*v1.Node { return gentype.ToPointerSlice(list.Items) },
func(list *v1.NodeList, items []*v1.Node) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.Node), err
}
// List takes label and field selectors, and returns the list of Nodes that match those selectors.
func (c *FakeNodes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NodeList, err error) {
emptyResult := &v1.NodeList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(nodesResource, nodesKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.NodeList{ListMeta: obj.(*v1.NodeList).ListMeta}
for _, item := range obj.(*v1.NodeList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested nodes.
func (c *FakeNodes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(nodesResource, opts))
}
// Create takes the representation of a node and creates it. Returns the server's representation of the node, and an error, if there is any.
func (c *FakeNodes) Create(ctx context.Context, node *v1.Node, opts metav1.CreateOptions) (result *v1.Node, err error) {
emptyResult := &v1.Node{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(nodesResource, node, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Node), err
}
// Update takes the representation of a node and updates it. Returns the server's representation of the node, and an error, if there is any.
func (c *FakeNodes) Update(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (result *v1.Node, err error) {
emptyResult := &v1.Node{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(nodesResource, node, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Node), 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 *FakeNodes) UpdateStatus(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (result *v1.Node, err error) {
emptyResult := &v1.Node{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(nodesResource, "status", node, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Node), err
}
// Delete takes name of the node and deletes it. Returns an error if one occurs.
func (c *FakeNodes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(nodesResource, name, opts), &v1.Node{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeNodes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(nodesResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.NodeList{})
return err
}
// Patch applies the patch and returns the patched node.
func (c *FakeNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Node, err error) {
emptyResult := &v1.Node{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(nodesResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Node), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied node.
func (c *FakeNodes) Apply(ctx context.Context, node *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Node, err error) {
if node == nil {
return nil, fmt.Errorf("node provided to Apply must not be nil")
}
data, err := json.Marshal(node)
if err != nil {
return nil, err
}
name := node.Name
if name == nil {
return nil, fmt.Errorf("node.Name must be provided to Apply")
}
emptyResult := &v1.Node{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(nodesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Node), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeNodes) ApplyStatus(ctx context.Context, node *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Node, err error) {
if node == nil {
return nil, fmt.Errorf("node provided to Apply must not be nil")
}
data, err := json.Marshal(node)
if err != nil {
return nil, err
}
name := node.Name
if name == nil {
return nil, fmt.Errorf("node.Name must be provided to Apply")
}
emptyResult := &v1.Node{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(nodesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Node), err
} }

View File

@@ -19,168 +19,33 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
) )
// FakePersistentVolumes implements PersistentVolumeInterface // fakePersistentVolumes implements PersistentVolumeInterface
type FakePersistentVolumes struct { type fakePersistentVolumes struct {
*gentype.FakeClientWithListAndApply[*v1.PersistentVolume, *v1.PersistentVolumeList, *corev1.PersistentVolumeApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
} }
var persistentvolumesResource = v1.SchemeGroupVersion.WithResource("persistentvolumes") func newFakePersistentVolumes(fake *FakeCoreV1) typedcorev1.PersistentVolumeInterface {
return &fakePersistentVolumes{
var persistentvolumesKind = v1.SchemeGroupVersion.WithKind("PersistentVolume") gentype.NewFakeClientWithListAndApply[*v1.PersistentVolume, *v1.PersistentVolumeList, *corev1.PersistentVolumeApplyConfiguration](
fake.Fake,
// Get takes name of the persistentVolume, and returns the corresponding persistentVolume object, and an error if there is any. "",
func (c *FakePersistentVolumes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PersistentVolume, err error) { v1.SchemeGroupVersion.WithResource("persistentvolumes"),
emptyResult := &v1.PersistentVolume{} v1.SchemeGroupVersion.WithKind("PersistentVolume"),
obj, err := c.Fake. func() *v1.PersistentVolume { return &v1.PersistentVolume{} },
Invokes(testing.NewRootGetActionWithOptions(persistentvolumesResource, name, options), emptyResult) func() *v1.PersistentVolumeList { return &v1.PersistentVolumeList{} },
if obj == nil { func(dst, src *v1.PersistentVolumeList) { dst.ListMeta = src.ListMeta },
return emptyResult, err func(list *v1.PersistentVolumeList) []*v1.PersistentVolume { return gentype.ToPointerSlice(list.Items) },
func(list *v1.PersistentVolumeList, items []*v1.PersistentVolume) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.PersistentVolume), err
}
// List takes label and field selectors, and returns the list of PersistentVolumes that match those selectors.
func (c *FakePersistentVolumes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PersistentVolumeList, err error) {
emptyResult := &v1.PersistentVolumeList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(persistentvolumesResource, persistentvolumesKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.PersistentVolumeList{ListMeta: obj.(*v1.PersistentVolumeList).ListMeta}
for _, item := range obj.(*v1.PersistentVolumeList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested persistentVolumes.
func (c *FakePersistentVolumes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(persistentvolumesResource, opts))
}
// Create takes the representation of a persistentVolume and creates it. Returns the server's representation of the persistentVolume, and an error, if there is any.
func (c *FakePersistentVolumes) Create(ctx context.Context, persistentVolume *v1.PersistentVolume, opts metav1.CreateOptions) (result *v1.PersistentVolume, err error) {
emptyResult := &v1.PersistentVolume{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(persistentvolumesResource, persistentVolume, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PersistentVolume), err
}
// Update takes the representation of a persistentVolume and updates it. Returns the server's representation of the persistentVolume, and an error, if there is any.
func (c *FakePersistentVolumes) Update(ctx context.Context, persistentVolume *v1.PersistentVolume, opts metav1.UpdateOptions) (result *v1.PersistentVolume, err error) {
emptyResult := &v1.PersistentVolume{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(persistentvolumesResource, persistentVolume, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PersistentVolume), 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 *FakePersistentVolumes) UpdateStatus(ctx context.Context, persistentVolume *v1.PersistentVolume, opts metav1.UpdateOptions) (result *v1.PersistentVolume, err error) {
emptyResult := &v1.PersistentVolume{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(persistentvolumesResource, "status", persistentVolume, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PersistentVolume), err
}
// Delete takes name of the persistentVolume and deletes it. Returns an error if one occurs.
func (c *FakePersistentVolumes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(persistentvolumesResource, name, opts), &v1.PersistentVolume{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakePersistentVolumes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(persistentvolumesResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.PersistentVolumeList{})
return err
}
// Patch applies the patch and returns the patched persistentVolume.
func (c *FakePersistentVolumes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PersistentVolume, err error) {
emptyResult := &v1.PersistentVolume{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(persistentvolumesResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PersistentVolume), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied persistentVolume.
func (c *FakePersistentVolumes) Apply(ctx context.Context, persistentVolume *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolume, err error) {
if persistentVolume == nil {
return nil, fmt.Errorf("persistentVolume provided to Apply must not be nil")
}
data, err := json.Marshal(persistentVolume)
if err != nil {
return nil, err
}
name := persistentVolume.Name
if name == nil {
return nil, fmt.Errorf("persistentVolume.Name must be provided to Apply")
}
emptyResult := &v1.PersistentVolume{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(persistentvolumesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PersistentVolume), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakePersistentVolumes) ApplyStatus(ctx context.Context, persistentVolume *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolume, err error) {
if persistentVolume == nil {
return nil, fmt.Errorf("persistentVolume provided to Apply must not be nil")
}
data, err := json.Marshal(persistentVolume)
if err != nil {
return nil, err
}
name := persistentVolume.Name
if name == nil {
return nil, fmt.Errorf("persistentVolume.Name must be provided to Apply")
}
emptyResult := &v1.PersistentVolume{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(persistentvolumesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PersistentVolume), err
} }

View File

@@ -19,179 +19,35 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
) )
// FakePersistentVolumeClaims implements PersistentVolumeClaimInterface // fakePersistentVolumeClaims implements PersistentVolumeClaimInterface
type FakePersistentVolumeClaims struct { type fakePersistentVolumeClaims struct {
*gentype.FakeClientWithListAndApply[*v1.PersistentVolumeClaim, *v1.PersistentVolumeClaimList, *corev1.PersistentVolumeClaimApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
ns string
} }
var persistentvolumeclaimsResource = v1.SchemeGroupVersion.WithResource("persistentvolumeclaims") func newFakePersistentVolumeClaims(fake *FakeCoreV1, namespace string) typedcorev1.PersistentVolumeClaimInterface {
return &fakePersistentVolumeClaims{
var persistentvolumeclaimsKind = v1.SchemeGroupVersion.WithKind("PersistentVolumeClaim") gentype.NewFakeClientWithListAndApply[*v1.PersistentVolumeClaim, *v1.PersistentVolumeClaimList, *corev1.PersistentVolumeClaimApplyConfiguration](
fake.Fake,
// Get takes name of the persistentVolumeClaim, and returns the corresponding persistentVolumeClaim object, and an error if there is any. namespace,
func (c *FakePersistentVolumeClaims) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PersistentVolumeClaim, err error) { v1.SchemeGroupVersion.WithResource("persistentvolumeclaims"),
emptyResult := &v1.PersistentVolumeClaim{} v1.SchemeGroupVersion.WithKind("PersistentVolumeClaim"),
obj, err := c.Fake. func() *v1.PersistentVolumeClaim { return &v1.PersistentVolumeClaim{} },
Invokes(testing.NewGetActionWithOptions(persistentvolumeclaimsResource, c.ns, name, options), emptyResult) func() *v1.PersistentVolumeClaimList { return &v1.PersistentVolumeClaimList{} },
func(dst, src *v1.PersistentVolumeClaimList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.PersistentVolumeClaimList) []*v1.PersistentVolumeClaim {
return emptyResult, err return gentype.ToPointerSlice(list.Items)
},
func(list *v1.PersistentVolumeClaimList, items []*v1.PersistentVolumeClaim) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.PersistentVolumeClaim), err
}
// List takes label and field selectors, and returns the list of PersistentVolumeClaims that match those selectors.
func (c *FakePersistentVolumeClaims) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PersistentVolumeClaimList, err error) {
emptyResult := &v1.PersistentVolumeClaimList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(persistentvolumeclaimsResource, persistentvolumeclaimsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.PersistentVolumeClaimList{ListMeta: obj.(*v1.PersistentVolumeClaimList).ListMeta}
for _, item := range obj.(*v1.PersistentVolumeClaimList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested persistentVolumeClaims.
func (c *FakePersistentVolumeClaims) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(persistentvolumeclaimsResource, c.ns, opts))
}
// Create takes the representation of a persistentVolumeClaim and creates it. Returns the server's representation of the persistentVolumeClaim, and an error, if there is any.
func (c *FakePersistentVolumeClaims) Create(ctx context.Context, persistentVolumeClaim *v1.PersistentVolumeClaim, opts metav1.CreateOptions) (result *v1.PersistentVolumeClaim, err error) {
emptyResult := &v1.PersistentVolumeClaim{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(persistentvolumeclaimsResource, c.ns, persistentVolumeClaim, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PersistentVolumeClaim), err
}
// Update takes the representation of a persistentVolumeClaim and updates it. Returns the server's representation of the persistentVolumeClaim, and an error, if there is any.
func (c *FakePersistentVolumeClaims) Update(ctx context.Context, persistentVolumeClaim *v1.PersistentVolumeClaim, opts metav1.UpdateOptions) (result *v1.PersistentVolumeClaim, err error) {
emptyResult := &v1.PersistentVolumeClaim{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(persistentvolumeclaimsResource, c.ns, persistentVolumeClaim, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PersistentVolumeClaim), 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 *FakePersistentVolumeClaims) UpdateStatus(ctx context.Context, persistentVolumeClaim *v1.PersistentVolumeClaim, opts metav1.UpdateOptions) (result *v1.PersistentVolumeClaim, err error) {
emptyResult := &v1.PersistentVolumeClaim{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(persistentvolumeclaimsResource, "status", c.ns, persistentVolumeClaim, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PersistentVolumeClaim), err
}
// Delete takes name of the persistentVolumeClaim and deletes it. Returns an error if one occurs.
func (c *FakePersistentVolumeClaims) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(persistentvolumeclaimsResource, c.ns, name, opts), &v1.PersistentVolumeClaim{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakePersistentVolumeClaims) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(persistentvolumeclaimsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.PersistentVolumeClaimList{})
return err
}
// Patch applies the patch and returns the patched persistentVolumeClaim.
func (c *FakePersistentVolumeClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PersistentVolumeClaim, err error) {
emptyResult := &v1.PersistentVolumeClaim{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(persistentvolumeclaimsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PersistentVolumeClaim), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied persistentVolumeClaim.
func (c *FakePersistentVolumeClaims) Apply(ctx context.Context, persistentVolumeClaim *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolumeClaim, err error) {
if persistentVolumeClaim == nil {
return nil, fmt.Errorf("persistentVolumeClaim provided to Apply must not be nil")
}
data, err := json.Marshal(persistentVolumeClaim)
if err != nil {
return nil, err
}
name := persistentVolumeClaim.Name
if name == nil {
return nil, fmt.Errorf("persistentVolumeClaim.Name must be provided to Apply")
}
emptyResult := &v1.PersistentVolumeClaim{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(persistentvolumeclaimsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PersistentVolumeClaim), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakePersistentVolumeClaims) ApplyStatus(ctx context.Context, persistentVolumeClaim *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolumeClaim, err error) {
if persistentVolumeClaim == nil {
return nil, fmt.Errorf("persistentVolumeClaim provided to Apply must not be nil")
}
data, err := json.Marshal(persistentVolumeClaim)
if err != nil {
return nil, err
}
name := persistentVolumeClaim.Name
if name == nil {
return nil, fmt.Errorf("persistentVolumeClaim.Name must be provided to Apply")
}
emptyResult := &v1.PersistentVolumeClaim{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(persistentvolumeclaimsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PersistentVolumeClaim), err
} }

View File

@@ -20,187 +20,43 @@ package fake
import ( import (
context "context" context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
// FakePods implements PodInterface // fakePods implements PodInterface
type FakePods struct { type fakePods struct {
*gentype.FakeClientWithListAndApply[*v1.Pod, *v1.PodList, *corev1.PodApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
ns string
} }
var podsResource = v1.SchemeGroupVersion.WithResource("pods") func newFakePods(fake *FakeCoreV1, namespace string) typedcorev1.PodInterface {
return &fakePods{
var podsKind = v1.SchemeGroupVersion.WithKind("Pod") gentype.NewFakeClientWithListAndApply[*v1.Pod, *v1.PodList, *corev1.PodApplyConfiguration](
fake.Fake,
// Get takes name of the pod, and returns the corresponding pod object, and an error if there is any. namespace,
func (c *FakePods) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Pod, err error) { v1.SchemeGroupVersion.WithResource("pods"),
emptyResult := &v1.Pod{} v1.SchemeGroupVersion.WithKind("Pod"),
obj, err := c.Fake. func() *v1.Pod { return &v1.Pod{} },
Invokes(testing.NewGetActionWithOptions(podsResource, c.ns, name, options), emptyResult) func() *v1.PodList { return &v1.PodList{} },
func(dst, src *v1.PodList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.PodList) []*v1.Pod { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.PodList, items []*v1.Pod) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.Pod), err
}
// List takes label and field selectors, and returns the list of Pods that match those selectors.
func (c *FakePods) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PodList, err error) {
emptyResult := &v1.PodList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(podsResource, podsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.PodList{ListMeta: obj.(*v1.PodList).ListMeta}
for _, item := range obj.(*v1.PodList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested pods.
func (c *FakePods) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(podsResource, c.ns, opts))
}
// Create takes the representation of a pod and creates it. Returns the server's representation of the pod, and an error, if there is any.
func (c *FakePods) Create(ctx context.Context, pod *v1.Pod, opts metav1.CreateOptions) (result *v1.Pod, err error) {
emptyResult := &v1.Pod{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(podsResource, c.ns, pod, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Pod), err
}
// Update takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any.
func (c *FakePods) Update(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) {
emptyResult := &v1.Pod{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(podsResource, c.ns, pod, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Pod), 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 *FakePods) UpdateStatus(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) {
emptyResult := &v1.Pod{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(podsResource, "status", c.ns, pod, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Pod), err
}
// Delete takes name of the pod and deletes it. Returns an error if one occurs.
func (c *FakePods) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(podsResource, c.ns, name, opts), &v1.Pod{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakePods) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(podsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.PodList{})
return err
}
// Patch applies the patch and returns the patched pod.
func (c *FakePods) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Pod, err error) {
emptyResult := &v1.Pod{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(podsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Pod), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied pod.
func (c *FakePods) Apply(ctx context.Context, pod *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Pod, err error) {
if pod == nil {
return nil, fmt.Errorf("pod provided to Apply must not be nil")
}
data, err := json.Marshal(pod)
if err != nil {
return nil, err
}
name := pod.Name
if name == nil {
return nil, fmt.Errorf("pod.Name must be provided to Apply")
}
emptyResult := &v1.Pod{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(podsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Pod), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakePods) ApplyStatus(ctx context.Context, pod *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Pod, err error) {
if pod == nil {
return nil, fmt.Errorf("pod provided to Apply must not be nil")
}
data, err := json.Marshal(pod)
if err != nil {
return nil, err
}
name := pod.Name
if name == nil {
return nil, fmt.Errorf("pod.Name must be provided to Apply")
}
emptyResult := &v1.Pod{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(podsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Pod), err
} }
// UpdateEphemeralContainers takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any. // UpdateEphemeralContainers takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any.
func (c *FakePods) UpdateEphemeralContainers(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) { func (c *fakePods) UpdateEphemeralContainers(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) {
emptyResult := &v1.Pod{} emptyResult := &v1.Pod{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(podsResource, "ephemeralcontainers", c.ns, pod, opts), &v1.Pod{}) Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "ephemeralcontainers", c.Namespace(), pod, opts), &v1.Pod{})
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err
@@ -209,10 +65,10 @@ func (c *FakePods) UpdateEphemeralContainers(ctx context.Context, podName string
} }
// UpdateResize takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any. // UpdateResize takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any.
func (c *FakePods) UpdateResize(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) { func (c *fakePods) UpdateResize(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) {
emptyResult := &v1.Pod{} emptyResult := &v1.Pod{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(podsResource, "resize", c.ns, pod, opts), &v1.Pod{}) Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "resize", c.Namespace(), pod, opts), &v1.Pod{})
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err

View File

@@ -19,142 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
) )
// FakePodTemplates implements PodTemplateInterface // fakePodTemplates implements PodTemplateInterface
type FakePodTemplates struct { type fakePodTemplates struct {
*gentype.FakeClientWithListAndApply[*v1.PodTemplate, *v1.PodTemplateList, *corev1.PodTemplateApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
ns string
} }
var podtemplatesResource = v1.SchemeGroupVersion.WithResource("podtemplates") func newFakePodTemplates(fake *FakeCoreV1, namespace string) typedcorev1.PodTemplateInterface {
return &fakePodTemplates{
var podtemplatesKind = v1.SchemeGroupVersion.WithKind("PodTemplate") gentype.NewFakeClientWithListAndApply[*v1.PodTemplate, *v1.PodTemplateList, *corev1.PodTemplateApplyConfiguration](
fake.Fake,
// Get takes name of the podTemplate, and returns the corresponding podTemplate object, and an error if there is any. namespace,
func (c *FakePodTemplates) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PodTemplate, err error) { v1.SchemeGroupVersion.WithResource("podtemplates"),
emptyResult := &v1.PodTemplate{} v1.SchemeGroupVersion.WithKind("PodTemplate"),
obj, err := c.Fake. func() *v1.PodTemplate { return &v1.PodTemplate{} },
Invokes(testing.NewGetActionWithOptions(podtemplatesResource, c.ns, name, options), emptyResult) func() *v1.PodTemplateList { return &v1.PodTemplateList{} },
func(dst, src *v1.PodTemplateList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.PodTemplateList) []*v1.PodTemplate { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.PodTemplateList, items []*v1.PodTemplate) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.PodTemplate), err
}
// List takes label and field selectors, and returns the list of PodTemplates that match those selectors.
func (c *FakePodTemplates) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PodTemplateList, err error) {
emptyResult := &v1.PodTemplateList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(podtemplatesResource, podtemplatesKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.PodTemplateList{ListMeta: obj.(*v1.PodTemplateList).ListMeta}
for _, item := range obj.(*v1.PodTemplateList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested podTemplates.
func (c *FakePodTemplates) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(podtemplatesResource, c.ns, opts))
}
// Create takes the representation of a podTemplate and creates it. Returns the server's representation of the podTemplate, and an error, if there is any.
func (c *FakePodTemplates) Create(ctx context.Context, podTemplate *v1.PodTemplate, opts metav1.CreateOptions) (result *v1.PodTemplate, err error) {
emptyResult := &v1.PodTemplate{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(podtemplatesResource, c.ns, podTemplate, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PodTemplate), err
}
// Update takes the representation of a podTemplate and updates it. Returns the server's representation of the podTemplate, and an error, if there is any.
func (c *FakePodTemplates) Update(ctx context.Context, podTemplate *v1.PodTemplate, opts metav1.UpdateOptions) (result *v1.PodTemplate, err error) {
emptyResult := &v1.PodTemplate{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(podtemplatesResource, c.ns, podTemplate, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PodTemplate), err
}
// Delete takes name of the podTemplate and deletes it. Returns an error if one occurs.
func (c *FakePodTemplates) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(podtemplatesResource, c.ns, name, opts), &v1.PodTemplate{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakePodTemplates) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(podtemplatesResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.PodTemplateList{})
return err
}
// Patch applies the patch and returns the patched podTemplate.
func (c *FakePodTemplates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PodTemplate, err error) {
emptyResult := &v1.PodTemplate{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(podtemplatesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PodTemplate), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied podTemplate.
func (c *FakePodTemplates) Apply(ctx context.Context, podTemplate *corev1.PodTemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PodTemplate, err error) {
if podTemplate == nil {
return nil, fmt.Errorf("podTemplate provided to Apply must not be nil")
}
data, err := json.Marshal(podTemplate)
if err != nil {
return nil, err
}
name := podTemplate.Name
if name == nil {
return nil, fmt.Errorf("podTemplate.Name must be provided to Apply")
}
emptyResult := &v1.PodTemplate{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(podtemplatesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.PodTemplate), err
} }

View File

@@ -20,188 +20,48 @@ package fake
import ( import (
context "context" context "context"
json "encoding/json"
fmt "fmt"
autoscalingv1 "k8s.io/api/autoscaling/v1" autoscalingv1 "k8s.io/api/autoscaling/v1"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
// FakeReplicationControllers implements ReplicationControllerInterface // fakeReplicationControllers implements ReplicationControllerInterface
type FakeReplicationControllers struct { type fakeReplicationControllers struct {
*gentype.FakeClientWithListAndApply[*v1.ReplicationController, *v1.ReplicationControllerList, *corev1.ReplicationControllerApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
ns string
} }
var replicationcontrollersResource = v1.SchemeGroupVersion.WithResource("replicationcontrollers") func newFakeReplicationControllers(fake *FakeCoreV1, namespace string) typedcorev1.ReplicationControllerInterface {
return &fakeReplicationControllers{
var replicationcontrollersKind = v1.SchemeGroupVersion.WithKind("ReplicationController") gentype.NewFakeClientWithListAndApply[*v1.ReplicationController, *v1.ReplicationControllerList, *corev1.ReplicationControllerApplyConfiguration](
fake.Fake,
// Get takes name of the replicationController, and returns the corresponding replicationController object, and an error if there is any. namespace,
func (c *FakeReplicationControllers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ReplicationController, err error) { v1.SchemeGroupVersion.WithResource("replicationcontrollers"),
emptyResult := &v1.ReplicationController{} v1.SchemeGroupVersion.WithKind("ReplicationController"),
obj, err := c.Fake. func() *v1.ReplicationController { return &v1.ReplicationController{} },
Invokes(testing.NewGetActionWithOptions(replicationcontrollersResource, c.ns, name, options), emptyResult) func() *v1.ReplicationControllerList { return &v1.ReplicationControllerList{} },
func(dst, src *v1.ReplicationControllerList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.ReplicationControllerList) []*v1.ReplicationController {
return emptyResult, err return gentype.ToPointerSlice(list.Items)
},
func(list *v1.ReplicationControllerList, items []*v1.ReplicationController) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.ReplicationController), err
}
// List takes label and field selectors, and returns the list of ReplicationControllers that match those selectors.
func (c *FakeReplicationControllers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ReplicationControllerList, err error) {
emptyResult := &v1.ReplicationControllerList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(replicationcontrollersResource, replicationcontrollersKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ReplicationControllerList{ListMeta: obj.(*v1.ReplicationControllerList).ListMeta}
for _, item := range obj.(*v1.ReplicationControllerList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested replicationControllers.
func (c *FakeReplicationControllers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(replicationcontrollersResource, c.ns, opts))
}
// Create takes the representation of a replicationController and creates it. Returns the server's representation of the replicationController, and an error, if there is any.
func (c *FakeReplicationControllers) Create(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.CreateOptions) (result *v1.ReplicationController, err error) {
emptyResult := &v1.ReplicationController{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(replicationcontrollersResource, c.ns, replicationController, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ReplicationController), err
}
// Update takes the representation of a replicationController and updates it. Returns the server's representation of the replicationController, and an error, if there is any.
func (c *FakeReplicationControllers) Update(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (result *v1.ReplicationController, err error) {
emptyResult := &v1.ReplicationController{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(replicationcontrollersResource, c.ns, replicationController, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ReplicationController), 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 *FakeReplicationControllers) UpdateStatus(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (result *v1.ReplicationController, err error) {
emptyResult := &v1.ReplicationController{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(replicationcontrollersResource, "status", c.ns, replicationController, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ReplicationController), err
}
// Delete takes name of the replicationController and deletes it. Returns an error if one occurs.
func (c *FakeReplicationControllers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(replicationcontrollersResource, c.ns, name, opts), &v1.ReplicationController{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeReplicationControllers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(replicationcontrollersResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.ReplicationControllerList{})
return err
}
// Patch applies the patch and returns the patched replicationController.
func (c *FakeReplicationControllers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ReplicationController, err error) {
emptyResult := &v1.ReplicationController{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(replicationcontrollersResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ReplicationController), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied replicationController.
func (c *FakeReplicationControllers) Apply(ctx context.Context, replicationController *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicationController, err error) {
if replicationController == nil {
return nil, fmt.Errorf("replicationController provided to Apply must not be nil")
}
data, err := json.Marshal(replicationController)
if err != nil {
return nil, err
}
name := replicationController.Name
if name == nil {
return nil, fmt.Errorf("replicationController.Name must be provided to Apply")
}
emptyResult := &v1.ReplicationController{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(replicationcontrollersResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ReplicationController), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeReplicationControllers) ApplyStatus(ctx context.Context, replicationController *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicationController, err error) {
if replicationController == nil {
return nil, fmt.Errorf("replicationController provided to Apply must not be nil")
}
data, err := json.Marshal(replicationController)
if err != nil {
return nil, err
}
name := replicationController.Name
if name == nil {
return nil, fmt.Errorf("replicationController.Name must be provided to Apply")
}
emptyResult := &v1.ReplicationController{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(replicationcontrollersResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ReplicationController), err
} }
// GetScale takes name of the replicationController, and returns the corresponding scale object, and an error if there is any. // GetScale takes name of the replicationController, and returns the corresponding scale object, and an error if there is any.
func (c *FakeReplicationControllers) GetScale(ctx context.Context, replicationControllerName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { func (c *fakeReplicationControllers) GetScale(ctx context.Context, replicationControllerName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
emptyResult := &autoscalingv1.Scale{} emptyResult := &autoscalingv1.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewGetSubresourceActionWithOptions(replicationcontrollersResource, c.ns, "scale", replicationControllerName, options), emptyResult) Invokes(testing.NewGetSubresourceActionWithOptions(c.Resource(), c.Namespace(), "scale", replicationControllerName, options), emptyResult)
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err
@@ -210,10 +70,10 @@ func (c *FakeReplicationControllers) GetScale(ctx context.Context, replicationCo
} }
// 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. // 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 *FakeReplicationControllers) UpdateScale(ctx context.Context, replicationControllerName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { func (c *fakeReplicationControllers) UpdateScale(ctx context.Context, replicationControllerName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
emptyResult := &autoscalingv1.Scale{} emptyResult := &autoscalingv1.Scale{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(replicationcontrollersResource, "scale", c.ns, scale, opts), &autoscalingv1.Scale{}) Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "scale", c.Namespace(), scale, opts), &autoscalingv1.Scale{})
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err

View File

@@ -19,179 +19,33 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
) )
// FakeResourceQuotas implements ResourceQuotaInterface // fakeResourceQuotas implements ResourceQuotaInterface
type FakeResourceQuotas struct { type fakeResourceQuotas struct {
*gentype.FakeClientWithListAndApply[*v1.ResourceQuota, *v1.ResourceQuotaList, *corev1.ResourceQuotaApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
ns string
} }
var resourcequotasResource = v1.SchemeGroupVersion.WithResource("resourcequotas") func newFakeResourceQuotas(fake *FakeCoreV1, namespace string) typedcorev1.ResourceQuotaInterface {
return &fakeResourceQuotas{
var resourcequotasKind = v1.SchemeGroupVersion.WithKind("ResourceQuota") gentype.NewFakeClientWithListAndApply[*v1.ResourceQuota, *v1.ResourceQuotaList, *corev1.ResourceQuotaApplyConfiguration](
fake.Fake,
// Get takes name of the resourceQuota, and returns the corresponding resourceQuota object, and an error if there is any. namespace,
func (c *FakeResourceQuotas) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ResourceQuota, err error) { v1.SchemeGroupVersion.WithResource("resourcequotas"),
emptyResult := &v1.ResourceQuota{} v1.SchemeGroupVersion.WithKind("ResourceQuota"),
obj, err := c.Fake. func() *v1.ResourceQuota { return &v1.ResourceQuota{} },
Invokes(testing.NewGetActionWithOptions(resourcequotasResource, c.ns, name, options), emptyResult) func() *v1.ResourceQuotaList { return &v1.ResourceQuotaList{} },
func(dst, src *v1.ResourceQuotaList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.ResourceQuotaList) []*v1.ResourceQuota { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.ResourceQuotaList, items []*v1.ResourceQuota) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.ResourceQuota), err
}
// List takes label and field selectors, and returns the list of ResourceQuotas that match those selectors.
func (c *FakeResourceQuotas) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceQuotaList, err error) {
emptyResult := &v1.ResourceQuotaList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(resourcequotasResource, resourcequotasKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ResourceQuotaList{ListMeta: obj.(*v1.ResourceQuotaList).ListMeta}
for _, item := range obj.(*v1.ResourceQuotaList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested resourceQuotas.
func (c *FakeResourceQuotas) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(resourcequotasResource, c.ns, opts))
}
// Create takes the representation of a resourceQuota and creates it. Returns the server's representation of the resourceQuota, and an error, if there is any.
func (c *FakeResourceQuotas) Create(ctx context.Context, resourceQuota *v1.ResourceQuota, opts metav1.CreateOptions) (result *v1.ResourceQuota, err error) {
emptyResult := &v1.ResourceQuota{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(resourcequotasResource, c.ns, resourceQuota, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ResourceQuota), err
}
// Update takes the representation of a resourceQuota and updates it. Returns the server's representation of the resourceQuota, and an error, if there is any.
func (c *FakeResourceQuotas) Update(ctx context.Context, resourceQuota *v1.ResourceQuota, opts metav1.UpdateOptions) (result *v1.ResourceQuota, err error) {
emptyResult := &v1.ResourceQuota{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(resourcequotasResource, c.ns, resourceQuota, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ResourceQuota), 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 *FakeResourceQuotas) UpdateStatus(ctx context.Context, resourceQuota *v1.ResourceQuota, opts metav1.UpdateOptions) (result *v1.ResourceQuota, err error) {
emptyResult := &v1.ResourceQuota{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(resourcequotasResource, "status", c.ns, resourceQuota, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ResourceQuota), err
}
// Delete takes name of the resourceQuota and deletes it. Returns an error if one occurs.
func (c *FakeResourceQuotas) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(resourcequotasResource, c.ns, name, opts), &v1.ResourceQuota{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeResourceQuotas) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(resourcequotasResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.ResourceQuotaList{})
return err
}
// Patch applies the patch and returns the patched resourceQuota.
func (c *FakeResourceQuotas) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceQuota, err error) {
emptyResult := &v1.ResourceQuota{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(resourcequotasResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ResourceQuota), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied resourceQuota.
func (c *FakeResourceQuotas) Apply(ctx context.Context, resourceQuota *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceQuota, err error) {
if resourceQuota == nil {
return nil, fmt.Errorf("resourceQuota provided to Apply must not be nil")
}
data, err := json.Marshal(resourceQuota)
if err != nil {
return nil, err
}
name := resourceQuota.Name
if name == nil {
return nil, fmt.Errorf("resourceQuota.Name must be provided to Apply")
}
emptyResult := &v1.ResourceQuota{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(resourcequotasResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ResourceQuota), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeResourceQuotas) ApplyStatus(ctx context.Context, resourceQuota *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceQuota, err error) {
if resourceQuota == nil {
return nil, fmt.Errorf("resourceQuota provided to Apply must not be nil")
}
data, err := json.Marshal(resourceQuota)
if err != nil {
return nil, err
}
name := resourceQuota.Name
if name == nil {
return nil, fmt.Errorf("resourceQuota.Name must be provided to Apply")
}
emptyResult := &v1.ResourceQuota{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(resourcequotasResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ResourceQuota), err
} }

View File

@@ -19,142 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
) )
// FakeSecrets implements SecretInterface // fakeSecrets implements SecretInterface
type FakeSecrets struct { type fakeSecrets struct {
*gentype.FakeClientWithListAndApply[*v1.Secret, *v1.SecretList, *corev1.SecretApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
ns string
} }
var secretsResource = v1.SchemeGroupVersion.WithResource("secrets") func newFakeSecrets(fake *FakeCoreV1, namespace string) typedcorev1.SecretInterface {
return &fakeSecrets{
var secretsKind = v1.SchemeGroupVersion.WithKind("Secret") gentype.NewFakeClientWithListAndApply[*v1.Secret, *v1.SecretList, *corev1.SecretApplyConfiguration](
fake.Fake,
// Get takes name of the secret, and returns the corresponding secret object, and an error if there is any. namespace,
func (c *FakeSecrets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Secret, err error) { v1.SchemeGroupVersion.WithResource("secrets"),
emptyResult := &v1.Secret{} v1.SchemeGroupVersion.WithKind("Secret"),
obj, err := c.Fake. func() *v1.Secret { return &v1.Secret{} },
Invokes(testing.NewGetActionWithOptions(secretsResource, c.ns, name, options), emptyResult) func() *v1.SecretList { return &v1.SecretList{} },
func(dst, src *v1.SecretList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.SecretList) []*v1.Secret { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.SecretList, items []*v1.Secret) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.Secret), err
}
// List takes label and field selectors, and returns the list of Secrets that match those selectors.
func (c *FakeSecrets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.SecretList, err error) {
emptyResult := &v1.SecretList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(secretsResource, secretsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.SecretList{ListMeta: obj.(*v1.SecretList).ListMeta}
for _, item := range obj.(*v1.SecretList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested secrets.
func (c *FakeSecrets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(secretsResource, c.ns, opts))
}
// Create takes the representation of a secret and creates it. Returns the server's representation of the secret, and an error, if there is any.
func (c *FakeSecrets) Create(ctx context.Context, secret *v1.Secret, opts metav1.CreateOptions) (result *v1.Secret, err error) {
emptyResult := &v1.Secret{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(secretsResource, c.ns, secret, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Secret), err
}
// Update takes the representation of a secret and updates it. Returns the server's representation of the secret, and an error, if there is any.
func (c *FakeSecrets) Update(ctx context.Context, secret *v1.Secret, opts metav1.UpdateOptions) (result *v1.Secret, err error) {
emptyResult := &v1.Secret{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(secretsResource, c.ns, secret, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Secret), err
}
// Delete takes name of the secret and deletes it. Returns an error if one occurs.
func (c *FakeSecrets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(secretsResource, c.ns, name, opts), &v1.Secret{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeSecrets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(secretsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.SecretList{})
return err
}
// Patch applies the patch and returns the patched secret.
func (c *FakeSecrets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Secret, err error) {
emptyResult := &v1.Secret{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(secretsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Secret), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied secret.
func (c *FakeSecrets) Apply(ctx context.Context, secret *corev1.SecretApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Secret, err error) {
if secret == nil {
return nil, fmt.Errorf("secret provided to Apply must not be nil")
}
data, err := json.Marshal(secret)
if err != nil {
return nil, err
}
name := secret.Name
if name == nil {
return nil, fmt.Errorf("secret.Name must be provided to Apply")
}
emptyResult := &v1.Secret{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(secretsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Secret), err
} }

View File

@@ -19,171 +19,31 @@ limitations under the License.
package fake package fake
import ( import (
context "context"
json "encoding/json"
fmt "fmt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
testing "k8s.io/client-go/testing" gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
) )
// FakeServices implements ServiceInterface // fakeServices implements ServiceInterface
type FakeServices struct { type fakeServices struct {
*gentype.FakeClientWithListAndApply[*v1.Service, *v1.ServiceList, *corev1.ServiceApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
ns string
} }
var servicesResource = v1.SchemeGroupVersion.WithResource("services") func newFakeServices(fake *FakeCoreV1, namespace string) typedcorev1.ServiceInterface {
return &fakeServices{
var servicesKind = v1.SchemeGroupVersion.WithKind("Service") gentype.NewFakeClientWithListAndApply[*v1.Service, *v1.ServiceList, *corev1.ServiceApplyConfiguration](
fake.Fake,
// Get takes name of the service, and returns the corresponding service object, and an error if there is any. namespace,
func (c *FakeServices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Service, err error) { v1.SchemeGroupVersion.WithResource("services"),
emptyResult := &v1.Service{} v1.SchemeGroupVersion.WithKind("Service"),
obj, err := c.Fake. func() *v1.Service { return &v1.Service{} },
Invokes(testing.NewGetActionWithOptions(servicesResource, c.ns, name, options), emptyResult) func() *v1.ServiceList { return &v1.ServiceList{} },
func(dst, src *v1.ServiceList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.ServiceList) []*v1.Service { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.ServiceList, items []*v1.Service) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
} }
return obj.(*v1.Service), err
}
// List takes label and field selectors, and returns the list of Services that match those selectors.
func (c *FakeServices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ServiceList, err error) {
emptyResult := &v1.ServiceList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(servicesResource, servicesKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ServiceList{ListMeta: obj.(*v1.ServiceList).ListMeta}
for _, item := range obj.(*v1.ServiceList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested services.
func (c *FakeServices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(servicesResource, c.ns, opts))
}
// Create takes the representation of a service and creates it. Returns the server's representation of the service, and an error, if there is any.
func (c *FakeServices) Create(ctx context.Context, service *v1.Service, opts metav1.CreateOptions) (result *v1.Service, err error) {
emptyResult := &v1.Service{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(servicesResource, c.ns, service, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Service), err
}
// Update takes the representation of a service and updates it. Returns the server's representation of the service, and an error, if there is any.
func (c *FakeServices) Update(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (result *v1.Service, err error) {
emptyResult := &v1.Service{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(servicesResource, c.ns, service, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Service), 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 *FakeServices) UpdateStatus(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (result *v1.Service, err error) {
emptyResult := &v1.Service{}
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceActionWithOptions(servicesResource, "status", c.ns, service, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Service), err
}
// Delete takes name of the service and deletes it. Returns an error if one occurs.
func (c *FakeServices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(servicesResource, c.ns, name, opts), &v1.Service{})
return err
}
// Patch applies the patch and returns the patched service.
func (c *FakeServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Service, err error) {
emptyResult := &v1.Service{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(servicesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Service), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied service.
func (c *FakeServices) Apply(ctx context.Context, service *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Service, err error) {
if service == nil {
return nil, fmt.Errorf("service provided to Apply must not be nil")
}
data, err := json.Marshal(service)
if err != nil {
return nil, err
}
name := service.Name
if name == nil {
return nil, fmt.Errorf("service.Name must be provided to Apply")
}
emptyResult := &v1.Service{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(servicesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Service), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeServices) ApplyStatus(ctx context.Context, service *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Service, err error) {
if service == nil {
return nil, fmt.Errorf("service provided to Apply must not be nil")
}
data, err := json.Marshal(service)
if err != nil {
return nil, err
}
name := service.Name
if name == nil {
return nil, fmt.Errorf("service.Name must be provided to Apply")
}
emptyResult := &v1.Service{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(servicesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.Service), err
} }

View File

@@ -20,151 +20,46 @@ package fake
import ( import (
context "context" context "context"
json "encoding/json"
fmt "fmt"
authenticationv1 "k8s.io/api/authentication/v1" authenticationv1 "k8s.io/api/authentication/v1"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1"
gentype "k8s.io/client-go/gentype"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
// FakeServiceAccounts implements ServiceAccountInterface // fakeServiceAccounts implements ServiceAccountInterface
type FakeServiceAccounts struct { type fakeServiceAccounts struct {
*gentype.FakeClientWithListAndApply[*v1.ServiceAccount, *v1.ServiceAccountList, *corev1.ServiceAccountApplyConfiguration]
Fake *FakeCoreV1 Fake *FakeCoreV1
ns string
} }
var serviceaccountsResource = v1.SchemeGroupVersion.WithResource("serviceaccounts") func newFakeServiceAccounts(fake *FakeCoreV1, namespace string) typedcorev1.ServiceAccountInterface {
return &fakeServiceAccounts{
var serviceaccountsKind = v1.SchemeGroupVersion.WithKind("ServiceAccount") gentype.NewFakeClientWithListAndApply[*v1.ServiceAccount, *v1.ServiceAccountList, *corev1.ServiceAccountApplyConfiguration](
fake.Fake,
// Get takes name of the serviceAccount, and returns the corresponding serviceAccount object, and an error if there is any. namespace,
func (c *FakeServiceAccounts) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ServiceAccount, err error) { v1.SchemeGroupVersion.WithResource("serviceaccounts"),
emptyResult := &v1.ServiceAccount{} v1.SchemeGroupVersion.WithKind("ServiceAccount"),
obj, err := c.Fake. func() *v1.ServiceAccount { return &v1.ServiceAccount{} },
Invokes(testing.NewGetActionWithOptions(serviceaccountsResource, c.ns, name, options), emptyResult) func() *v1.ServiceAccountList { return &v1.ServiceAccountList{} },
func(dst, src *v1.ServiceAccountList) { dst.ListMeta = src.ListMeta },
if obj == nil { func(list *v1.ServiceAccountList) []*v1.ServiceAccount { return gentype.ToPointerSlice(list.Items) },
return emptyResult, err func(list *v1.ServiceAccountList, items []*v1.ServiceAccount) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
} }
return obj.(*v1.ServiceAccount), err
}
// List takes label and field selectors, and returns the list of ServiceAccounts that match those selectors.
func (c *FakeServiceAccounts) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ServiceAccountList, err error) {
emptyResult := &v1.ServiceAccountList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(serviceaccountsResource, serviceaccountsKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ServiceAccountList{ListMeta: obj.(*v1.ServiceAccountList).ListMeta}
for _, item := range obj.(*v1.ServiceAccountList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested serviceAccounts.
func (c *FakeServiceAccounts) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(serviceaccountsResource, c.ns, opts))
}
// Create takes the representation of a serviceAccount and creates it. Returns the server's representation of the serviceAccount, and an error, if there is any.
func (c *FakeServiceAccounts) Create(ctx context.Context, serviceAccount *v1.ServiceAccount, opts metav1.CreateOptions) (result *v1.ServiceAccount, err error) {
emptyResult := &v1.ServiceAccount{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(serviceaccountsResource, c.ns, serviceAccount, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ServiceAccount), err
}
// Update takes the representation of a serviceAccount and updates it. Returns the server's representation of the serviceAccount, and an error, if there is any.
func (c *FakeServiceAccounts) Update(ctx context.Context, serviceAccount *v1.ServiceAccount, opts metav1.UpdateOptions) (result *v1.ServiceAccount, err error) {
emptyResult := &v1.ServiceAccount{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(serviceaccountsResource, c.ns, serviceAccount, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ServiceAccount), err
}
// Delete takes name of the serviceAccount and deletes it. Returns an error if one occurs.
func (c *FakeServiceAccounts) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(serviceaccountsResource, c.ns, name, opts), &v1.ServiceAccount{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeServiceAccounts) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(serviceaccountsResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1.ServiceAccountList{})
return err
}
// Patch applies the patch and returns the patched serviceAccount.
func (c *FakeServiceAccounts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ServiceAccount, err error) {
emptyResult := &v1.ServiceAccount{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(serviceaccountsResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ServiceAccount), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied serviceAccount.
func (c *FakeServiceAccounts) Apply(ctx context.Context, serviceAccount *corev1.ServiceAccountApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ServiceAccount, err error) {
if serviceAccount == nil {
return nil, fmt.Errorf("serviceAccount provided to Apply must not be nil")
}
data, err := json.Marshal(serviceAccount)
if err != nil {
return nil, err
}
name := serviceAccount.Name
if name == nil {
return nil, fmt.Errorf("serviceAccount.Name must be provided to Apply")
}
emptyResult := &v1.ServiceAccount{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(serviceaccountsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1.ServiceAccount), err
} }
// CreateToken takes the representation of a tokenRequest and creates it. Returns the server's representation of the tokenRequest, and an error, if there is any. // CreateToken takes the representation of a tokenRequest and creates it. Returns the server's representation of the tokenRequest, and an error, if there is any.
func (c *FakeServiceAccounts) CreateToken(ctx context.Context, serviceAccountName string, tokenRequest *authenticationv1.TokenRequest, opts metav1.CreateOptions) (result *authenticationv1.TokenRequest, err error) { func (c *fakeServiceAccounts) CreateToken(ctx context.Context, serviceAccountName string, tokenRequest *authenticationv1.TokenRequest, opts metav1.CreateOptions) (result *authenticationv1.TokenRequest, err error) {
emptyResult := &authenticationv1.TokenRequest{} emptyResult := &authenticationv1.TokenRequest{}
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewCreateSubresourceActionWithOptions(serviceaccountsResource, serviceAccountName, "token", c.ns, tokenRequest, opts), emptyResult) Invokes(testing.NewCreateSubresourceActionWithOptions(c.Resource(), serviceAccountName, "token", c.Namespace(), tokenRequest, opts), emptyResult)
if obj == nil { if obj == nil {
return emptyResult, err return emptyResult, err

Some files were not shown because too many files have changed in this diff Show More