Code refactoring for bpa operator
[icn.git] / cmd / bpa-operator / vendor / github.com / coreos / prometheus-operator / pkg / client / versioned / typed / monitoring / v1 / alertmanager.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 // AlertmanagersGetter has a method to return a AlertmanagerInterface.
31 // A group's client should implement this interface.
32 type AlertmanagersGetter interface {
33         Alertmanagers(namespace string) AlertmanagerInterface
34 }
35
36 // AlertmanagerInterface has methods to work with Alertmanager resources.
37 type AlertmanagerInterface interface {
38         Create(*v1.Alertmanager) (*v1.Alertmanager, error)
39         Update(*v1.Alertmanager) (*v1.Alertmanager, error)
40         UpdateStatus(*v1.Alertmanager) (*v1.Alertmanager, 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.Alertmanager, error)
44         List(opts metav1.ListOptions) (*v1.AlertmanagerList, error)
45         Watch(opts metav1.ListOptions) (watch.Interface, error)
46         Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Alertmanager, err error)
47         AlertmanagerExpansion
48 }
49
50 // alertmanagers implements AlertmanagerInterface
51 type alertmanagers struct {
52         client rest.Interface
53         ns     string
54 }
55
56 // newAlertmanagers returns a Alertmanagers
57 func newAlertmanagers(c *MonitoringV1Client, namespace string) *alertmanagers {
58         return &alertmanagers{
59                 client: c.RESTClient(),
60                 ns:     namespace,
61         }
62 }
63
64 // Get takes name of the alertmanager, and returns the corresponding alertmanager object, and an error if there is any.
65 func (c *alertmanagers) Get(name string, options metav1.GetOptions) (result *v1.Alertmanager, err error) {
66         result = &v1.Alertmanager{}
67         err = c.client.Get().
68                 Namespace(c.ns).
69                 Resource("alertmanagers").
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 Alertmanagers that match those selectors.
78 func (c *alertmanagers) List(opts metav1.ListOptions) (result *v1.AlertmanagerList, err error) {
79         var timeout time.Duration
80         if opts.TimeoutSeconds != nil {
81                 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
82         }
83         result = &v1.AlertmanagerList{}
84         err = c.client.Get().
85                 Namespace(c.ns).
86                 Resource("alertmanagers").
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 alertmanagers.
95 func (c *alertmanagers) 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("alertmanagers").
104                 VersionedParams(&opts, scheme.ParameterCodec).
105                 Timeout(timeout).
106                 Watch()
107 }
108
109 // Create takes the representation of a alertmanager and creates it.  Returns the server's representation of the alertmanager, and an error, if there is any.
110 func (c *alertmanagers) Create(alertmanager *v1.Alertmanager) (result *v1.Alertmanager, err error) {
111         result = &v1.Alertmanager{}
112         err = c.client.Post().
113                 Namespace(c.ns).
114                 Resource("alertmanagers").
115                 Body(alertmanager).
116                 Do().
117                 Into(result)
118         return
119 }
120
121 // Update takes the representation of a alertmanager and updates it. Returns the server's representation of the alertmanager, and an error, if there is any.
122 func (c *alertmanagers) Update(alertmanager *v1.Alertmanager) (result *v1.Alertmanager, err error) {
123         result = &v1.Alertmanager{}
124         err = c.client.Put().
125                 Namespace(c.ns).
126                 Resource("alertmanagers").
127                 Name(alertmanager.Name).
128                 Body(alertmanager).
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 *alertmanagers) UpdateStatus(alertmanager *v1.Alertmanager) (result *v1.Alertmanager, err error) {
138         result = &v1.Alertmanager{}
139         err = c.client.Put().
140                 Namespace(c.ns).
141                 Resource("alertmanagers").
142                 Name(alertmanager.Name).
143                 SubResource("status").
144                 Body(alertmanager).
145                 Do().
146                 Into(result)
147         return
148 }
149
150 // Delete takes name of the alertmanager and deletes it. Returns an error if one occurs.
151 func (c *alertmanagers) Delete(name string, options *metav1.DeleteOptions) error {
152         return c.client.Delete().
153                 Namespace(c.ns).
154                 Resource("alertmanagers").
155                 Name(name).
156                 Body(options).
157                 Do().
158                 Error()
159 }
160
161 // DeleteCollection deletes a collection of objects.
162 func (c *alertmanagers) 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("alertmanagers").
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 alertmanager.
178 func (c *alertmanagers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Alertmanager, err error) {
179         result = &v1.Alertmanager{}
180         err = c.client.Patch(pt).
181                 Namespace(c.ns).
182                 Resource("alertmanagers").
183                 SubResource(subresources...).
184                 Name(name).
185                 Body(data).
186                 Do().
187                 Into(result)
188         return
189 }