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

package fake

import (
	"context"

	sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/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"
)

// FakeSriovOperatorConfigs implements SriovOperatorConfigInterface
type FakeSriovOperatorConfigs struct {
	Fake *FakeSriovnetworkV1
	ns   string
}

var sriovoperatorconfigsResource = schema.GroupVersionResource{Group: "sriovnetwork", Version: "v1", Resource: "sriovoperatorconfigs"}

var sriovoperatorconfigsKind = schema.GroupVersionKind{Group: "sriovnetwork", Version: "v1", Kind: "SriovOperatorConfig"}

// Get takes name of the sriovOperatorConfig, and returns the corresponding sriovOperatorConfig object, and an error if there is any.
func (c *FakeSriovOperatorConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *sriovnetworkv1.SriovOperatorConfig, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewGetAction(sriovoperatorconfigsResource, c.ns, name), &sriovnetworkv1.SriovOperatorConfig{})

	if obj == nil {
		return nil, err
	}
	return obj.(*sriovnetworkv1.SriovOperatorConfig), err
}

// List takes label and field selectors, and returns the list of SriovOperatorConfigs that match those selectors.
func (c *FakeSriovOperatorConfigs) List(ctx context.Context, opts v1.ListOptions) (result *sriovnetworkv1.SriovOperatorConfigList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewListAction(sriovoperatorconfigsResource, sriovoperatorconfigsKind, c.ns, opts), &sriovnetworkv1.SriovOperatorConfigList{})

	if obj == nil {
		return nil, err
	}

	label, _, _ := testing.ExtractFromListOptions(opts)
	if label == nil {
		label = labels.Everything()
	}
	list := &sriovnetworkv1.SriovOperatorConfigList{ListMeta: obj.(*sriovnetworkv1.SriovOperatorConfigList).ListMeta}
	for _, item := range obj.(*sriovnetworkv1.SriovOperatorConfigList).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 sriovOperatorConfigs.
func (c *FakeSriovOperatorConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
	return c.Fake.
		InvokesWatch(testing.NewWatchAction(sriovoperatorconfigsResource, c.ns, opts))

}

// Create takes the representation of a sriovOperatorConfig and creates it.  Returns the server's representation of the sriovOperatorConfig, and an error, if there is any.
func (c *FakeSriovOperatorConfigs) Create(ctx context.Context, sriovOperatorConfig *sriovnetworkv1.SriovOperatorConfig, opts v1.CreateOptions) (result *sriovnetworkv1.SriovOperatorConfig, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(sriovoperatorconfigsResource, c.ns, sriovOperatorConfig), &sriovnetworkv1.SriovOperatorConfig{})

	if obj == nil {
		return nil, err
	}
	return obj.(*sriovnetworkv1.SriovOperatorConfig), err
}

// Update takes the representation of a sriovOperatorConfig and updates it. Returns the server's representation of the sriovOperatorConfig, and an error, if there is any.
func (c *FakeSriovOperatorConfigs) Update(ctx context.Context, sriovOperatorConfig *sriovnetworkv1.SriovOperatorConfig, opts v1.UpdateOptions) (result *sriovnetworkv1.SriovOperatorConfig, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateAction(sriovoperatorconfigsResource, c.ns, sriovOperatorConfig), &sriovnetworkv1.SriovOperatorConfig{})

	if obj == nil {
		return nil, err
	}
	return obj.(*sriovnetworkv1.SriovOperatorConfig), 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 *FakeSriovOperatorConfigs) UpdateStatus(ctx context.Context, sriovOperatorConfig *sriovnetworkv1.SriovOperatorConfig, opts v1.UpdateOptions) (*sriovnetworkv1.SriovOperatorConfig, error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateSubresourceAction(sriovoperatorconfigsResource, "status", c.ns, sriovOperatorConfig), &sriovnetworkv1.SriovOperatorConfig{})

	if obj == nil {
		return nil, err
	}
	return obj.(*sriovnetworkv1.SriovOperatorConfig), err
}

// Delete takes name of the sriovOperatorConfig and deletes it. Returns an error if one occurs.
func (c *FakeSriovOperatorConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteAction(sriovoperatorconfigsResource, c.ns, name), &sriovnetworkv1.SriovOperatorConfig{})

	return err
}

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

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

// Patch applies the patch and returns the patched sriovOperatorConfig.
func (c *FakeSriovOperatorConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *sriovnetworkv1.SriovOperatorConfig, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewPatchSubresourceAction(sriovoperatorconfigsResource, c.ns, name, pt, data, subresources...), &sriovnetworkv1.SriovOperatorConfig{})

	if obj == nil {
		return nil, err
	}
	return obj.(*sriovnetworkv1.SriovOperatorConfig), err
}
