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

package fake

import (
	machineconfigurationopenshiftiov1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/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"
)

// FakeMCOConfigs implements MCOConfigInterface
type FakeMCOConfigs struct {
	Fake *FakeMachineconfigurationV1
	ns   string
}

var mcoconfigsResource = schema.GroupVersionResource{Group: "machineconfiguration.openshift.io", Version: "v1", Resource: "mcoconfigs"}

var mcoconfigsKind = schema.GroupVersionKind{Group: "machineconfiguration.openshift.io", Version: "v1", Kind: "MCOConfig"}

// Get takes name of the mCOConfig, and returns the corresponding mCOConfig object, and an error if there is any.
func (c *FakeMCOConfigs) Get(name string, options v1.GetOptions) (result *machineconfigurationopenshiftiov1.MCOConfig, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewGetAction(mcoconfigsResource, c.ns, name), &machineconfigurationopenshiftiov1.MCOConfig{})

	if obj == nil {
		return nil, err
	}
	return obj.(*machineconfigurationopenshiftiov1.MCOConfig), err
}

// List takes label and field selectors, and returns the list of MCOConfigs that match those selectors.
func (c *FakeMCOConfigs) List(opts v1.ListOptions) (result *machineconfigurationopenshiftiov1.MCOConfigList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewListAction(mcoconfigsResource, mcoconfigsKind, c.ns, opts), &machineconfigurationopenshiftiov1.MCOConfigList{})

	if obj == nil {
		return nil, err
	}

	label, _, _ := testing.ExtractFromListOptions(opts)
	if label == nil {
		label = labels.Everything()
	}
	list := &machineconfigurationopenshiftiov1.MCOConfigList{ListMeta: obj.(*machineconfigurationopenshiftiov1.MCOConfigList).ListMeta}
	for _, item := range obj.(*machineconfigurationopenshiftiov1.MCOConfigList).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 mCOConfigs.
func (c *FakeMCOConfigs) Watch(opts v1.ListOptions) (watch.Interface, error) {
	return c.Fake.
		InvokesWatch(testing.NewWatchAction(mcoconfigsResource, c.ns, opts))

}

// Create takes the representation of a mCOConfig and creates it.  Returns the server's representation of the mCOConfig, and an error, if there is any.
func (c *FakeMCOConfigs) Create(mCOConfig *machineconfigurationopenshiftiov1.MCOConfig) (result *machineconfigurationopenshiftiov1.MCOConfig, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(mcoconfigsResource, c.ns, mCOConfig), &machineconfigurationopenshiftiov1.MCOConfig{})

	if obj == nil {
		return nil, err
	}
	return obj.(*machineconfigurationopenshiftiov1.MCOConfig), err
}

// Update takes the representation of a mCOConfig and updates it. Returns the server's representation of the mCOConfig, and an error, if there is any.
func (c *FakeMCOConfigs) Update(mCOConfig *machineconfigurationopenshiftiov1.MCOConfig) (result *machineconfigurationopenshiftiov1.MCOConfig, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateAction(mcoconfigsResource, c.ns, mCOConfig), &machineconfigurationopenshiftiov1.MCOConfig{})

	if obj == nil {
		return nil, err
	}
	return obj.(*machineconfigurationopenshiftiov1.MCOConfig), err
}

// Delete takes name of the mCOConfig and deletes it. Returns an error if one occurs.
func (c *FakeMCOConfigs) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteAction(mcoconfigsResource, c.ns, name), &machineconfigurationopenshiftiov1.MCOConfig{})

	return err
}

// DeleteCollection deletes a collection of objects.
func (c *FakeMCOConfigs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
	action := testing.NewDeleteCollectionAction(mcoconfigsResource, c.ns, listOptions)

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

// Patch applies the patch and returns the patched mCOConfig.
func (c *FakeMCOConfigs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *machineconfigurationopenshiftiov1.MCOConfig, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewPatchSubresourceAction(mcoconfigsResource, c.ns, name, pt, data, subresources...), &machineconfigurationopenshiftiov1.MCOConfig{})

	if obj == nil {
		return nil, err
	}
	return obj.(*machineconfigurationopenshiftiov1.MCOConfig), err
}
