forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fake_appliedclusterresourcequota.go
52 lines (43 loc) · 2.01 KB
/
fake_appliedclusterresourcequota.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
package fake
import (
quota "github.com/openshift/origin/pkg/quota/apis/quota"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
testing "k8s.io/client-go/testing"
)
// FakeAppliedClusterResourceQuotas implements AppliedClusterResourceQuotaInterface
type FakeAppliedClusterResourceQuotas struct {
Fake *FakeQuota
ns string
}
var appliedclusterresourcequotasResource = schema.GroupVersionResource{Group: "quota.openshift.io", Version: "", Resource: "appliedclusterresourcequotas"}
var appliedclusterresourcequotasKind = schema.GroupVersionKind{Group: "quota.openshift.io", Version: "", Kind: "AppliedClusterResourceQuota"}
// Get takes name of the appliedClusterResourceQuota, and returns the corresponding appliedClusterResourceQuota object, and an error if there is any.
func (c *FakeAppliedClusterResourceQuotas) Get(name string, options v1.GetOptions) (result *quota.AppliedClusterResourceQuota, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(appliedclusterresourcequotasResource, c.ns, name), "a.AppliedClusterResourceQuota{})
if obj == nil {
return nil, err
}
return obj.(*quota.AppliedClusterResourceQuota), err
}
// List takes label and field selectors, and returns the list of AppliedClusterResourceQuotas that match those selectors.
func (c *FakeAppliedClusterResourceQuotas) List(opts v1.ListOptions) (result *quota.AppliedClusterResourceQuotaList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(appliedclusterresourcequotasResource, appliedclusterresourcequotasKind, c.ns, opts), "a.AppliedClusterResourceQuotaList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := "a.AppliedClusterResourceQuotaList{}
for _, item := range obj.(*quota.AppliedClusterResourceQuotaList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}