blob: f45777c232cfb16eab13f0bbc3c3a9921fbfa23e [file] [log] [blame]
Matteo Scandoloa4285862020-12-01 18:10:10 -08001/*
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 "context"
23 "time"
24
25 v1beta1 "k8s.io/api/rbac/v1beta1"
26 v1 "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/kubernetes/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(ctx context.Context, clusterRoleBinding *v1beta1.ClusterRoleBinding, opts v1.CreateOptions) (*v1beta1.ClusterRoleBinding, error)
42 Update(ctx context.Context, clusterRoleBinding *v1beta1.ClusterRoleBinding, opts v1.UpdateOptions) (*v1beta1.ClusterRoleBinding, error)
43 Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
44 DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
45 Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.ClusterRoleBinding, error)
46 List(ctx context.Context, opts v1.ListOptions) (*v1beta1.ClusterRoleBindingList, error)
47 Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
48 Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.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 *RbacV1beta1Client) *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(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ClusterRoleBinding, err error) {
66 result = &v1beta1.ClusterRoleBinding{}
67 err = c.client.Get().
68 Resource("clusterrolebindings").
69 Name(name).
70 VersionedParams(&options, scheme.ParameterCodec).
71 Do(ctx).
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(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ClusterRoleBindingList, err error) {
78 var timeout time.Duration
79 if opts.TimeoutSeconds != nil {
80 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
81 }
82 result = &v1beta1.ClusterRoleBindingList{}
83 err = c.client.Get().
84 Resource("clusterrolebindings").
85 VersionedParams(&opts, scheme.ParameterCodec).
86 Timeout(timeout).
87 Do(ctx).
88 Into(result)
89 return
90}
91
92// Watch returns a watch.Interface that watches the requested clusterRoleBindings.
93func (c *clusterRoleBindings) Watch(ctx context.Context, opts v1.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(ctx)
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(ctx context.Context, clusterRoleBinding *v1beta1.ClusterRoleBinding, opts v1.CreateOptions) (result *v1beta1.ClusterRoleBinding, err error) {
108 result = &v1beta1.ClusterRoleBinding{}
109 err = c.client.Post().
110 Resource("clusterrolebindings").
111 VersionedParams(&opts, scheme.ParameterCodec).
112 Body(clusterRoleBinding).
113 Do(ctx).
114 Into(result)
115 return
116}
117
118// 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.
119func (c *clusterRoleBindings) Update(ctx context.Context, clusterRoleBinding *v1beta1.ClusterRoleBinding, opts v1.UpdateOptions) (result *v1beta1.ClusterRoleBinding, err error) {
120 result = &v1beta1.ClusterRoleBinding{}
121 err = c.client.Put().
122 Resource("clusterrolebindings").
123 Name(clusterRoleBinding.Name).
124 VersionedParams(&opts, scheme.ParameterCodec).
125 Body(clusterRoleBinding).
126 Do(ctx).
127 Into(result)
128 return
129}
130
131// Delete takes name of the clusterRoleBinding and deletes it. Returns an error if one occurs.
132func (c *clusterRoleBindings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
133 return c.client.Delete().
134 Resource("clusterrolebindings").
135 Name(name).
136 Body(&opts).
137 Do(ctx).
138 Error()
139}
140
141// DeleteCollection deletes a collection of objects.
142func (c *clusterRoleBindings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
143 var timeout time.Duration
144 if listOpts.TimeoutSeconds != nil {
145 timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
146 }
147 return c.client.Delete().
148 Resource("clusterrolebindings").
149 VersionedParams(&listOpts, scheme.ParameterCodec).
150 Timeout(timeout).
151 Body(&opts).
152 Do(ctx).
153 Error()
154}
155
156// Patch applies the patch and returns the patched clusterRoleBinding.
157func (c *clusterRoleBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ClusterRoleBinding, err error) {
158 result = &v1beta1.ClusterRoleBinding{}
159 err = c.client.Patch(pt).
160 Resource("clusterrolebindings").
161 Name(name).
162 SubResource(subresources...).
163 VersionedParams(&opts, scheme.ParameterCodec).
164 Body(data).
165 Do(ctx).
166 Into(result)
167 return
168}