This repository has been archived by the owner on Jul 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
clusteresourcequota.go
73 lines (59 loc) · 2.77 KB
/
clusteresourcequota.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
quotaapi "github.com/openshift/origin/pkg/quota/api"
)
type ClusterResourceQuotasInterface interface {
ClusterResourceQuotas() ClusterResourceQuotaInterface
}
type ClusterResourceQuotaInterface interface {
List(opts kapi.ListOptions) (*quotaapi.ClusterResourceQuotaList, error)
Get(name string) (*quotaapi.ClusterResourceQuota, error)
Create(resourceQuota *quotaapi.ClusterResourceQuota) (*quotaapi.ClusterResourceQuota, error)
Update(resourceQuota *quotaapi.ClusterResourceQuota) (*quotaapi.ClusterResourceQuota, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
UpdateStatus(resourceQuota *quotaapi.ClusterResourceQuota) (*quotaapi.ClusterResourceQuota, error)
}
type clusterResourceQuotas struct {
r *Client
}
// newClusterResourceQuotas returns a clusterResourceQuotas
func newClusterResourceQuotas(c *Client) *clusterResourceQuotas {
return &clusterResourceQuotas{
r: c,
}
}
func (c *clusterResourceQuotas) List(opts kapi.ListOptions) (result *quotaapi.ClusterResourceQuotaList, err error) {
result = "aapi.ClusterResourceQuotaList{}
err = c.r.Get().Resource("clusterresourcequotas").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
func (c *clusterResourceQuotas) Get(name string) (result *quotaapi.ClusterResourceQuota, err error) {
result = "aapi.ClusterResourceQuota{}
err = c.r.Get().Resource("clusterresourcequotas").Name(name).Do().Into(result)
return
}
func (c *clusterResourceQuotas) Create(resourceQuota *quotaapi.ClusterResourceQuota) (result *quotaapi.ClusterResourceQuota, err error) {
result = "aapi.ClusterResourceQuota{}
err = c.r.Post().Resource("clusterresourcequotas").Body(resourceQuota).Do().Into(result)
return
}
func (c *clusterResourceQuotas) Update(resourceQuota *quotaapi.ClusterResourceQuota) (result *quotaapi.ClusterResourceQuota, err error) {
result = "aapi.ClusterResourceQuota{}
err = c.r.Put().Resource("clusterresourcequotas").Name(resourceQuota.Name).Body(resourceQuota).Do().Into(result)
return
}
func (c *clusterResourceQuotas) Delete(name string) (err error) {
err = c.r.Delete().Resource("clusterresourcequotas").Name(name).Do().Error()
return
}
func (c *clusterResourceQuotas) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().Prefix("watch").Resource("clusterresourcequotas").VersionedParams(&opts, kapi.ParameterCodec).Watch()
}
func (c *clusterResourceQuotas) UpdateStatus(resourceQuota *quotaapi.ClusterResourceQuota) (result *quotaapi.ClusterResourceQuota, err error) {
result = "aapi.ClusterResourceQuota{}
err = c.r.Put().Resource("clusterresourcequotas").Name(resourceQuota.Name).SubResource("status").Body(resourceQuota).Do().Into(result)
return
}