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

package fake

import (
	v1alpha2 "istio.io/client-go/pkg/apis/config/v1alpha2"
	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"
)

// FakeHTTPAPISpecBindings implements HTTPAPISpecBindingInterface
type FakeHTTPAPISpecBindings struct {
	Fake *FakeConfigV1alpha2
	ns   string
}

var httpapispecbindingsResource = schema.GroupVersionResource{Group: "config", Version: "v1alpha2", Resource: "httpapispecbindings"}

var httpapispecbindingsKind = schema.GroupVersionKind{Group: "config", Version: "v1alpha2", Kind: "HTTPAPISpecBinding"}

// Get takes name of the hTTPAPISpecBinding, and returns the corresponding hTTPAPISpecBinding object, and an error if there is any.
func (c *FakeHTTPAPISpecBindings) Get(name string, options v1.GetOptions) (result *v1alpha2.HTTPAPISpecBinding, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewGetAction(httpapispecbindingsResource, c.ns, name), &v1alpha2.HTTPAPISpecBinding{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha2.HTTPAPISpecBinding), err
}

// List takes label and field selectors, and returns the list of HTTPAPISpecBindings that match those selectors.
func (c *FakeHTTPAPISpecBindings) List(opts v1.ListOptions) (result *v1alpha2.HTTPAPISpecBindingList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewListAction(httpapispecbindingsResource, httpapispecbindingsKind, c.ns, opts), &v1alpha2.HTTPAPISpecBindingList{})

	if obj == nil {
		return nil, err
	}

	label, _, _ := testing.ExtractFromListOptions(opts)
	if label == nil {
		label = labels.Everything()
	}
	list := &v1alpha2.HTTPAPISpecBindingList{ListMeta: obj.(*v1alpha2.HTTPAPISpecBindingList).ListMeta}
	for _, item := range obj.(*v1alpha2.HTTPAPISpecBindingList).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 hTTPAPISpecBindings.
func (c *FakeHTTPAPISpecBindings) Watch(opts v1.ListOptions) (watch.Interface, error) {
	return c.Fake.
		InvokesWatch(testing.NewWatchAction(httpapispecbindingsResource, c.ns, opts))

}

// Create takes the representation of a hTTPAPISpecBinding and creates it.  Returns the server's representation of the hTTPAPISpecBinding, and an error, if there is any.
func (c *FakeHTTPAPISpecBindings) Create(hTTPAPISpecBinding *v1alpha2.HTTPAPISpecBinding) (result *v1alpha2.HTTPAPISpecBinding, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(httpapispecbindingsResource, c.ns, hTTPAPISpecBinding), &v1alpha2.HTTPAPISpecBinding{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha2.HTTPAPISpecBinding), err
}

// Update takes the representation of a hTTPAPISpecBinding and updates it. Returns the server's representation of the hTTPAPISpecBinding, and an error, if there is any.
func (c *FakeHTTPAPISpecBindings) Update(hTTPAPISpecBinding *v1alpha2.HTTPAPISpecBinding) (result *v1alpha2.HTTPAPISpecBinding, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateAction(httpapispecbindingsResource, c.ns, hTTPAPISpecBinding), &v1alpha2.HTTPAPISpecBinding{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha2.HTTPAPISpecBinding), err
}

// Delete takes name of the hTTPAPISpecBinding and deletes it. Returns an error if one occurs.
func (c *FakeHTTPAPISpecBindings) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteAction(httpapispecbindingsResource, c.ns, name), &v1alpha2.HTTPAPISpecBinding{})

	return err
}

// DeleteCollection deletes a collection of objects.
func (c *FakeHTTPAPISpecBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
	action := testing.NewDeleteCollectionAction(httpapispecbindingsResource, c.ns, listOptions)

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

// Patch applies the patch and returns the patched hTTPAPISpecBinding.
func (c *FakeHTTPAPISpecBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.HTTPAPISpecBinding, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewPatchSubresourceAction(httpapispecbindingsResource, c.ns, name, pt, data, subresources...), &v1alpha2.HTTPAPISpecBinding{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha2.HTTPAPISpecBinding), err
}
