mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 06:22:13 +08:00
K8s: Fix hack/update-codegen (#91867)
This commit is contained in:
@ -5,8 +5,6 @@
|
||||
|
||||
// Code generated by openapi-gen. DO NOT EDIT.
|
||||
|
||||
// This file was autogenerated by openapi-gen. Do not edit it manually!
|
||||
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// DataPlaneServiceApplyConfiguration represents an declarative configuration of the DataPlaneService type for use
|
||||
// DataPlaneServiceApplyConfiguration represents a declarative configuration of the DataPlaneService type for use
|
||||
// with apply.
|
||||
type DataPlaneServiceApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
@ -19,7 +19,7 @@ type DataPlaneServiceApplyConfiguration struct {
|
||||
Status *DataPlaneServiceStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// DataPlaneService constructs an declarative configuration of the DataPlaneService type for use with
|
||||
// DataPlaneService constructs a declarative configuration of the DataPlaneService type for use with
|
||||
// apply.
|
||||
func DataPlaneService(name string) *DataPlaneServiceApplyConfiguration {
|
||||
b := &DataPlaneServiceApplyConfiguration{}
|
||||
@ -202,3 +202,9 @@ func (b *DataPlaneServiceApplyConfiguration) WithStatus(value *DataPlaneServiceS
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||
func (b *DataPlaneServiceApplyConfiguration) GetName() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.Name
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// DataPlaneServiceConditionApplyConfiguration represents an declarative configuration of the DataPlaneServiceCondition type for use
|
||||
// DataPlaneServiceConditionApplyConfiguration represents a declarative configuration of the DataPlaneServiceCondition type for use
|
||||
// with apply.
|
||||
type DataPlaneServiceConditionApplyConfiguration struct {
|
||||
Type *v0alpha1.DataPlaneServiceConditionType `json:"type,omitempty"`
|
||||
@ -19,7 +19,7 @@ type DataPlaneServiceConditionApplyConfiguration struct {
|
||||
Message *string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// DataPlaneServiceConditionApplyConfiguration constructs an declarative configuration of the DataPlaneServiceCondition type for use with
|
||||
// DataPlaneServiceConditionApplyConfiguration constructs a declarative configuration of the DataPlaneServiceCondition type for use with
|
||||
// apply.
|
||||
func DataPlaneServiceCondition() *DataPlaneServiceConditionApplyConfiguration {
|
||||
return &DataPlaneServiceConditionApplyConfiguration{}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
v0alpha1 "github.com/grafana/grafana/pkg/aggregator/apis/aggregation/v0alpha1"
|
||||
)
|
||||
|
||||
// DataPlaneServiceSpecApplyConfiguration represents an declarative configuration of the DataPlaneServiceSpec type for use
|
||||
// DataPlaneServiceSpecApplyConfiguration represents a declarative configuration of the DataPlaneServiceSpec type for use
|
||||
// with apply.
|
||||
type DataPlaneServiceSpecApplyConfiguration struct {
|
||||
PluginID *string `json:"pluginID,omitempty"`
|
||||
@ -18,7 +18,7 @@ type DataPlaneServiceSpecApplyConfiguration struct {
|
||||
Services []ServiceApplyConfiguration `json:"services,omitempty"`
|
||||
}
|
||||
|
||||
// DataPlaneServiceSpecApplyConfiguration constructs an declarative configuration of the DataPlaneServiceSpec type for use with
|
||||
// DataPlaneServiceSpecApplyConfiguration constructs a declarative configuration of the DataPlaneServiceSpec type for use with
|
||||
// apply.
|
||||
func DataPlaneServiceSpec() *DataPlaneServiceSpecApplyConfiguration {
|
||||
return &DataPlaneServiceSpecApplyConfiguration{}
|
||||
|
@ -4,13 +4,13 @@
|
||||
|
||||
package v0alpha1
|
||||
|
||||
// DataPlaneServiceStatusApplyConfiguration represents an declarative configuration of the DataPlaneServiceStatus type for use
|
||||
// DataPlaneServiceStatusApplyConfiguration represents a declarative configuration of the DataPlaneServiceStatus type for use
|
||||
// with apply.
|
||||
type DataPlaneServiceStatusApplyConfiguration struct {
|
||||
Conditions []DataPlaneServiceConditionApplyConfiguration `json:"conditions,omitempty"`
|
||||
}
|
||||
|
||||
// DataPlaneServiceStatusApplyConfiguration constructs an declarative configuration of the DataPlaneServiceStatus type for use with
|
||||
// DataPlaneServiceStatusApplyConfiguration constructs a declarative configuration of the DataPlaneServiceStatus type for use with
|
||||
// apply.
|
||||
func DataPlaneServiceStatus() *DataPlaneServiceStatusApplyConfiguration {
|
||||
return &DataPlaneServiceStatusApplyConfiguration{}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
v0alpha1 "github.com/grafana/grafana/pkg/aggregator/apis/aggregation/v0alpha1"
|
||||
)
|
||||
|
||||
// ServiceApplyConfiguration represents an declarative configuration of the Service type for use
|
||||
// ServiceApplyConfiguration represents a declarative configuration of the Service type for use
|
||||
// with apply.
|
||||
type ServiceApplyConfiguration struct {
|
||||
Type *v0alpha1.ServiceType `json:"type,omitempty"`
|
||||
@ -16,7 +16,7 @@ type ServiceApplyConfiguration struct {
|
||||
Path *string `json:"path,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceApplyConfiguration constructs an declarative configuration of the Service type for use with
|
||||
// ServiceApplyConfiguration constructs a declarative configuration of the Service type for use with
|
||||
// apply.
|
||||
func Service() *ServiceApplyConfiguration {
|
||||
return &ServiceApplyConfiguration{}
|
||||
|
@ -7,7 +7,10 @@ package applyconfiguration
|
||||
import (
|
||||
v0alpha1 "github.com/grafana/grafana/pkg/aggregator/apis/aggregation/v0alpha1"
|
||||
aggregationv0alpha1 "github.com/grafana/grafana/pkg/aggregator/generated/applyconfiguration/aggregation/v0alpha1"
|
||||
internal "github.com/grafana/grafana/pkg/aggregator/generated/applyconfiguration/internal"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no
|
||||
@ -29,3 +32,7 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewTypeConverter(scheme *runtime.Scheme) *testing.TypeConverter {
|
||||
return &testing.TypeConverter{Scheme: scheme, TypeResolver: internal.Parser()}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
package fake
|
||||
|
||||
import (
|
||||
applyconfiguration "github.com/grafana/grafana/pkg/aggregator/generated/applyconfiguration"
|
||||
clientset "github.com/grafana/grafana/pkg/aggregator/generated/clientset/versioned"
|
||||
aggregationv0alpha1 "github.com/grafana/grafana/pkg/aggregator/generated/clientset/versioned/typed/aggregation/v0alpha1"
|
||||
fakeaggregationv0alpha1 "github.com/grafana/grafana/pkg/aggregator/generated/clientset/versioned/typed/aggregation/v0alpha1/fake"
|
||||
@ -17,8 +18,12 @@ import (
|
||||
|
||||
// NewSimpleClientset returns a clientset that will respond with the provided objects.
|
||||
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
|
||||
// without applying any validations and/or defaults. It shouldn't be considered a replacement
|
||||
// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement
|
||||
// for a real clientset and is mostly useful in simple unit tests.
|
||||
//
|
||||
// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves
|
||||
// server side apply testing. NewClientset is only available when apply configurations are generated (e.g.
|
||||
// via --with-applyconfig).
|
||||
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
|
||||
for _, obj := range objects {
|
||||
@ -60,6 +65,38 @@ func (c *Clientset) Tracker() testing.ObjectTracker {
|
||||
return c.tracker
|
||||
}
|
||||
|
||||
// NewClientset returns a clientset that will respond with the provided objects.
|
||||
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
|
||||
// without applying any validations and/or defaults. It shouldn't be considered a replacement
|
||||
// for a real clientset and is mostly useful in simple unit tests.
|
||||
func NewClientset(objects ...runtime.Object) *Clientset {
|
||||
o := testing.NewFieldManagedObjectTracker(
|
||||
scheme,
|
||||
codecs.UniversalDecoder(),
|
||||
applyconfiguration.NewTypeConverter(scheme),
|
||||
)
|
||||
for _, obj := range objects {
|
||||
if err := o.Add(obj); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
cs := &Clientset{tracker: o}
|
||||
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
||||
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||
gvr := action.GetResource()
|
||||
ns := action.GetNamespace()
|
||||
watch, err := o.Watch(gvr, ns)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
return true, watch, nil
|
||||
})
|
||||
|
||||
return cs
|
||||
}
|
||||
|
||||
var (
|
||||
_ clientset.Interface = &Clientset{}
|
||||
_ testing.FakeClient = &Clientset{}
|
||||
|
@ -6,9 +6,6 @@ package v0alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
json "encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
v0alpha1 "github.com/grafana/grafana/pkg/aggregator/apis/aggregation/v0alpha1"
|
||||
aggregationv0alpha1 "github.com/grafana/grafana/pkg/aggregator/generated/applyconfiguration/aggregation/v0alpha1"
|
||||
@ -16,7 +13,7 @@ import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
)
|
||||
|
||||
// DataPlaneServicesGetter has a method to return a DataPlaneServiceInterface.
|
||||
@ -29,6 +26,7 @@ type DataPlaneServicesGetter interface {
|
||||
type DataPlaneServiceInterface interface {
|
||||
Create(ctx context.Context, dataPlaneService *v0alpha1.DataPlaneService, opts v1.CreateOptions) (*v0alpha1.DataPlaneService, error)
|
||||
Update(ctx context.Context, dataPlaneService *v0alpha1.DataPlaneService, opts v1.UpdateOptions) (*v0alpha1.DataPlaneService, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, dataPlaneService *v0alpha1.DataPlaneService, opts v1.UpdateOptions) (*v0alpha1.DataPlaneService, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
@ -37,193 +35,25 @@ type DataPlaneServiceInterface interface {
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v0alpha1.DataPlaneService, err error)
|
||||
Apply(ctx context.Context, dataPlaneService *aggregationv0alpha1.DataPlaneServiceApplyConfiguration, opts v1.ApplyOptions) (result *v0alpha1.DataPlaneService, err error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
ApplyStatus(ctx context.Context, dataPlaneService *aggregationv0alpha1.DataPlaneServiceApplyConfiguration, opts v1.ApplyOptions) (result *v0alpha1.DataPlaneService, err error)
|
||||
DataPlaneServiceExpansion
|
||||
}
|
||||
|
||||
// dataPlaneServices implements DataPlaneServiceInterface
|
||||
type dataPlaneServices struct {
|
||||
client rest.Interface
|
||||
*gentype.ClientWithListAndApply[*v0alpha1.DataPlaneService, *v0alpha1.DataPlaneServiceList, *aggregationv0alpha1.DataPlaneServiceApplyConfiguration]
|
||||
}
|
||||
|
||||
// newDataPlaneServices returns a DataPlaneServices
|
||||
func newDataPlaneServices(c *AggregationV0alpha1Client) *dataPlaneServices {
|
||||
return &dataPlaneServices{
|
||||
client: c.RESTClient(),
|
||||
gentype.NewClientWithListAndApply[*v0alpha1.DataPlaneService, *v0alpha1.DataPlaneServiceList, *aggregationv0alpha1.DataPlaneServiceApplyConfiguration](
|
||||
"dataplaneservices",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *v0alpha1.DataPlaneService { return &v0alpha1.DataPlaneService{} },
|
||||
func() *v0alpha1.DataPlaneServiceList { return &v0alpha1.DataPlaneServiceList{} }),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the dataPlaneService, and returns the corresponding dataPlaneService object, and an error if there is any.
|
||||
func (c *dataPlaneServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v0alpha1.DataPlaneService, err error) {
|
||||
result = &v0alpha1.DataPlaneService{}
|
||||
err = c.client.Get().
|
||||
Resource("dataplaneservices").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of DataPlaneServices that match those selectors.
|
||||
func (c *dataPlaneServices) List(ctx context.Context, opts v1.ListOptions) (result *v0alpha1.DataPlaneServiceList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v0alpha1.DataPlaneServiceList{}
|
||||
err = c.client.Get().
|
||||
Resource("dataplaneservices").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested dataPlaneServices.
|
||||
func (c *dataPlaneServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("dataplaneservices").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a dataPlaneService and creates it. Returns the server's representation of the dataPlaneService, and an error, if there is any.
|
||||
func (c *dataPlaneServices) Create(ctx context.Context, dataPlaneService *v0alpha1.DataPlaneService, opts v1.CreateOptions) (result *v0alpha1.DataPlaneService, err error) {
|
||||
result = &v0alpha1.DataPlaneService{}
|
||||
err = c.client.Post().
|
||||
Resource("dataplaneservices").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(dataPlaneService).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a dataPlaneService and updates it. Returns the server's representation of the dataPlaneService, and an error, if there is any.
|
||||
func (c *dataPlaneServices) Update(ctx context.Context, dataPlaneService *v0alpha1.DataPlaneService, opts v1.UpdateOptions) (result *v0alpha1.DataPlaneService, err error) {
|
||||
result = &v0alpha1.DataPlaneService{}
|
||||
err = c.client.Put().
|
||||
Resource("dataplaneservices").
|
||||
Name(dataPlaneService.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(dataPlaneService).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *dataPlaneServices) UpdateStatus(ctx context.Context, dataPlaneService *v0alpha1.DataPlaneService, opts v1.UpdateOptions) (result *v0alpha1.DataPlaneService, err error) {
|
||||
result = &v0alpha1.DataPlaneService{}
|
||||
err = c.client.Put().
|
||||
Resource("dataplaneservices").
|
||||
Name(dataPlaneService.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(dataPlaneService).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the dataPlaneService and deletes it. Returns an error if one occurs.
|
||||
func (c *dataPlaneServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("dataplaneservices").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *dataPlaneServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Resource("dataplaneservices").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched dataPlaneService.
|
||||
func (c *dataPlaneServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v0alpha1.DataPlaneService, err error) {
|
||||
result = &v0alpha1.DataPlaneService{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("dataplaneservices").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Apply takes the given apply declarative configuration, applies it and returns the applied dataPlaneService.
|
||||
func (c *dataPlaneServices) Apply(ctx context.Context, dataPlaneService *aggregationv0alpha1.DataPlaneServiceApplyConfiguration, opts v1.ApplyOptions) (result *v0alpha1.DataPlaneService, err error) {
|
||||
if dataPlaneService == nil {
|
||||
return nil, fmt.Errorf("dataPlaneService provided to Apply must not be nil")
|
||||
}
|
||||
patchOpts := opts.ToPatchOptions()
|
||||
data, err := json.Marshal(dataPlaneService)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
name := dataPlaneService.Name
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("dataPlaneService.Name must be provided to Apply")
|
||||
}
|
||||
result = &v0alpha1.DataPlaneService{}
|
||||
err = c.client.Patch(types.ApplyPatchType).
|
||||
Resource("dataplaneservices").
|
||||
Name(*name).
|
||||
VersionedParams(&patchOpts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// ApplyStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
func (c *dataPlaneServices) ApplyStatus(ctx context.Context, dataPlaneService *aggregationv0alpha1.DataPlaneServiceApplyConfiguration, opts v1.ApplyOptions) (result *v0alpha1.DataPlaneService, err error) {
|
||||
if dataPlaneService == nil {
|
||||
return nil, fmt.Errorf("dataPlaneService provided to Apply must not be nil")
|
||||
}
|
||||
patchOpts := opts.ToPatchOptions()
|
||||
data, err := json.Marshal(dataPlaneService)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
name := dataPlaneService.Name
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("dataPlaneService.Name must be provided to Apply")
|
||||
}
|
||||
|
||||
result = &v0alpha1.DataPlaneService{}
|
||||
err = c.client.Patch(types.ApplyPatchType).
|
||||
Resource("dataplaneservices").
|
||||
Name(*name).
|
||||
SubResource("status").
|
||||
VersionedParams(&patchOpts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
@ -29,20 +29,22 @@ var dataplaneservicesKind = v0alpha1.SchemeGroupVersion.WithKind("DataPlaneServi
|
||||
|
||||
// Get takes name of the dataPlaneService, and returns the corresponding dataPlaneService object, and an error if there is any.
|
||||
func (c *FakeDataPlaneServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v0alpha1.DataPlaneService, err error) {
|
||||
emptyResult := &v0alpha1.DataPlaneService{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(dataplaneservicesResource, name), &v0alpha1.DataPlaneService{})
|
||||
Invokes(testing.NewRootGetActionWithOptions(dataplaneservicesResource, name, options), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v0alpha1.DataPlaneService), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of DataPlaneServices that match those selectors.
|
||||
func (c *FakeDataPlaneServices) List(ctx context.Context, opts v1.ListOptions) (result *v0alpha1.DataPlaneServiceList, err error) {
|
||||
emptyResult := &v0alpha1.DataPlaneServiceList{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(dataplaneservicesResource, dataplaneservicesKind, opts), &v0alpha1.DataPlaneServiceList{})
|
||||
Invokes(testing.NewRootListActionWithOptions(dataplaneservicesResource, dataplaneservicesKind, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
@ -61,36 +63,39 @@ func (c *FakeDataPlaneServices) List(ctx context.Context, opts v1.ListOptions) (
|
||||
// Watch returns a watch.Interface that watches the requested dataPlaneServices.
|
||||
func (c *FakeDataPlaneServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(dataplaneservicesResource, opts))
|
||||
InvokesWatch(testing.NewRootWatchActionWithOptions(dataplaneservicesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a dataPlaneService and creates it. Returns the server's representation of the dataPlaneService, and an error, if there is any.
|
||||
func (c *FakeDataPlaneServices) Create(ctx context.Context, dataPlaneService *v0alpha1.DataPlaneService, opts v1.CreateOptions) (result *v0alpha1.DataPlaneService, err error) {
|
||||
emptyResult := &v0alpha1.DataPlaneService{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(dataplaneservicesResource, dataPlaneService), &v0alpha1.DataPlaneService{})
|
||||
Invokes(testing.NewRootCreateActionWithOptions(dataplaneservicesResource, dataPlaneService, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v0alpha1.DataPlaneService), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a dataPlaneService and updates it. Returns the server's representation of the dataPlaneService, and an error, if there is any.
|
||||
func (c *FakeDataPlaneServices) Update(ctx context.Context, dataPlaneService *v0alpha1.DataPlaneService, opts v1.UpdateOptions) (result *v0alpha1.DataPlaneService, err error) {
|
||||
emptyResult := &v0alpha1.DataPlaneService{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(dataplaneservicesResource, dataPlaneService), &v0alpha1.DataPlaneService{})
|
||||
Invokes(testing.NewRootUpdateActionWithOptions(dataplaneservicesResource, dataPlaneService, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v0alpha1.DataPlaneService), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeDataPlaneServices) UpdateStatus(ctx context.Context, dataPlaneService *v0alpha1.DataPlaneService, opts v1.UpdateOptions) (*v0alpha1.DataPlaneService, error) {
|
||||
func (c *FakeDataPlaneServices) UpdateStatus(ctx context.Context, dataPlaneService *v0alpha1.DataPlaneService, opts v1.UpdateOptions) (result *v0alpha1.DataPlaneService, err error) {
|
||||
emptyResult := &v0alpha1.DataPlaneService{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateSubresourceAction(dataplaneservicesResource, "status", dataPlaneService), &v0alpha1.DataPlaneService{})
|
||||
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(dataplaneservicesResource, "status", dataPlaneService, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v0alpha1.DataPlaneService), err
|
||||
}
|
||||
@ -104,7 +109,7 @@ func (c *FakeDataPlaneServices) Delete(ctx context.Context, name string, opts v1
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeDataPlaneServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(dataplaneservicesResource, listOpts)
|
||||
action := testing.NewRootDeleteCollectionActionWithOptions(dataplaneservicesResource, opts, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v0alpha1.DataPlaneServiceList{})
|
||||
return err
|
||||
@ -112,10 +117,11 @@ func (c *FakeDataPlaneServices) DeleteCollection(ctx context.Context, opts v1.De
|
||||
|
||||
// Patch applies the patch and returns the patched dataPlaneService.
|
||||
func (c *FakeDataPlaneServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v0alpha1.DataPlaneService, err error) {
|
||||
emptyResult := &v0alpha1.DataPlaneService{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(dataplaneservicesResource, name, pt, data, subresources...), &v0alpha1.DataPlaneService{})
|
||||
Invokes(testing.NewRootPatchSubresourceActionWithOptions(dataplaneservicesResource, name, pt, data, opts, subresources...), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v0alpha1.DataPlaneService), err
|
||||
}
|
||||
@ -133,10 +139,11 @@ func (c *FakeDataPlaneServices) Apply(ctx context.Context, dataPlaneService *agg
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("dataPlaneService.Name must be provided to Apply")
|
||||
}
|
||||
emptyResult := &v0alpha1.DataPlaneService{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(dataplaneservicesResource, *name, types.ApplyPatchType, data), &v0alpha1.DataPlaneService{})
|
||||
Invokes(testing.NewRootPatchSubresourceActionWithOptions(dataplaneservicesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v0alpha1.DataPlaneService), err
|
||||
}
|
||||
@ -155,10 +162,11 @@ func (c *FakeDataPlaneServices) ApplyStatus(ctx context.Context, dataPlaneServic
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("dataPlaneService.Name must be provided to Apply")
|
||||
}
|
||||
emptyResult := &v0alpha1.DataPlaneService{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(dataplaneservicesResource, *name, types.ApplyPatchType, data, "status"), &v0alpha1.DataPlaneService{})
|
||||
Invokes(testing.NewRootPatchSubresourceActionWithOptions(dataplaneservicesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v0alpha1.DataPlaneService), err
|
||||
}
|
||||
|
@ -214,6 +214,7 @@ type SharedInformerFactory interface {
|
||||
|
||||
// Start initializes all requested informers. They are handled in goroutines
|
||||
// which run until the stop channel gets closed.
|
||||
// Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync.
|
||||
Start(stopCh <-chan struct{})
|
||||
|
||||
// Shutdown marks a factory as shutting down. At that point no new
|
||||
|
@ -6,8 +6,8 @@ package v0alpha1
|
||||
|
||||
import (
|
||||
v0alpha1 "github.com/grafana/grafana/pkg/aggregator/apis/aggregation/v0alpha1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
@ -25,30 +25,10 @@ type DataPlaneServiceLister interface {
|
||||
|
||||
// dataPlaneServiceLister implements the DataPlaneServiceLister interface.
|
||||
type dataPlaneServiceLister struct {
|
||||
indexer cache.Indexer
|
||||
listers.ResourceIndexer[*v0alpha1.DataPlaneService]
|
||||
}
|
||||
|
||||
// NewDataPlaneServiceLister returns a new DataPlaneServiceLister.
|
||||
func NewDataPlaneServiceLister(indexer cache.Indexer) DataPlaneServiceLister {
|
||||
return &dataPlaneServiceLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all DataPlaneServices in the indexer.
|
||||
func (s *dataPlaneServiceLister) List(selector labels.Selector) (ret []*v0alpha1.DataPlaneService, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v0alpha1.DataPlaneService))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the DataPlaneService from the index for a given name.
|
||||
func (s *dataPlaneServiceLister) Get(name string) (*v0alpha1.DataPlaneService, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v0alpha1.Resource("dataplaneservice"), name)
|
||||
}
|
||||
return obj.(*v0alpha1.DataPlaneService), nil
|
||||
return &dataPlaneServiceLister{listers.New[*v0alpha1.DataPlaneService](indexer, v0alpha1.Resource("dataplaneservice"))}
|
||||
}
|
||||
|
Reference in New Issue
Block a user