// 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"
)

// FakeKubeletConfigs implements KubeletConfigInterface
type FakeKubeletConfigs struct {
	Fake *FakeMachineconfigurationV1
}

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

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

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

// List takes label and field selectors, and returns the list of KubeletConfigs that match those selectors.
func (c *FakeKubeletConfigs) List(opts v1.ListOptions) (result *machineconfigurationopenshiftiov1.KubeletConfigList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootListAction(kubeletconfigsResource, kubeletconfigsKind, opts), &machineconfigurationopenshiftiov1.KubeletConfigList{})
	if obj == nil {
		return nil, err
	}

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

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

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

// Delete takes name of the kubeletConfig and deletes it. Returns an error if one occurs.
func (c *FakeKubeletConfigs) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewRootDeleteAction(kubeletconfigsResource, name), &machineconfigurationopenshiftiov1.KubeletConfig{})
	return err
}

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

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

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