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

package fake

import (
	"context"

	v1alpha1 "github.com/open-cluster-management/submariner-addon/pkg/apis/submarinerconfig/v1alpha1"
	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"
)

// FakeSubmarinerConfigs implements SubmarinerConfigInterface
type FakeSubmarinerConfigs struct {
	Fake *FakeSubmarineraddonV1alpha1
	ns   string
}

var submarinerconfigsResource = schema.GroupVersionResource{Group: "submarineraddon.open-cluster-management.io", Version: "v1alpha1", Resource: "submarinerconfigs"}

var submarinerconfigsKind = schema.GroupVersionKind{Group: "submarineraddon.open-cluster-management.io", Version: "v1alpha1", Kind: "SubmarinerConfig"}

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

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.SubmarinerConfig), err
}

// List takes label and field selectors, and returns the list of SubmarinerConfigs that match those selectors.
func (c *FakeSubmarinerConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SubmarinerConfigList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewListAction(submarinerconfigsResource, submarinerconfigsKind, c.ns, opts), &v1alpha1.SubmarinerConfigList{})

	if obj == nil {
		return nil, err
	}

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

}

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

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.SubmarinerConfig), err
}

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

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.SubmarinerConfig), 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 *FakeSubmarinerConfigs) UpdateStatus(ctx context.Context, submarinerConfig *v1alpha1.SubmarinerConfig, opts v1.UpdateOptions) (*v1alpha1.SubmarinerConfig, error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateSubresourceAction(submarinerconfigsResource, "status", c.ns, submarinerConfig), &v1alpha1.SubmarinerConfig{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.SubmarinerConfig), err
}

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

	return err
}

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

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

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

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.SubmarinerConfig), err
}
