55b4db961db09fae269e7f43a48df949384355f8
[icn/sdwan.git] /
1 // SPDX-License-Identifier: Apache-2.0
2 // Copyright (c) 2020 Intel Corporation
3 // Code generated by client-gen. DO NOT EDIT.
4
5 package v1alpha1
6
7 import (
8         "context"
9         "time"
10
11         v1alpha1 "github.com/open-ness/EMCO/src/monitor/pkg/apis/k8splugin/v1alpha1"
12         scheme "github.com/open-ness/EMCO/src/monitor/pkg/generated/clientset/versioned/scheme"
13
14         v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
15         types "k8s.io/apimachinery/pkg/types"
16         watch "k8s.io/apimachinery/pkg/watch"
17         rest "k8s.io/client-go/rest"
18 )
19
20 // ResourceBundleStatesGetter has a method to return a ResourceBundleStateInterface.
21 // A group's client should implement this interface.
22 type ResourceBundleStatesGetter interface {
23         ResourceBundleStates(namespace string) ResourceBundleStateInterface
24 }
25
26 // ResourceBundleStateInterface has methods to work with ResourceBundleState resources.
27 type ResourceBundleStateInterface interface {
28         Create(*v1alpha1.ResourceBundleState) (*v1alpha1.ResourceBundleState, error)
29         Update(*v1alpha1.ResourceBundleState) (*v1alpha1.ResourceBundleState, error)
30         UpdateStatus(*v1alpha1.ResourceBundleState) (*v1alpha1.ResourceBundleState, error)
31         Delete(name string, options *v1.DeleteOptions) error
32         DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
33         Get(name string, options v1.GetOptions) (*v1alpha1.ResourceBundleState, error)
34         List(opts v1.ListOptions) (*v1alpha1.ResourceBundleStateList, error)
35         Watch(opts v1.ListOptions) (watch.Interface, error)
36         Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ResourceBundleState, err error)
37         ResourceBundleStateExpansion
38 }
39
40 // resourceBundleStates implements ResourceBundleStateInterface
41 type resourceBundleStates struct {
42         client rest.Interface
43         ns     string
44 }
45
46 // newResourceBundleStates returns a ResourceBundleStates
47 func newResourceBundleStates(c *K8spluginV1alpha1Client, namespace string) *resourceBundleStates {
48         return &resourceBundleStates{
49                 client: c.RESTClient(),
50                 ns:     namespace,
51         }
52 }
53
54 // Get takes name of the resourceBundleState, and returns the corresponding resourceBundleState object, and an error if there is any.
55 func (c *resourceBundleStates) Get(name string, options v1.GetOptions) (result *v1alpha1.ResourceBundleState, err error) {
56         result = &v1alpha1.ResourceBundleState{}
57         err = c.client.Get().
58                 Namespace(c.ns).
59                 Resource("resourcebundlestates").
60                 Name(name).
61                 VersionedParams(&options, scheme.ParameterCodec).
62                 Do(context.TODO()).
63                 Into(result)
64         return
65 }
66
67 // List takes label and field selectors, and returns the list of ResourceBundleStates that match those selectors.
68 func (c *resourceBundleStates) List(opts v1.ListOptions) (result *v1alpha1.ResourceBundleStateList, err error) {
69         var timeout time.Duration
70         if opts.TimeoutSeconds != nil {
71                 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
72         }
73         result = &v1alpha1.ResourceBundleStateList{}
74         err = c.client.Get().
75                 Namespace(c.ns).
76                 Resource("resourcebundlestates").
77                 VersionedParams(&opts, scheme.ParameterCodec).
78                 Timeout(timeout).
79                 Do(context.TODO()).
80                 Into(result)
81         return
82 }
83
84 // Watch returns a watch.Interface that watches the requested resourceBundleStates.
85 func (c *resourceBundleStates) Watch(opts v1.ListOptions) (watch.Interface, error) {
86         var timeout time.Duration
87         if opts.TimeoutSeconds != nil {
88                 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
89         }
90         opts.Watch = true
91         return c.client.Get().
92                 Namespace(c.ns).
93                 Resource("resourcebundlestates").
94                 VersionedParams(&opts, scheme.ParameterCodec).
95                 Timeout(timeout).
96                 Watch(context.TODO())
97 }
98
99 // Create takes the representation of a resourceBundleState and creates it.  Returns the server's representation of the resourceBundleState, and an error, if there is any.
100 func (c *resourceBundleStates) Create(resourceBundleState *v1alpha1.ResourceBundleState) (result *v1alpha1.ResourceBundleState, err error) {
101         result = &v1alpha1.ResourceBundleState{}
102         err = c.client.Post().
103                 Namespace(c.ns).
104                 Resource("resourcebundlestates").
105                 Body(resourceBundleState).
106                 Do(context.TODO()).
107                 Into(result)
108         return
109 }
110
111 // Update takes the representation of a resourceBundleState and updates it. Returns the server's representation of the resourceBundleState, and an error, if there is any.
112 func (c *resourceBundleStates) Update(resourceBundleState *v1alpha1.ResourceBundleState) (result *v1alpha1.ResourceBundleState, err error) {
113         result = &v1alpha1.ResourceBundleState{}
114         err = c.client.Put().
115                 Namespace(c.ns).
116                 Resource("resourcebundlestates").
117                 Name(resourceBundleState.Name).
118                 Body(resourceBundleState).
119                 Do(context.TODO()).
120                 Into(result)
121         return
122 }
123
124 // UpdateStatus was generated because the type contains a Status member.
125 // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
126
127 func (c *resourceBundleStates) UpdateStatus(resourceBundleState *v1alpha1.ResourceBundleState) (result *v1alpha1.ResourceBundleState, err error) {
128         result = &v1alpha1.ResourceBundleState{}
129         err = c.client.Put().
130                 Namespace(c.ns).
131                 Resource("resourcebundlestates").
132                 Name(resourceBundleState.Name).
133                 SubResource("status").
134                 Body(resourceBundleState).
135                 Do(context.TODO()).
136                 Into(result)
137         return
138 }
139
140 // Delete takes name of the resourceBundleState and deletes it. Returns an error if one occurs.
141 func (c *resourceBundleStates) Delete(name string, options *v1.DeleteOptions) error {
142         return c.client.Delete().
143                 Namespace(c.ns).
144                 Resource("resourcebundlestates").
145                 Name(name).
146                 Body(options).
147                 Do(context.TODO()).
148                 Error()
149 }
150
151 // DeleteCollection deletes a collection of objects.
152 func (c *resourceBundleStates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
153         var timeout time.Duration
154         if listOptions.TimeoutSeconds != nil {
155                 timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
156         }
157         return c.client.Delete().
158                 Namespace(c.ns).
159                 Resource("resourcebundlestates").
160                 VersionedParams(&listOptions, scheme.ParameterCodec).
161                 Timeout(timeout).
162                 Body(options).
163                 Do(context.TODO()).
164                 Error()
165 }
166
167 // Patch applies the patch and returns the patched resourceBundleState.
168 func (c *resourceBundleStates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ResourceBundleState, err error) {
169         result = &v1alpha1.ResourceBundleState{}
170         err = c.client.Patch(pt).
171                 Namespace(c.ns).
172                 Resource("resourcebundlestates").
173                 SubResource(subresources...).
174                 Name(name).
175                 Body(data).
176                 Do(context.TODO()).
177                 Into(result)
178         return
179 }