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

package fake

import (
	"context"

	hivev1 "github.com/openshift/hive/pkg/apis/hive/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"
)

// FakeClusterRelocates implements ClusterRelocateInterface
type FakeClusterRelocates struct {
	Fake *FakeHiveV1
}

var clusterrelocatesResource = schema.GroupVersionResource{Group: "hive.openshift.io", Version: "v1", Resource: "clusterrelocates"}

var clusterrelocatesKind = schema.GroupVersionKind{Group: "hive.openshift.io", Version: "v1", Kind: "ClusterRelocate"}

// Get takes name of the clusterRelocate, and returns the corresponding clusterRelocate object, and an error if there is any.
func (c *FakeClusterRelocates) Get(ctx context.Context, name string, options v1.GetOptions) (result *hivev1.ClusterRelocate, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootGetAction(clusterrelocatesResource, name), &hivev1.ClusterRelocate{})
	if obj == nil {
		return nil, err
	}
	return obj.(*hivev1.ClusterRelocate), err
}

// List takes label and field selectors, and returns the list of ClusterRelocates that match those selectors.
func (c *FakeClusterRelocates) List(ctx context.Context, opts v1.ListOptions) (result *hivev1.ClusterRelocateList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootListAction(clusterrelocatesResource, clusterrelocatesKind, opts), &hivev1.ClusterRelocateList{})
	if obj == nil {
		return nil, err
	}

	label, _, _ := testing.ExtractFromListOptions(opts)
	if label == nil {
		label = labels.Everything()
	}
	list := &hivev1.ClusterRelocateList{ListMeta: obj.(*hivev1.ClusterRelocateList).ListMeta}
	for _, item := range obj.(*hivev1.ClusterRelocateList).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 clusterRelocates.
func (c *FakeClusterRelocates) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
	return c.Fake.
		InvokesWatch(testing.NewRootWatchAction(clusterrelocatesResource, opts))
}

// Create takes the representation of a clusterRelocate and creates it.  Returns the server's representation of the clusterRelocate, and an error, if there is any.
func (c *FakeClusterRelocates) Create(ctx context.Context, clusterRelocate *hivev1.ClusterRelocate, opts v1.CreateOptions) (result *hivev1.ClusterRelocate, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootCreateAction(clusterrelocatesResource, clusterRelocate), &hivev1.ClusterRelocate{})
	if obj == nil {
		return nil, err
	}
	return obj.(*hivev1.ClusterRelocate), err
}

// Update takes the representation of a clusterRelocate and updates it. Returns the server's representation of the clusterRelocate, and an error, if there is any.
func (c *FakeClusterRelocates) Update(ctx context.Context, clusterRelocate *hivev1.ClusterRelocate, opts v1.UpdateOptions) (result *hivev1.ClusterRelocate, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootUpdateAction(clusterrelocatesResource, clusterRelocate), &hivev1.ClusterRelocate{})
	if obj == nil {
		return nil, err
	}
	return obj.(*hivev1.ClusterRelocate), 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 *FakeClusterRelocates) UpdateStatus(ctx context.Context, clusterRelocate *hivev1.ClusterRelocate, opts v1.UpdateOptions) (*hivev1.ClusterRelocate, error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootUpdateSubresourceAction(clusterrelocatesResource, "status", clusterRelocate), &hivev1.ClusterRelocate{})
	if obj == nil {
		return nil, err
	}
	return obj.(*hivev1.ClusterRelocate), err
}

// Delete takes name of the clusterRelocate and deletes it. Returns an error if one occurs.
func (c *FakeClusterRelocates) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewRootDeleteAction(clusterrelocatesResource, name), &hivev1.ClusterRelocate{})
	return err
}

// DeleteCollection deletes a collection of objects.
func (c *FakeClusterRelocates) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
	action := testing.NewRootDeleteCollectionAction(clusterrelocatesResource, listOpts)

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

// Patch applies the patch and returns the patched clusterRelocate.
func (c *FakeClusterRelocates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *hivev1.ClusterRelocate, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootPatchSubresourceAction(clusterrelocatesResource, name, pt, data, subresources...), &hivev1.ClusterRelocate{})
	if obj == nil {
		return nil, err
	}
	return obj.(*hivev1.ClusterRelocate), err
}
