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