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