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

// FakeOpenShiftAPIServers implements OpenShiftAPIServerInterface
type FakeOpenShiftAPIServers struct {
	Fake *FakeOperatorV1
}

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

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

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

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

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

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

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

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

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

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

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