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 // PrometheusRulesGetter has a method to return a PrometheusRuleInterface.
31 // A group's client should implement this interface.
32 type PrometheusRulesGetter interface {
33 PrometheusRules(namespace string) PrometheusRuleInterface
36 // PrometheusRuleInterface has methods to work with PrometheusRule resources.
37 type PrometheusRuleInterface interface {
38 Create(*v1.PrometheusRule) (*v1.PrometheusRule, error)
39 Update(*v1.PrometheusRule) (*v1.PrometheusRule, 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.PrometheusRule, error)
43 List(opts metav1.ListOptions) (*v1.PrometheusRuleList, error)
44 Watch(opts metav1.ListOptions) (watch.Interface, error)
45 Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.PrometheusRule, err error)
46 PrometheusRuleExpansion
49 // prometheusRules implements PrometheusRuleInterface
50 type prometheusRules struct {
55 // newPrometheusRules returns a PrometheusRules
56 func newPrometheusRules(c *MonitoringV1Client, namespace string) *prometheusRules {
57 return &prometheusRules{
58 client: c.RESTClient(),
63 // Get takes name of the prometheusRule, and returns the corresponding prometheusRule object, and an error if there is any.
64 func (c *prometheusRules) Get(name string, options metav1.GetOptions) (result *v1.PrometheusRule, err error) {
65 result = &v1.PrometheusRule{}
68 Resource("prometheusrules").
70 VersionedParams(&options, scheme.ParameterCodec).
76 // List takes label and field selectors, and returns the list of PrometheusRules that match those selectors.
77 func (c *prometheusRules) List(opts metav1.ListOptions) (result *v1.PrometheusRuleList, err error) {
78 var timeout time.Duration
79 if opts.TimeoutSeconds != nil {
80 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
82 result = &v1.PrometheusRuleList{}
85 Resource("prometheusrules").
86 VersionedParams(&opts, scheme.ParameterCodec).
93 // Watch returns a watch.Interface that watches the requested prometheusRules.
94 func (c *prometheusRules) 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
100 return c.client.Get().
102 Resource("prometheusrules").
103 VersionedParams(&opts, scheme.ParameterCodec).
108 // Create takes the representation of a prometheusRule and creates it. Returns the server's representation of the prometheusRule, and an error, if there is any.
109 func (c *prometheusRules) Create(prometheusRule *v1.PrometheusRule) (result *v1.PrometheusRule, err error) {
110 result = &v1.PrometheusRule{}
111 err = c.client.Post().
113 Resource("prometheusrules").
114 Body(prometheusRule).
120 // Update takes the representation of a prometheusRule and updates it. Returns the server's representation of the prometheusRule, and an error, if there is any.
121 func (c *prometheusRules) Update(prometheusRule *v1.PrometheusRule) (result *v1.PrometheusRule, err error) {
122 result = &v1.PrometheusRule{}
123 err = c.client.Put().
125 Resource("prometheusrules").
126 Name(prometheusRule.Name).
127 Body(prometheusRule).
133 // Delete takes name of the prometheusRule and deletes it. Returns an error if one occurs.
134 func (c *prometheusRules) Delete(name string, options *metav1.DeleteOptions) error {
135 return c.client.Delete().
137 Resource("prometheusrules").
144 // DeleteCollection deletes a collection of objects.
145 func (c *prometheusRules) 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
150 return c.client.Delete().
152 Resource("prometheusrules").
153 VersionedParams(&listOptions, scheme.ParameterCodec).
160 // Patch applies the patch and returns the patched prometheusRule.
161 func (c *prometheusRules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.PrometheusRule, err error) {
162 result = &v1.PrometheusRule{}
163 err = c.client.Patch(pt).
165 Resource("prometheusrules").
166 SubResource(subresources...).