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