// Code generated by client-gen. DO NOT EDIT.

package fake

import (
	imageregistryv1 "github.com/openshift/api/imageregistry/v1"
	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	labels "k8s.io/apimachinery/pkg/labels"
	schema "k8s.io/apimachinery/pkg/runtime/schema"
	types "k8s.io/apimachinery/pkg/types"
	watch "k8s.io/apimachinery/pkg/watch"
	testing "k8s.io/client-go/testing"
)

// FakeImagePruners implements ImagePrunerInterface
type FakeImagePruners struct {
	Fake *FakeImageregistryV1
}

var imageprunersResource = schema.GroupVersionResource{Group: "imageregistry.operator.openshift.io", Version: "v1", Resource: "imagepruners"}

var imageprunersKind = schema.GroupVersionKind{Group: "imageregistry.operator.openshift.io", Version: "v1", Kind: "ImagePruner"}

// Get takes name of the imagePruner, and returns the corresponding imagePruner object, and an error if there is any.
func (c *FakeImagePruners) Get(name string, options v1.GetOptions) (result *imageregistryv1.ImagePruner, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootGetAction(imageprunersResource, name), &imageregistryv1.ImagePruner{})
	if obj == nil {
		return nil, err
	}
	return obj.(*imageregistryv1.ImagePruner), err
}

// List takes label and field selectors, and returns the list of ImagePruners that match those selectors.
func (c *FakeImagePruners) List(opts v1.ListOptions) (result *imageregistryv1.ImagePrunerList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootListAction(imageprunersResource, imageprunersKind, opts), &imageregistryv1.ImagePrunerList{})
	if obj == nil {
		return nil, err
	}

	label, _, _ := testing.ExtractFromListOptions(opts)
	if label == nil {
		label = labels.Everything()
	}
	list := &imageregistryv1.ImagePrunerList{ListMeta: obj.(*imageregistryv1.ImagePrunerList).ListMeta}
	for _, item := range obj.(*imageregistryv1.ImagePrunerList).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 imagePruners.
func (c *FakeImagePruners) Watch(opts v1.ListOptions) (watch.Interface, error) {
	return c.Fake.
		InvokesWatch(testing.NewRootWatchAction(imageprunersResource, opts))
}

// Create takes the representation of a imagePruner and creates it.  Returns the server's representation of the imagePruner, and an error, if there is any.
func (c *FakeImagePruners) Create(imagePruner *imageregistryv1.ImagePruner) (result *imageregistryv1.ImagePruner, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootCreateAction(imageprunersResource, imagePruner), &imageregistryv1.ImagePruner{})
	if obj == nil {
		return nil, err
	}
	return obj.(*imageregistryv1.ImagePruner), err
}

// Update takes the representation of a imagePruner and updates it. Returns the server's representation of the imagePruner, and an error, if there is any.
func (c *FakeImagePruners) Update(imagePruner *imageregistryv1.ImagePruner) (result *imageregistryv1.ImagePruner, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootUpdateAction(imageprunersResource, imagePruner), &imageregistryv1.ImagePruner{})
	if obj == nil {
		return nil, err
	}
	return obj.(*imageregistryv1.ImagePruner), 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 *FakeImagePruners) UpdateStatus(imagePruner *imageregistryv1.ImagePruner) (*imageregistryv1.ImagePruner, error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootUpdateSubresourceAction(imageprunersResource, "status", imagePruner), &imageregistryv1.ImagePruner{})
	if obj == nil {
		return nil, err
	}
	return obj.(*imageregistryv1.ImagePruner), err
}

// Delete takes name of the imagePruner and deletes it. Returns an error if one occurs.
func (c *FakeImagePruners) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewRootDeleteAction(imageprunersResource, name), &imageregistryv1.ImagePruner{})
	return err
}

// DeleteCollection deletes a collection of objects.
func (c *FakeImagePruners) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
	action := testing.NewRootDeleteCollectionAction(imageprunersResource, listOptions)

	_, err := c.Fake.Invokes(action, &imageregistryv1.ImagePrunerList{})
	return err
}

// Patch applies the patch and returns the patched imagePruner.
func (c *FakeImagePruners) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *imageregistryv1.ImagePruner, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootPatchSubresourceAction(imageprunersResource, name, pt, data, subresources...), &imageregistryv1.ImagePruner{})
	if obj == nil {
		return nil, err
	}
	return obj.(*imageregistryv1.ImagePruner), err
}
