2 Copyright The Kubernetes Authors.
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
8 http://www.apache.org/licenses/LICENSE-2.0
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.
17 // Code generated by client-gen. DO NOT EDIT.
24 v1 "k8s.io/api/core/v1"
25 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26 types "k8s.io/apimachinery/pkg/types"
27 watch "k8s.io/apimachinery/pkg/watch"
28 scheme "k8s.io/client-go/kubernetes/scheme"
29 rest "k8s.io/client-go/rest"
32 // PodsGetter has a method to return a PodInterface.
33 // A group's client should implement this interface.
34 type PodsGetter interface {
35 Pods(namespace string) PodInterface
38 // PodInterface has methods to work with Pod resources.
39 type PodInterface interface {
40 Create(*v1.Pod) (*v1.Pod, error)
41 Update(*v1.Pod) (*v1.Pod, error)
42 UpdateStatus(*v1.Pod) (*v1.Pod, 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.Pod, error)
46 List(opts metav1.ListOptions) (*v1.PodList, error)
47 Watch(opts metav1.ListOptions) (watch.Interface, error)
48 Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Pod, err error)
52 // pods implements PodInterface
58 // newPods returns a Pods
59 func newPods(c *CoreV1Client, namespace string) *pods {
61 client: c.RESTClient(),
66 // Get takes name of the pod, and returns the corresponding pod object, and an error if there is any.
67 func (c *pods) Get(name string, options metav1.GetOptions) (result *v1.Pod, err error) {
73 VersionedParams(&options, scheme.ParameterCodec).
79 // List takes label and field selectors, and returns the list of Pods that match those selectors.
80 func (c *pods) List(opts metav1.ListOptions) (result *v1.PodList, err error) {
81 var timeout time.Duration
82 if opts.TimeoutSeconds != nil {
83 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
85 result = &v1.PodList{}
89 VersionedParams(&opts, scheme.ParameterCodec).
96 // Watch returns a watch.Interface that watches the requested pods.
97 func (c *pods) Watch(opts metav1.ListOptions) (watch.Interface, error) {
98 var timeout time.Duration
99 if opts.TimeoutSeconds != nil {
100 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
103 return c.client.Get().
106 VersionedParams(&opts, scheme.ParameterCodec).
111 // Create takes the representation of a pod and creates it. Returns the server's representation of the pod, and an error, if there is any.
112 func (c *pods) Create(pod *v1.Pod) (result *v1.Pod, err error) {
114 err = c.client.Post().
123 // Update takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any.
124 func (c *pods) Update(pod *v1.Pod) (result *v1.Pod, err error) {
126 err = c.client.Put().
136 // UpdateStatus was generated because the type contains a Status member.
137 // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
139 func (c *pods) UpdateStatus(pod *v1.Pod) (result *v1.Pod, err error) {
141 err = c.client.Put().
145 SubResource("status").
152 // Delete takes name of the pod and deletes it. Returns an error if one occurs.
153 func (c *pods) Delete(name string, options *metav1.DeleteOptions) error {
154 return c.client.Delete().
163 // DeleteCollection deletes a collection of objects.
164 func (c *pods) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
165 var timeout time.Duration
166 if listOptions.TimeoutSeconds != nil {
167 timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
169 return c.client.Delete().
172 VersionedParams(&listOptions, scheme.ParameterCodec).
179 // Patch applies the patch and returns the patched pod.
180 func (c *pods) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Pod, err error) {
182 err = c.client.Patch(pt).
185 SubResource(subresources...).