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