1 // Copyright 2018 The prometheus-operator Authors
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
15 // Code generated by client-gen. DO NOT EDIT.
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"
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
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)
50 // prometheuses implements PrometheusInterface
51 type prometheuses struct {
56 // newPrometheuses returns a Prometheuses
57 func newPrometheuses(c *MonitoringV1Client, namespace string) *prometheuses {
59 client: c.RESTClient(),
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{}
69 Resource("prometheuses").
71 VersionedParams(&options, scheme.ParameterCodec).
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
83 result = &v1.PrometheusList{}
86 Resource("prometheuses").
87 VersionedParams(&opts, scheme.ParameterCodec).
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
101 return c.client.Get().
103 Resource("prometheuses").
104 VersionedParams(&opts, scheme.ParameterCodec).
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().
114 Resource("prometheuses").
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().
126 Resource("prometheuses").
127 Name(prometheus.Name).
134 // UpdateStatus was generated because the type contains a Status member.
135 // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
137 func (c *prometheuses) UpdateStatus(prometheus *v1.Prometheus) (result *v1.Prometheus, err error) {
138 result = &v1.Prometheus{}
139 err = c.client.Put().
141 Resource("prometheuses").
142 Name(prometheus.Name).
143 SubResource("status").
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().
154 Resource("prometheuses").
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
167 return c.client.Delete().
169 Resource("prometheuses").
170 VersionedParams(&listOptions, scheme.ParameterCodec).
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).
182 Resource("prometheuses").
183 SubResource(subresources...).