1/*
2Copyright The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8    http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17// Code generated by client-gen. DO NOT EDIT.
18
19package v1beta1
20
21import (
22	v1beta1 "k8s.io/api/rbac/v1beta1"
23	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24	types "k8s.io/apimachinery/pkg/types"
25	watch "k8s.io/apimachinery/pkg/watch"
26	scheme "k8s.io/client-go/kubernetes/scheme"
27	rest "k8s.io/client-go/rest"
28)
29
30// ClusterRoleBindingsGetter has a method to return a ClusterRoleBindingInterface.
31// A group's client should implement this interface.
32type ClusterRoleBindingsGetter interface {
33	ClusterRoleBindings() ClusterRoleBindingInterface
34}
35
36// ClusterRoleBindingInterface has methods to work with ClusterRoleBinding resources.
37type ClusterRoleBindingInterface interface {
38	Create(*v1beta1.ClusterRoleBinding) (*v1beta1.ClusterRoleBinding, error)
39	Update(*v1beta1.ClusterRoleBinding) (*v1beta1.ClusterRoleBinding, error)
40	Delete(name string, options *v1.DeleteOptions) error
41	DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
42	Get(name string, options v1.GetOptions) (*v1beta1.ClusterRoleBinding, error)
43	List(opts v1.ListOptions) (*v1beta1.ClusterRoleBindingList, error)
44	Watch(opts v1.ListOptions) (watch.Interface, error)
45	Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ClusterRoleBinding, err error)
46	ClusterRoleBindingExpansion
47}
48
49// clusterRoleBindings implements ClusterRoleBindingInterface
50type clusterRoleBindings struct {
51	client rest.Interface
52}
53
54// newClusterRoleBindings returns a ClusterRoleBindings
55func newClusterRoleBindings(c *RbacV1beta1Client) *clusterRoleBindings {
56	return &clusterRoleBindings{
57		client: c.RESTClient(),
58	}
59}
60
61// Get takes name of the clusterRoleBinding, and returns the corresponding clusterRoleBinding object, and an error if there is any.
62func (c *clusterRoleBindings) Get(name string, options v1.GetOptions) (result *v1beta1.ClusterRoleBinding, err error) {
63	result = &v1beta1.ClusterRoleBinding{}
64	err = c.client.Get().
65		Resource("clusterrolebindings").
66		Name(name).
67		VersionedParams(&options, scheme.ParameterCodec).
68		Do().
69		Into(result)
70	return
71}
72
73// List takes label and field selectors, and returns the list of ClusterRoleBindings that match those selectors.
74func (c *clusterRoleBindings) List(opts v1.ListOptions) (result *v1beta1.ClusterRoleBindingList, err error) {
75	result = &v1beta1.ClusterRoleBindingList{}
76	err = c.client.Get().
77		Resource("clusterrolebindings").
78		VersionedParams(&opts, scheme.ParameterCodec).
79		Do().
80		Into(result)
81	return
82}
83
84// Watch returns a watch.Interface that watches the requested clusterRoleBindings.
85func (c *clusterRoleBindings) Watch(opts v1.ListOptions) (watch.Interface, error) {
86	opts.Watch = true
87	return c.client.Get().
88		Resource("clusterrolebindings").
89		VersionedParams(&opts, scheme.ParameterCodec).
90		Watch()
91}
92
93// Create takes the representation of a clusterRoleBinding and creates it.  Returns the server's representation of the clusterRoleBinding, and an error, if there is any.
94func (c *clusterRoleBindings) Create(clusterRoleBinding *v1beta1.ClusterRoleBinding) (result *v1beta1.ClusterRoleBinding, err error) {
95	result = &v1beta1.ClusterRoleBinding{}
96	err = c.client.Post().
97		Resource("clusterrolebindings").
98		Body(clusterRoleBinding).
99		Do().
100		Into(result)
101	return
102}
103
104// Update takes the representation of a clusterRoleBinding and updates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any.
105func (c *clusterRoleBindings) Update(clusterRoleBinding *v1beta1.ClusterRoleBinding) (result *v1beta1.ClusterRoleBinding, err error) {
106	result = &v1beta1.ClusterRoleBinding{}
107	err = c.client.Put().
108		Resource("clusterrolebindings").
109		Name(clusterRoleBinding.Name).
110		Body(clusterRoleBinding).
111		Do().
112		Into(result)
113	return
114}
115
116// Delete takes name of the clusterRoleBinding and deletes it. Returns an error if one occurs.
117func (c *clusterRoleBindings) Delete(name string, options *v1.DeleteOptions) error {
118	return c.client.Delete().
119		Resource("clusterrolebindings").
120		Name(name).
121		Body(options).
122		Do().
123		Error()
124}
125
126// DeleteCollection deletes a collection of objects.
127func (c *clusterRoleBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
128	return c.client.Delete().
129		Resource("clusterrolebindings").
130		VersionedParams(&listOptions, scheme.ParameterCodec).
131		Body(options).
132		Do().
133		Error()
134}
135
136// Patch applies the patch and returns the patched clusterRoleBinding.
137func (c *clusterRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ClusterRoleBinding, err error) {
138	result = &v1beta1.ClusterRoleBinding{}
139	err = c.client.Patch(pt).
140		Resource("clusterrolebindings").
141		SubResource(subresources...).
142		Name(name).
143		Body(data).
144		Do().
145		Into(result)
146	return
147}
148