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

package fake

import (
	operator_v1 "github.com/openshift/api/operator/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"
)

// FakeServiceCatalogAPIServers implements ServiceCatalogAPIServerInterface
type FakeServiceCatalogAPIServers struct {
	Fake *FakeOperatorV1
}

var servicecatalogapiserversResource = schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "servicecatalogapiservers"}

var servicecatalogapiserversKind = schema.GroupVersionKind{Group: "operator.openshift.io", Version: "v1", Kind: "ServiceCatalogAPIServer"}

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

// List takes label and field selectors, and returns the list of ServiceCatalogAPIServers that match those selectors.
func (c *FakeServiceCatalogAPIServers) List(opts v1.ListOptions) (result *operator_v1.ServiceCatalogAPIServerList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootListAction(servicecatalogapiserversResource, servicecatalogapiserversKind, opts), &operator_v1.ServiceCatalogAPIServerList{})
	if obj == nil {
		return nil, err
	}

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

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

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

// Delete takes name of the serviceCatalogAPIServer and deletes it. Returns an error if one occurs.
func (c *FakeServiceCatalogAPIServers) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewRootDeleteAction(servicecatalogapiserversResource, name), &operator_v1.ServiceCatalogAPIServer{})
	return err
}

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

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

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