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 v1 20 21import ( 22 "context" 23 "time" 24 25 v1 "k8s.io/api/rbac/v1" 26 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 types "k8s.io/apimachinery/pkg/types" 28 watch "k8s.io/apimachinery/pkg/watch" 29 scheme "k8s.io/client-go/deprecated/scheme" 30 rest "k8s.io/client-go/rest" 31) 32 33// ClusterRoleBindingsGetter has a method to return a ClusterRoleBindingInterface. 34// A group's client should implement this interface. 35type ClusterRoleBindingsGetter interface { 36 ClusterRoleBindings() ClusterRoleBindingInterface 37} 38 39// ClusterRoleBindingInterface has methods to work with ClusterRoleBinding resources. 40type ClusterRoleBindingInterface interface { 41 Create(*v1.ClusterRoleBinding) (*v1.ClusterRoleBinding, error) 42 Update(*v1.ClusterRoleBinding) (*v1.ClusterRoleBinding, error) 43 Delete(name string, options *metav1.DeleteOptions) error 44 DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error 45 Get(name string, options metav1.GetOptions) (*v1.ClusterRoleBinding, error) 46 List(opts metav1.ListOptions) (*v1.ClusterRoleBindingList, error) 47 Watch(opts metav1.ListOptions) (watch.Interface, error) 48 Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterRoleBinding, err error) 49 ClusterRoleBindingExpansion 50} 51 52// clusterRoleBindings implements ClusterRoleBindingInterface 53type clusterRoleBindings struct { 54 client rest.Interface 55} 56 57// newClusterRoleBindings returns a ClusterRoleBindings 58func newClusterRoleBindings(c *RbacV1Client) *clusterRoleBindings { 59 return &clusterRoleBindings{ 60 client: c.RESTClient(), 61 } 62} 63 64// Get takes name of the clusterRoleBinding, and returns the corresponding clusterRoleBinding object, and an error if there is any. 65func (c *clusterRoleBindings) Get(name string, options metav1.GetOptions) (result *v1.ClusterRoleBinding, err error) { 66 result = &v1.ClusterRoleBinding{} 67 err = c.client.Get(). 68 Resource("clusterrolebindings"). 69 Name(name). 70 VersionedParams(&options, scheme.ParameterCodec). 71 Do(context.TODO()). 72 Into(result) 73 return 74} 75 76// List takes label and field selectors, and returns the list of ClusterRoleBindings that match those selectors. 77func (c *clusterRoleBindings) List(opts metav1.ListOptions) (result *v1.ClusterRoleBindingList, err error) { 78 var timeout time.Duration 79 if opts.TimeoutSeconds != nil { 80 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second 81 } 82 result = &v1.ClusterRoleBindingList{} 83 err = c.client.Get(). 84 Resource("clusterrolebindings"). 85 VersionedParams(&opts, scheme.ParameterCodec). 86 Timeout(timeout). 87 Do(context.TODO()). 88 Into(result) 89 return 90} 91 92// Watch returns a watch.Interface that watches the requested clusterRoleBindings. 93func (c *clusterRoleBindings) Watch(opts metav1.ListOptions) (watch.Interface, error) { 94 var timeout time.Duration 95 if opts.TimeoutSeconds != nil { 96 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second 97 } 98 opts.Watch = true 99 return c.client.Get(). 100 Resource("clusterrolebindings"). 101 VersionedParams(&opts, scheme.ParameterCodec). 102 Timeout(timeout). 103 Watch(context.TODO()) 104} 105 106// 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. 107func (c *clusterRoleBindings) Create(clusterRoleBinding *v1.ClusterRoleBinding) (result *v1.ClusterRoleBinding, err error) { 108 result = &v1.ClusterRoleBinding{} 109 err = c.client.Post(). 110 Resource("clusterrolebindings"). 111 Body(clusterRoleBinding). 112 Do(context.TODO()). 113 Into(result) 114 return 115} 116 117// 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. 118func (c *clusterRoleBindings) Update(clusterRoleBinding *v1.ClusterRoleBinding) (result *v1.ClusterRoleBinding, err error) { 119 result = &v1.ClusterRoleBinding{} 120 err = c.client.Put(). 121 Resource("clusterrolebindings"). 122 Name(clusterRoleBinding.Name). 123 Body(clusterRoleBinding). 124 Do(context.TODO()). 125 Into(result) 126 return 127} 128 129// Delete takes name of the clusterRoleBinding and deletes it. Returns an error if one occurs. 130func (c *clusterRoleBindings) Delete(name string, options *metav1.DeleteOptions) error { 131 return c.client.Delete(). 132 Resource("clusterrolebindings"). 133 Name(name). 134 Body(options). 135 Do(context.TODO()). 136 Error() 137} 138 139// DeleteCollection deletes a collection of objects. 140func (c *clusterRoleBindings) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { 141 var timeout time.Duration 142 if listOptions.TimeoutSeconds != nil { 143 timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second 144 } 145 return c.client.Delete(). 146 Resource("clusterrolebindings"). 147 VersionedParams(&listOptions, scheme.ParameterCodec). 148 Timeout(timeout). 149 Body(options). 150 Do(context.TODO()). 151 Error() 152} 153 154// Patch applies the patch and returns the patched clusterRoleBinding. 155func (c *clusterRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterRoleBinding, err error) { 156 result = &v1.ClusterRoleBinding{} 157 err = c.client.Patch(pt). 158 Resource("clusterrolebindings"). 159 SubResource(subresources...). 160 Name(name). 161 Body(data). 162 Do(context.TODO()). 163 Into(result) 164 return 165} 166