Matteo Scandolo | a428586 | 2020-12-01 18:10:10 -0800 | [diff] [blame^] | 1 | /* |
| 2 | Copyright The Kubernetes Authors. |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | // Code generated by client-gen. DO NOT EDIT. |
| 18 | |
| 19 | package v1 |
| 20 | |
| 21 | import ( |
| 22 | "context" |
| 23 | "time" |
| 24 | |
| 25 | authenticationv1 "k8s.io/api/authentication/v1" |
| 26 | v1 "k8s.io/api/core/v1" |
| 27 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 28 | types "k8s.io/apimachinery/pkg/types" |
| 29 | watch "k8s.io/apimachinery/pkg/watch" |
| 30 | scheme "k8s.io/client-go/kubernetes/scheme" |
| 31 | rest "k8s.io/client-go/rest" |
| 32 | ) |
| 33 | |
| 34 | // ServiceAccountsGetter has a method to return a ServiceAccountInterface. |
| 35 | // A group's client should implement this interface. |
| 36 | type ServiceAccountsGetter interface { |
| 37 | ServiceAccounts(namespace string) ServiceAccountInterface |
| 38 | } |
| 39 | |
| 40 | // ServiceAccountInterface has methods to work with ServiceAccount resources. |
| 41 | type ServiceAccountInterface interface { |
| 42 | Create(ctx context.Context, serviceAccount *v1.ServiceAccount, opts metav1.CreateOptions) (*v1.ServiceAccount, error) |
| 43 | Update(ctx context.Context, serviceAccount *v1.ServiceAccount, opts metav1.UpdateOptions) (*v1.ServiceAccount, error) |
| 44 | Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error |
| 45 | DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error |
| 46 | Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ServiceAccount, error) |
| 47 | List(ctx context.Context, opts metav1.ListOptions) (*v1.ServiceAccountList, error) |
| 48 | Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) |
| 49 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ServiceAccount, err error) |
| 50 | CreateToken(ctx context.Context, serviceAccountName string, tokenRequest *authenticationv1.TokenRequest, opts metav1.CreateOptions) (*authenticationv1.TokenRequest, error) |
| 51 | |
| 52 | ServiceAccountExpansion |
| 53 | } |
| 54 | |
| 55 | // serviceAccounts implements ServiceAccountInterface |
| 56 | type serviceAccounts struct { |
| 57 | client rest.Interface |
| 58 | ns string |
| 59 | } |
| 60 | |
| 61 | // newServiceAccounts returns a ServiceAccounts |
| 62 | func newServiceAccounts(c *CoreV1Client, namespace string) *serviceAccounts { |
| 63 | return &serviceAccounts{ |
| 64 | client: c.RESTClient(), |
| 65 | ns: namespace, |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | // Get takes name of the serviceAccount, and returns the corresponding serviceAccount object, and an error if there is any. |
| 70 | func (c *serviceAccounts) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ServiceAccount, err error) { |
| 71 | result = &v1.ServiceAccount{} |
| 72 | err = c.client.Get(). |
| 73 | Namespace(c.ns). |
| 74 | Resource("serviceaccounts"). |
| 75 | Name(name). |
| 76 | VersionedParams(&options, scheme.ParameterCodec). |
| 77 | Do(ctx). |
| 78 | Into(result) |
| 79 | return |
| 80 | } |
| 81 | |
| 82 | // List takes label and field selectors, and returns the list of ServiceAccounts that match those selectors. |
| 83 | func (c *serviceAccounts) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ServiceAccountList, err error) { |
| 84 | var timeout time.Duration |
| 85 | if opts.TimeoutSeconds != nil { |
| 86 | timeout = time.Duration(*opts.TimeoutSeconds) * time.Second |
| 87 | } |
| 88 | result = &v1.ServiceAccountList{} |
| 89 | err = c.client.Get(). |
| 90 | Namespace(c.ns). |
| 91 | Resource("serviceaccounts"). |
| 92 | VersionedParams(&opts, scheme.ParameterCodec). |
| 93 | Timeout(timeout). |
| 94 | Do(ctx). |
| 95 | Into(result) |
| 96 | return |
| 97 | } |
| 98 | |
| 99 | // Watch returns a watch.Interface that watches the requested serviceAccounts. |
| 100 | func (c *serviceAccounts) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { |
| 101 | var timeout time.Duration |
| 102 | if opts.TimeoutSeconds != nil { |
| 103 | timeout = time.Duration(*opts.TimeoutSeconds) * time.Second |
| 104 | } |
| 105 | opts.Watch = true |
| 106 | return c.client.Get(). |
| 107 | Namespace(c.ns). |
| 108 | Resource("serviceaccounts"). |
| 109 | VersionedParams(&opts, scheme.ParameterCodec). |
| 110 | Timeout(timeout). |
| 111 | Watch(ctx) |
| 112 | } |
| 113 | |
| 114 | // Create takes the representation of a serviceAccount and creates it. Returns the server's representation of the serviceAccount, and an error, if there is any. |
| 115 | func (c *serviceAccounts) Create(ctx context.Context, serviceAccount *v1.ServiceAccount, opts metav1.CreateOptions) (result *v1.ServiceAccount, err error) { |
| 116 | result = &v1.ServiceAccount{} |
| 117 | err = c.client.Post(). |
| 118 | Namespace(c.ns). |
| 119 | Resource("serviceaccounts"). |
| 120 | VersionedParams(&opts, scheme.ParameterCodec). |
| 121 | Body(serviceAccount). |
| 122 | Do(ctx). |
| 123 | Into(result) |
| 124 | return |
| 125 | } |
| 126 | |
| 127 | // Update takes the representation of a serviceAccount and updates it. Returns the server's representation of the serviceAccount, and an error, if there is any. |
| 128 | func (c *serviceAccounts) Update(ctx context.Context, serviceAccount *v1.ServiceAccount, opts metav1.UpdateOptions) (result *v1.ServiceAccount, err error) { |
| 129 | result = &v1.ServiceAccount{} |
| 130 | err = c.client.Put(). |
| 131 | Namespace(c.ns). |
| 132 | Resource("serviceaccounts"). |
| 133 | Name(serviceAccount.Name). |
| 134 | VersionedParams(&opts, scheme.ParameterCodec). |
| 135 | Body(serviceAccount). |
| 136 | Do(ctx). |
| 137 | Into(result) |
| 138 | return |
| 139 | } |
| 140 | |
| 141 | // Delete takes name of the serviceAccount and deletes it. Returns an error if one occurs. |
| 142 | func (c *serviceAccounts) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { |
| 143 | return c.client.Delete(). |
| 144 | Namespace(c.ns). |
| 145 | Resource("serviceaccounts"). |
| 146 | Name(name). |
| 147 | Body(&opts). |
| 148 | Do(ctx). |
| 149 | Error() |
| 150 | } |
| 151 | |
| 152 | // DeleteCollection deletes a collection of objects. |
| 153 | func (c *serviceAccounts) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { |
| 154 | var timeout time.Duration |
| 155 | if listOpts.TimeoutSeconds != nil { |
| 156 | timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second |
| 157 | } |
| 158 | return c.client.Delete(). |
| 159 | Namespace(c.ns). |
| 160 | Resource("serviceaccounts"). |
| 161 | VersionedParams(&listOpts, scheme.ParameterCodec). |
| 162 | Timeout(timeout). |
| 163 | Body(&opts). |
| 164 | Do(ctx). |
| 165 | Error() |
| 166 | } |
| 167 | |
| 168 | // Patch applies the patch and returns the patched serviceAccount. |
| 169 | func (c *serviceAccounts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ServiceAccount, err error) { |
| 170 | result = &v1.ServiceAccount{} |
| 171 | err = c.client.Patch(pt). |
| 172 | Namespace(c.ns). |
| 173 | Resource("serviceaccounts"). |
| 174 | Name(name). |
| 175 | SubResource(subresources...). |
| 176 | VersionedParams(&opts, scheme.ParameterCodec). |
| 177 | Body(data). |
| 178 | Do(ctx). |
| 179 | Into(result) |
| 180 | return |
| 181 | } |
| 182 | |
| 183 | // CreateToken takes the representation of a tokenRequest and creates it. Returns the server's representation of the tokenRequest, and an error, if there is any. |
| 184 | func (c *serviceAccounts) CreateToken(ctx context.Context, serviceAccountName string, tokenRequest *authenticationv1.TokenRequest, opts metav1.CreateOptions) (result *authenticationv1.TokenRequest, err error) { |
| 185 | result = &authenticationv1.TokenRequest{} |
| 186 | err = c.client.Post(). |
| 187 | Namespace(c.ns). |
| 188 | Resource("serviceaccounts"). |
| 189 | Name(serviceAccountName). |
| 190 | SubResource("token"). |
| 191 | VersionedParams(&opts, scheme.ParameterCodec). |
| 192 | Body(tokenRequest). |
| 193 | Do(ctx). |
| 194 | Into(result) |
| 195 | return |
| 196 | } |