Remove BPA from Makefile
[icn.git] / cmd / bpa-operator / vendor / github.com / coreos / prometheus-operator / pkg / client / versioned / typed / monitoring / v1 / servicemonitor.go
1 // Copyright 2018 The prometheus-operator Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Code generated by client-gen. DO NOT EDIT.
16
17 package v1
18
19 import (
20         "time"
21
22         v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
23         scheme "github.com/coreos/prometheus-operator/pkg/client/versioned/scheme"
24         metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
25         types "k8s.io/apimachinery/pkg/types"
26         watch "k8s.io/apimachinery/pkg/watch"
27         rest "k8s.io/client-go/rest"
28 )
29
30 // ServiceMonitorsGetter has a method to return a ServiceMonitorInterface.
31 // A group's client should implement this interface.
32 type ServiceMonitorsGetter interface {
33         ServiceMonitors(namespace string) ServiceMonitorInterface
34 }
35
36 // ServiceMonitorInterface has methods to work with ServiceMonitor resources.
37 type ServiceMonitorInterface interface {
38         Create(*v1.ServiceMonitor) (*v1.ServiceMonitor, error)
39         Update(*v1.ServiceMonitor) (*v1.ServiceMonitor, error)
40         Delete(name string, options *metav1.DeleteOptions) error
41         DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
42         Get(name string, options metav1.GetOptions) (*v1.ServiceMonitor, error)
43         List(opts metav1.ListOptions) (*v1.ServiceMonitorList, error)
44         Watch(opts metav1.ListOptions) (watch.Interface, error)
45         Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ServiceMonitor, err error)
46         ServiceMonitorExpansion
47 }
48
49 // serviceMonitors implements ServiceMonitorInterface
50 type serviceMonitors struct {
51         client rest.Interface
52         ns     string
53 }
54
55 // newServiceMonitors returns a ServiceMonitors
56 func newServiceMonitors(c *MonitoringV1Client, namespace string) *serviceMonitors {
57         return &serviceMonitors{
58                 client: c.RESTClient(),
59                 ns:     namespace,
60         }
61 }
62
63 // Get takes name of the serviceMonitor, and returns the corresponding serviceMonitor object, and an error if there is any.
64 func (c *serviceMonitors) Get(name string, options metav1.GetOptions) (result *v1.ServiceMonitor, err error) {
65         result = &v1.ServiceMonitor{}
66         err = c.client.Get().
67                 Namespace(c.ns).
68                 Resource("servicemonitors").
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 ServiceMonitors that match those selectors.
77 func (c *serviceMonitors) List(opts metav1.ListOptions) (result *v1.ServiceMonitorList, err error) {
78         var timeout time.Duration
79         if opts.TimeoutSeconds != nil {
80                 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
81         }
82         result = &v1.ServiceMonitorList{}
83         err = c.client.Get().
84                 Namespace(c.ns).
85                 Resource("servicemonitors").
86                 VersionedParams(&opts, scheme.ParameterCodec).
87                 Timeout(timeout).
88                 Do().
89                 Into(result)
90         return
91 }
92
93 // Watch returns a watch.Interface that watches the requested serviceMonitors.
94 func (c *serviceMonitors) Watch(opts metav1.ListOptions) (watch.Interface, error) {
95         var timeout time.Duration
96         if opts.TimeoutSeconds != nil {
97                 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
98         }
99         opts.Watch = true
100         return c.client.Get().
101                 Namespace(c.ns).
102                 Resource("servicemonitors").
103                 VersionedParams(&opts, scheme.ParameterCodec).
104                 Timeout(timeout).
105                 Watch()
106 }
107
108 // Create takes the representation of a serviceMonitor and creates it.  Returns the server's representation of the serviceMonitor, and an error, if there is any.
109 func (c *serviceMonitors) Create(serviceMonitor *v1.ServiceMonitor) (result *v1.ServiceMonitor, err error) {
110         result = &v1.ServiceMonitor{}
111         err = c.client.Post().
112                 Namespace(c.ns).
113                 Resource("servicemonitors").
114                 Body(serviceMonitor).
115                 Do().
116                 Into(result)
117         return
118 }
119
120 // Update takes the representation of a serviceMonitor and updates it. Returns the server's representation of the serviceMonitor, and an error, if there is any.
121 func (c *serviceMonitors) Update(serviceMonitor *v1.ServiceMonitor) (result *v1.ServiceMonitor, err error) {
122         result = &v1.ServiceMonitor{}
123         err = c.client.Put().
124                 Namespace(c.ns).
125                 Resource("servicemonitors").
126                 Name(serviceMonitor.Name).
127                 Body(serviceMonitor).
128                 Do().
129                 Into(result)
130         return
131 }
132
133 // Delete takes name of the serviceMonitor and deletes it. Returns an error if one occurs.
134 func (c *serviceMonitors) Delete(name string, options *metav1.DeleteOptions) error {
135         return c.client.Delete().
136                 Namespace(c.ns).
137                 Resource("servicemonitors").
138                 Name(name).
139                 Body(options).
140                 Do().
141                 Error()
142 }
143
144 // DeleteCollection deletes a collection of objects.
145 func (c *serviceMonitors) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
146         var timeout time.Duration
147         if listOptions.TimeoutSeconds != nil {
148                 timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
149         }
150         return c.client.Delete().
151                 Namespace(c.ns).
152                 Resource("servicemonitors").
153                 VersionedParams(&listOptions, scheme.ParameterCodec).
154                 Timeout(timeout).
155                 Body(options).
156                 Do().
157                 Error()
158 }
159
160 // Patch applies the patch and returns the patched serviceMonitor.
161 func (c *serviceMonitors) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ServiceMonitor, err error) {
162         result = &v1.ServiceMonitor{}
163         err = c.client.Patch(pt).
164                 Namespace(c.ns).
165                 Resource("servicemonitors").
166                 SubResource(subresources...).
167                 Name(name).
168                 Body(data).
169                 Do().
170                 Into(result)
171         return
172 }