mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-03 08:04:45 +00:00
code-generator: refer to the API package for GV{R,K}
There should only be one source of truth for the API group's name and version. Signed-off-by: Steve Kuznetsov <skuznets@redhat.com> Kubernetes-commit: e13198ec6f52c4a6405388e90053954dc7656a31
This commit is contained in:
committed by
Kubernetes Publisher
parent
dc46266e11
commit
9bcbb56a27
@@ -23,13 +23,12 @@ import (
|
||||
json "encoding/json"
|
||||
"fmt"
|
||||
|
||||
schedulingv1 "k8s.io/api/scheduling/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
v1 "k8s.io/api/scheduling/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
applyconfigurationsschedulingv1 "k8s.io/client-go/applyconfigurations/scheduling/v1"
|
||||
schedulingv1 "k8s.io/client-go/applyconfigurations/scheduling/v1"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
@@ -38,24 +37,24 @@ type FakePriorityClasses struct {
|
||||
Fake *FakeSchedulingV1
|
||||
}
|
||||
|
||||
var priorityclassesResource = schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1", Resource: "priorityclasses"}
|
||||
var priorityclassesResource = v1.SchemeGroupVersion.WithResource("priorityclasses")
|
||||
|
||||
var priorityclassesKind = schema.GroupVersionKind{Group: "scheduling.k8s.io", Version: "v1", Kind: "PriorityClass"}
|
||||
var priorityclassesKind = v1.SchemeGroupVersion.WithKind("PriorityClass")
|
||||
|
||||
// Get takes name of the priorityClass, and returns the corresponding priorityClass object, and an error if there is any.
|
||||
func (c *FakePriorityClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *schedulingv1.PriorityClass, err error) {
|
||||
func (c *FakePriorityClasses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PriorityClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(priorityclassesResource, name), &schedulingv1.PriorityClass{})
|
||||
Invokes(testing.NewRootGetAction(priorityclassesResource, name), &v1.PriorityClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*schedulingv1.PriorityClass), err
|
||||
return obj.(*v1.PriorityClass), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of PriorityClasses that match those selectors.
|
||||
func (c *FakePriorityClasses) List(ctx context.Context, opts v1.ListOptions) (result *schedulingv1.PriorityClassList, err error) {
|
||||
func (c *FakePriorityClasses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PriorityClassList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(priorityclassesResource, priorityclassesKind, opts), &schedulingv1.PriorityClassList{})
|
||||
Invokes(testing.NewRootListAction(priorityclassesResource, priorityclassesKind, opts), &v1.PriorityClassList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -64,8 +63,8 @@ func (c *FakePriorityClasses) List(ctx context.Context, opts v1.ListOptions) (re
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &schedulingv1.PriorityClassList{ListMeta: obj.(*schedulingv1.PriorityClassList).ListMeta}
|
||||
for _, item := range obj.(*schedulingv1.PriorityClassList).Items {
|
||||
list := &v1.PriorityClassList{ListMeta: obj.(*v1.PriorityClassList).ListMeta}
|
||||
for _, item := range obj.(*v1.PriorityClassList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
@@ -74,58 +73,58 @@ func (c *FakePriorityClasses) List(ctx context.Context, opts v1.ListOptions) (re
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested priorityClasses.
|
||||
func (c *FakePriorityClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
func (c *FakePriorityClasses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(priorityclassesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a priorityClass and creates it. Returns the server's representation of the priorityClass, and an error, if there is any.
|
||||
func (c *FakePriorityClasses) Create(ctx context.Context, priorityClass *schedulingv1.PriorityClass, opts v1.CreateOptions) (result *schedulingv1.PriorityClass, err error) {
|
||||
func (c *FakePriorityClasses) Create(ctx context.Context, priorityClass *v1.PriorityClass, opts metav1.CreateOptions) (result *v1.PriorityClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(priorityclassesResource, priorityClass), &schedulingv1.PriorityClass{})
|
||||
Invokes(testing.NewRootCreateAction(priorityclassesResource, priorityClass), &v1.PriorityClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*schedulingv1.PriorityClass), err
|
||||
return obj.(*v1.PriorityClass), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a priorityClass and updates it. Returns the server's representation of the priorityClass, and an error, if there is any.
|
||||
func (c *FakePriorityClasses) Update(ctx context.Context, priorityClass *schedulingv1.PriorityClass, opts v1.UpdateOptions) (result *schedulingv1.PriorityClass, err error) {
|
||||
func (c *FakePriorityClasses) Update(ctx context.Context, priorityClass *v1.PriorityClass, opts metav1.UpdateOptions) (result *v1.PriorityClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(priorityclassesResource, priorityClass), &schedulingv1.PriorityClass{})
|
||||
Invokes(testing.NewRootUpdateAction(priorityclassesResource, priorityClass), &v1.PriorityClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*schedulingv1.PriorityClass), err
|
||||
return obj.(*v1.PriorityClass), err
|
||||
}
|
||||
|
||||
// Delete takes name of the priorityClass and deletes it. Returns an error if one occurs.
|
||||
func (c *FakePriorityClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
func (c *FakePriorityClasses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteActionWithOptions(priorityclassesResource, name, opts), &schedulingv1.PriorityClass{})
|
||||
Invokes(testing.NewRootDeleteActionWithOptions(priorityclassesResource, name, opts), &v1.PriorityClass{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakePriorityClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
func (c *FakePriorityClasses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(priorityclassesResource, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &schedulingv1.PriorityClassList{})
|
||||
_, err := c.Fake.Invokes(action, &v1.PriorityClassList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched priorityClass.
|
||||
func (c *FakePriorityClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1.PriorityClass, err error) {
|
||||
func (c *FakePriorityClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PriorityClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(priorityclassesResource, name, pt, data, subresources...), &schedulingv1.PriorityClass{})
|
||||
Invokes(testing.NewRootPatchSubresourceAction(priorityclassesResource, name, pt, data, subresources...), &v1.PriorityClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*schedulingv1.PriorityClass), err
|
||||
return obj.(*v1.PriorityClass), err
|
||||
}
|
||||
|
||||
// Apply takes the given apply declarative configuration, applies it and returns the applied priorityClass.
|
||||
func (c *FakePriorityClasses) Apply(ctx context.Context, priorityClass *applyconfigurationsschedulingv1.PriorityClassApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1.PriorityClass, err error) {
|
||||
func (c *FakePriorityClasses) Apply(ctx context.Context, priorityClass *schedulingv1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PriorityClass, err error) {
|
||||
if priorityClass == nil {
|
||||
return nil, fmt.Errorf("priorityClass provided to Apply must not be nil")
|
||||
}
|
||||
@@ -138,9 +137,9 @@ func (c *FakePriorityClasses) Apply(ctx context.Context, priorityClass *applycon
|
||||
return nil, fmt.Errorf("priorityClass.Name must be provided to Apply")
|
||||
}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(priorityclassesResource, *name, types.ApplyPatchType, data), &schedulingv1.PriorityClass{})
|
||||
Invokes(testing.NewRootPatchSubresourceAction(priorityclassesResource, *name, types.ApplyPatchType, data), &v1.PriorityClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*schedulingv1.PriorityClass), err
|
||||
return obj.(*v1.PriorityClass), err
|
||||
}
|
||||
|
@@ -26,7 +26,6 @@ import (
|
||||
v1alpha1 "k8s.io/api/scheduling/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
schedulingv1alpha1 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha1"
|
||||
@@ -38,9 +37,9 @@ type FakePriorityClasses struct {
|
||||
Fake *FakeSchedulingV1alpha1
|
||||
}
|
||||
|
||||
var priorityclassesResource = schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1alpha1", Resource: "priorityclasses"}
|
||||
var priorityclassesResource = v1alpha1.SchemeGroupVersion.WithResource("priorityclasses")
|
||||
|
||||
var priorityclassesKind = schema.GroupVersionKind{Group: "scheduling.k8s.io", Version: "v1alpha1", Kind: "PriorityClass"}
|
||||
var priorityclassesKind = v1alpha1.SchemeGroupVersion.WithKind("PriorityClass")
|
||||
|
||||
// Get takes name of the priorityClass, and returns the corresponding priorityClass object, and an error if there is any.
|
||||
func (c *FakePriorityClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PriorityClass, err error) {
|
||||
|
@@ -26,7 +26,6 @@ import (
|
||||
v1beta1 "k8s.io/api/scheduling/v1beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
schedulingv1beta1 "k8s.io/client-go/applyconfigurations/scheduling/v1beta1"
|
||||
@@ -38,9 +37,9 @@ type FakePriorityClasses struct {
|
||||
Fake *FakeSchedulingV1beta1
|
||||
}
|
||||
|
||||
var priorityclassesResource = schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1beta1", Resource: "priorityclasses"}
|
||||
var priorityclassesResource = v1beta1.SchemeGroupVersion.WithResource("priorityclasses")
|
||||
|
||||
var priorityclassesKind = schema.GroupVersionKind{Group: "scheduling.k8s.io", Version: "v1beta1", Kind: "PriorityClass"}
|
||||
var priorityclassesKind = v1beta1.SchemeGroupVersion.WithKind("PriorityClass")
|
||||
|
||||
// Get takes name of the priorityClass, and returns the corresponding priorityClass object, and an error if there is any.
|
||||
func (c *FakePriorityClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.PriorityClass, err error) {
|
||||
|
Reference in New Issue
Block a user