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 // 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
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)
50 // alertmanagers implements AlertmanagerInterface
51 type alertmanagers struct {
56 // newAlertmanagers returns a Alertmanagers
57 func newAlertmanagers(c *MonitoringV1Client, namespace string) *alertmanagers {
58 return &alertmanagers{
59 client: c.RESTClient(),
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{}
69 Resource("alertmanagers").
71 VersionedParams(&options, scheme.ParameterCodec).
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
83 result = &v1.AlertmanagerList{}
86 Resource("alertmanagers").
87 VersionedParams(&opts, scheme.ParameterCodec).
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
101 return c.client.Get().
103 Resource("alertmanagers").
104 VersionedParams(&opts, scheme.ParameterCodec).
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().
114 Resource("alertmanagers").
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().
126 Resource("alertmanagers").
127 Name(alertmanager.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 *alertmanagers) UpdateStatus(alertmanager *v1.Alertmanager) (result *v1.Alertmanager, err error) {
138 result = &v1.Alertmanager{}
139 err = c.client.Put().
141 Resource("alertmanagers").
142 Name(alertmanager.Name).
143 SubResource("status").
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().
154 Resource("alertmanagers").
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
167 return c.client.Delete().
169 Resource("alertmanagers").
170 VersionedParams(&listOptions, scheme.ParameterCodec).
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).
182 Resource("alertmanagers").
183 SubResource(subresources...).