mirror of
https://github.com/rancher/types.git
synced 2025-08-02 05:11:59 +00:00
go generate changes
This commit is contained in:
parent
3a8fb642e6
commit
637b5c2119
File diff suppressed because it is too large
Load Diff
1789
apis/management.cattle.io/v3/fakes/zz_generated_cis_config_mock.go
Normal file
1789
apis/management.cattle.io/v3/fakes/zz_generated_cis_config_mock.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,509 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/rancher/norman/controller"
|
||||
"github.com/rancher/norman/objectclient"
|
||||
"github.com/rancher/norman/resource"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
var (
|
||||
CisBenchmarkVersionGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: Version,
|
||||
Group: GroupName,
|
||||
Kind: "CisBenchmarkVersion",
|
||||
}
|
||||
CisBenchmarkVersionResource = metav1.APIResource{
|
||||
Name: "cisbenchmarkversions",
|
||||
SingularName: "cisbenchmarkversion",
|
||||
Namespaced: true,
|
||||
|
||||
Kind: CisBenchmarkVersionGroupVersionKind.Kind,
|
||||
}
|
||||
|
||||
CisBenchmarkVersionGroupVersionResource = schema.GroupVersionResource{
|
||||
Group: GroupName,
|
||||
Version: Version,
|
||||
Resource: "cisbenchmarkversions",
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
resource.Put(CisBenchmarkVersionGroupVersionResource)
|
||||
}
|
||||
|
||||
func NewCisBenchmarkVersion(namespace, name string, obj CisBenchmarkVersion) *CisBenchmarkVersion {
|
||||
obj.APIVersion, obj.Kind = CisBenchmarkVersionGroupVersionKind.ToAPIVersionAndKind()
|
||||
obj.Name = name
|
||||
obj.Namespace = namespace
|
||||
return &obj
|
||||
}
|
||||
|
||||
type CisBenchmarkVersionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []CisBenchmarkVersion `json:"items"`
|
||||
}
|
||||
|
||||
type CisBenchmarkVersionHandlerFunc func(key string, obj *CisBenchmarkVersion) (runtime.Object, error)
|
||||
|
||||
type CisBenchmarkVersionChangeHandlerFunc func(obj *CisBenchmarkVersion) (runtime.Object, error)
|
||||
|
||||
type CisBenchmarkVersionLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*CisBenchmarkVersion, err error)
|
||||
Get(namespace, name string) (*CisBenchmarkVersion, error)
|
||||
}
|
||||
|
||||
type CisBenchmarkVersionController interface {
|
||||
Generic() controller.GenericController
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() CisBenchmarkVersionLister
|
||||
AddHandler(ctx context.Context, name string, handler CisBenchmarkVersionHandlerFunc)
|
||||
AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync CisBenchmarkVersionHandlerFunc)
|
||||
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler CisBenchmarkVersionHandlerFunc)
|
||||
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler CisBenchmarkVersionHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type CisBenchmarkVersionInterface interface {
|
||||
ObjectClient() *objectclient.ObjectClient
|
||||
Create(*CisBenchmarkVersion) (*CisBenchmarkVersion, error)
|
||||
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*CisBenchmarkVersion, error)
|
||||
Get(name string, opts metav1.GetOptions) (*CisBenchmarkVersion, error)
|
||||
Update(*CisBenchmarkVersion) (*CisBenchmarkVersion, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*CisBenchmarkVersionList, error)
|
||||
ListNamespaced(namespace string, opts metav1.ListOptions) (*CisBenchmarkVersionList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() CisBenchmarkVersionController
|
||||
AddHandler(ctx context.Context, name string, sync CisBenchmarkVersionHandlerFunc)
|
||||
AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync CisBenchmarkVersionHandlerFunc)
|
||||
AddLifecycle(ctx context.Context, name string, lifecycle CisBenchmarkVersionLifecycle)
|
||||
AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle CisBenchmarkVersionLifecycle)
|
||||
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync CisBenchmarkVersionHandlerFunc)
|
||||
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync CisBenchmarkVersionHandlerFunc)
|
||||
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle CisBenchmarkVersionLifecycle)
|
||||
AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle CisBenchmarkVersionLifecycle)
|
||||
}
|
||||
|
||||
type cisBenchmarkVersionLister struct {
|
||||
controller *cisBenchmarkVersionController
|
||||
}
|
||||
|
||||
func (l *cisBenchmarkVersionLister) List(namespace string, selector labels.Selector) (ret []*CisBenchmarkVersion, err error) {
|
||||
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
|
||||
ret = append(ret, obj.(*CisBenchmarkVersion))
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (l *cisBenchmarkVersionLister) Get(namespace, name string) (*CisBenchmarkVersion, error) {
|
||||
var key string
|
||||
if namespace != "" {
|
||||
key = namespace + "/" + name
|
||||
} else {
|
||||
key = name
|
||||
}
|
||||
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(schema.GroupResource{
|
||||
Group: CisBenchmarkVersionGroupVersionKind.Group,
|
||||
Resource: "cisBenchmarkVersion",
|
||||
}, key)
|
||||
}
|
||||
return obj.(*CisBenchmarkVersion), nil
|
||||
}
|
||||
|
||||
type cisBenchmarkVersionController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *cisBenchmarkVersionController) Generic() controller.GenericController {
|
||||
return c.GenericController
|
||||
}
|
||||
|
||||
func (c *cisBenchmarkVersionController) Lister() CisBenchmarkVersionLister {
|
||||
return &cisBenchmarkVersionLister{
|
||||
controller: c,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *cisBenchmarkVersionController) AddHandler(ctx context.Context, name string, handler CisBenchmarkVersionHandlerFunc) {
|
||||
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
|
||||
if obj == nil {
|
||||
return handler(key, nil)
|
||||
} else if v, ok := obj.(*CisBenchmarkVersion); ok {
|
||||
return handler(key, v)
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (c *cisBenchmarkVersionController) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, handler CisBenchmarkVersionHandlerFunc) {
|
||||
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
|
||||
if !enabled() {
|
||||
return nil, nil
|
||||
} else if obj == nil {
|
||||
return handler(key, nil)
|
||||
} else if v, ok := obj.(*CisBenchmarkVersion); ok {
|
||||
return handler(key, v)
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (c *cisBenchmarkVersionController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler CisBenchmarkVersionHandlerFunc) {
|
||||
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
|
||||
if obj == nil {
|
||||
return handler(key, nil)
|
||||
} else if v, ok := obj.(*CisBenchmarkVersion); ok && controller.ObjectInCluster(cluster, obj) {
|
||||
return handler(key, v)
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (c *cisBenchmarkVersionController) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, cluster string, handler CisBenchmarkVersionHandlerFunc) {
|
||||
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
|
||||
if !enabled() {
|
||||
return nil, nil
|
||||
} else if obj == nil {
|
||||
return handler(key, nil)
|
||||
} else if v, ok := obj.(*CisBenchmarkVersion); ok && controller.ObjectInCluster(cluster, obj) {
|
||||
return handler(key, v)
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
type cisBenchmarkVersionFactory struct {
|
||||
}
|
||||
|
||||
func (c cisBenchmarkVersionFactory) Object() runtime.Object {
|
||||
return &CisBenchmarkVersion{}
|
||||
}
|
||||
|
||||
func (c cisBenchmarkVersionFactory) List() runtime.Object {
|
||||
return &CisBenchmarkVersionList{}
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) Controller() CisBenchmarkVersionController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.cisBenchmarkVersionControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(CisBenchmarkVersionGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
|
||||
c = &cisBenchmarkVersionController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.cisBenchmarkVersionControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type cisBenchmarkVersionClient struct {
|
||||
client *Client
|
||||
ns string
|
||||
objectClient *objectclient.ObjectClient
|
||||
controller CisBenchmarkVersionController
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) ObjectClient() *objectclient.ObjectClient {
|
||||
return s.objectClient
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) Create(o *CisBenchmarkVersion) (*CisBenchmarkVersion, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*CisBenchmarkVersion), err
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) Get(name string, opts metav1.GetOptions) (*CisBenchmarkVersion, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*CisBenchmarkVersion), err
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*CisBenchmarkVersion, error) {
|
||||
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
|
||||
return obj.(*CisBenchmarkVersion), err
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) Update(o *CisBenchmarkVersion) (*CisBenchmarkVersion, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*CisBenchmarkVersion), err
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) List(opts metav1.ListOptions) (*CisBenchmarkVersionList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*CisBenchmarkVersionList), err
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) ListNamespaced(namespace string, opts metav1.ListOptions) (*CisBenchmarkVersionList, error) {
|
||||
obj, err := s.objectClient.ListNamespaced(namespace, opts)
|
||||
return obj.(*CisBenchmarkVersionList), err
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched deployment.
|
||||
func (s *cisBenchmarkVersionClient) Patch(o *CisBenchmarkVersion, patchType types.PatchType, data []byte, subresources ...string) (*CisBenchmarkVersion, error) {
|
||||
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
|
||||
return obj.(*CisBenchmarkVersion), err
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) AddHandler(ctx context.Context, name string, sync CisBenchmarkVersionHandlerFunc) {
|
||||
s.Controller().AddHandler(ctx, name, sync)
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync CisBenchmarkVersionHandlerFunc) {
|
||||
s.Controller().AddFeatureHandler(ctx, enabled, name, sync)
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) AddLifecycle(ctx context.Context, name string, lifecycle CisBenchmarkVersionLifecycle) {
|
||||
sync := NewCisBenchmarkVersionLifecycleAdapter(name, false, s, lifecycle)
|
||||
s.Controller().AddHandler(ctx, name, sync)
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle CisBenchmarkVersionLifecycle) {
|
||||
sync := NewCisBenchmarkVersionLifecycleAdapter(name, false, s, lifecycle)
|
||||
s.Controller().AddFeatureHandler(ctx, enabled, name, sync)
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync CisBenchmarkVersionHandlerFunc) {
|
||||
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync CisBenchmarkVersionHandlerFunc) {
|
||||
s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync)
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle CisBenchmarkVersionLifecycle) {
|
||||
sync := NewCisBenchmarkVersionLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
|
||||
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
|
||||
}
|
||||
|
||||
func (s *cisBenchmarkVersionClient) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle CisBenchmarkVersionLifecycle) {
|
||||
sync := NewCisBenchmarkVersionLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
|
||||
s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync)
|
||||
}
|
||||
|
||||
type CisBenchmarkVersionIndexer func(obj *CisBenchmarkVersion) ([]string, error)
|
||||
|
||||
type CisBenchmarkVersionClientCache interface {
|
||||
Get(namespace, name string) (*CisBenchmarkVersion, error)
|
||||
List(namespace string, selector labels.Selector) ([]*CisBenchmarkVersion, error)
|
||||
|
||||
Index(name string, indexer CisBenchmarkVersionIndexer)
|
||||
GetIndexed(name, key string) ([]*CisBenchmarkVersion, error)
|
||||
}
|
||||
|
||||
type CisBenchmarkVersionClient interface {
|
||||
Create(*CisBenchmarkVersion) (*CisBenchmarkVersion, error)
|
||||
Get(namespace, name string, opts metav1.GetOptions) (*CisBenchmarkVersion, error)
|
||||
Update(*CisBenchmarkVersion) (*CisBenchmarkVersion, error)
|
||||
Delete(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(namespace string, opts metav1.ListOptions) (*CisBenchmarkVersionList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
|
||||
Cache() CisBenchmarkVersionClientCache
|
||||
|
||||
OnCreate(ctx context.Context, name string, sync CisBenchmarkVersionChangeHandlerFunc)
|
||||
OnChange(ctx context.Context, name string, sync CisBenchmarkVersionChangeHandlerFunc)
|
||||
OnRemove(ctx context.Context, name string, sync CisBenchmarkVersionChangeHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
|
||||
Generic() controller.GenericController
|
||||
ObjectClient() *objectclient.ObjectClient
|
||||
Interface() CisBenchmarkVersionInterface
|
||||
}
|
||||
|
||||
type cisBenchmarkVersionClientCache struct {
|
||||
client *cisBenchmarkVersionClient2
|
||||
}
|
||||
|
||||
type cisBenchmarkVersionClient2 struct {
|
||||
iface CisBenchmarkVersionInterface
|
||||
controller CisBenchmarkVersionController
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) Interface() CisBenchmarkVersionInterface {
|
||||
return n.iface
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) Generic() controller.GenericController {
|
||||
return n.iface.Controller().Generic()
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) ObjectClient() *objectclient.ObjectClient {
|
||||
return n.Interface().ObjectClient()
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) Enqueue(namespace, name string) {
|
||||
n.iface.Controller().Enqueue(namespace, name)
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) Create(obj *CisBenchmarkVersion) (*CisBenchmarkVersion, error) {
|
||||
return n.iface.Create(obj)
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) Get(namespace, name string, opts metav1.GetOptions) (*CisBenchmarkVersion, error) {
|
||||
return n.iface.GetNamespaced(namespace, name, opts)
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) Update(obj *CisBenchmarkVersion) (*CisBenchmarkVersion, error) {
|
||||
return n.iface.Update(obj)
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
|
||||
return n.iface.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) List(namespace string, opts metav1.ListOptions) (*CisBenchmarkVersionList, error) {
|
||||
return n.iface.List(opts)
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return n.iface.Watch(opts)
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClientCache) Get(namespace, name string) (*CisBenchmarkVersion, error) {
|
||||
return n.client.controller.Lister().Get(namespace, name)
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClientCache) List(namespace string, selector labels.Selector) ([]*CisBenchmarkVersion, error) {
|
||||
return n.client.controller.Lister().List(namespace, selector)
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) Cache() CisBenchmarkVersionClientCache {
|
||||
n.loadController()
|
||||
return &cisBenchmarkVersionClientCache{
|
||||
client: n,
|
||||
}
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) OnCreate(ctx context.Context, name string, sync CisBenchmarkVersionChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name+"-create", &cisBenchmarkVersionLifecycleDelegate{create: sync})
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) OnChange(ctx context.Context, name string, sync CisBenchmarkVersionChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name+"-change", &cisBenchmarkVersionLifecycleDelegate{update: sync})
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) OnRemove(ctx context.Context, name string, sync CisBenchmarkVersionChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &cisBenchmarkVersionLifecycleDelegate{remove: sync})
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClientCache) Index(name string, indexer CisBenchmarkVersionIndexer) {
|
||||
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
|
||||
name: func(obj interface{}) ([]string, error) {
|
||||
if v, ok := obj.(*CisBenchmarkVersion); ok {
|
||||
return indexer(v)
|
||||
}
|
||||
return nil, nil
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClientCache) GetIndexed(name, key string) ([]*CisBenchmarkVersion, error) {
|
||||
var result []*CisBenchmarkVersion
|
||||
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, obj := range objs {
|
||||
if v, ok := obj.(*CisBenchmarkVersion); ok {
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionClient2) loadController() {
|
||||
if n.controller == nil {
|
||||
n.controller = n.iface.Controller()
|
||||
}
|
||||
}
|
||||
|
||||
type cisBenchmarkVersionLifecycleDelegate struct {
|
||||
create CisBenchmarkVersionChangeHandlerFunc
|
||||
update CisBenchmarkVersionChangeHandlerFunc
|
||||
remove CisBenchmarkVersionChangeHandlerFunc
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionLifecycleDelegate) HasCreate() bool {
|
||||
return n.create != nil
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionLifecycleDelegate) Create(obj *CisBenchmarkVersion) (runtime.Object, error) {
|
||||
if n.create == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.create(obj)
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionLifecycleDelegate) HasFinalize() bool {
|
||||
return n.remove != nil
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionLifecycleDelegate) Remove(obj *CisBenchmarkVersion) (runtime.Object, error) {
|
||||
if n.remove == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.remove(obj)
|
||||
}
|
||||
|
||||
func (n *cisBenchmarkVersionLifecycleDelegate) Updated(obj *CisBenchmarkVersion) (runtime.Object, error) {
|
||||
if n.update == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.update(obj)
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/lifecycle"
|
||||
"github.com/rancher/norman/resource"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
type CisBenchmarkVersionLifecycle interface {
|
||||
Create(obj *CisBenchmarkVersion) (runtime.Object, error)
|
||||
Remove(obj *CisBenchmarkVersion) (runtime.Object, error)
|
||||
Updated(obj *CisBenchmarkVersion) (runtime.Object, error)
|
||||
}
|
||||
|
||||
type cisBenchmarkVersionLifecycleAdapter struct {
|
||||
lifecycle CisBenchmarkVersionLifecycle
|
||||
}
|
||||
|
||||
func (w *cisBenchmarkVersionLifecycleAdapter) HasCreate() bool {
|
||||
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
|
||||
return !ok || o.HasCreate()
|
||||
}
|
||||
|
||||
func (w *cisBenchmarkVersionLifecycleAdapter) HasFinalize() bool {
|
||||
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
|
||||
return !ok || o.HasFinalize()
|
||||
}
|
||||
|
||||
func (w *cisBenchmarkVersionLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Create(obj.(*CisBenchmarkVersion))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *cisBenchmarkVersionLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Remove(obj.(*CisBenchmarkVersion))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *cisBenchmarkVersionLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Updated(obj.(*CisBenchmarkVersion))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func NewCisBenchmarkVersionLifecycleAdapter(name string, clusterScoped bool, client CisBenchmarkVersionInterface, l CisBenchmarkVersionLifecycle) CisBenchmarkVersionHandlerFunc {
|
||||
if clusterScoped {
|
||||
resource.PutClusterScoped(CisBenchmarkVersionGroupVersionResource)
|
||||
}
|
||||
adapter := &cisBenchmarkVersionLifecycleAdapter{lifecycle: l}
|
||||
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
|
||||
return func(key string, obj *CisBenchmarkVersion) (runtime.Object, error) {
|
||||
newObj, err := syncFn(key, obj)
|
||||
if o, ok := newObj.(runtime.Object); ok {
|
||||
return o, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
}
|
@ -0,0 +1,509 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/rancher/norman/controller"
|
||||
"github.com/rancher/norman/objectclient"
|
||||
"github.com/rancher/norman/resource"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
var (
|
||||
CisConfigGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: Version,
|
||||
Group: GroupName,
|
||||
Kind: "CisConfig",
|
||||
}
|
||||
CisConfigResource = metav1.APIResource{
|
||||
Name: "cisconfigs",
|
||||
SingularName: "cisconfig",
|
||||
Namespaced: true,
|
||||
|
||||
Kind: CisConfigGroupVersionKind.Kind,
|
||||
}
|
||||
|
||||
CisConfigGroupVersionResource = schema.GroupVersionResource{
|
||||
Group: GroupName,
|
||||
Version: Version,
|
||||
Resource: "cisconfigs",
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
resource.Put(CisConfigGroupVersionResource)
|
||||
}
|
||||
|
||||
func NewCisConfig(namespace, name string, obj CisConfig) *CisConfig {
|
||||
obj.APIVersion, obj.Kind = CisConfigGroupVersionKind.ToAPIVersionAndKind()
|
||||
obj.Name = name
|
||||
obj.Namespace = namespace
|
||||
return &obj
|
||||
}
|
||||
|
||||
type CisConfigList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []CisConfig `json:"items"`
|
||||
}
|
||||
|
||||
type CisConfigHandlerFunc func(key string, obj *CisConfig) (runtime.Object, error)
|
||||
|
||||
type CisConfigChangeHandlerFunc func(obj *CisConfig) (runtime.Object, error)
|
||||
|
||||
type CisConfigLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*CisConfig, err error)
|
||||
Get(namespace, name string) (*CisConfig, error)
|
||||
}
|
||||
|
||||
type CisConfigController interface {
|
||||
Generic() controller.GenericController
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() CisConfigLister
|
||||
AddHandler(ctx context.Context, name string, handler CisConfigHandlerFunc)
|
||||
AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync CisConfigHandlerFunc)
|
||||
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler CisConfigHandlerFunc)
|
||||
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler CisConfigHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type CisConfigInterface interface {
|
||||
ObjectClient() *objectclient.ObjectClient
|
||||
Create(*CisConfig) (*CisConfig, error)
|
||||
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*CisConfig, error)
|
||||
Get(name string, opts metav1.GetOptions) (*CisConfig, error)
|
||||
Update(*CisConfig) (*CisConfig, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*CisConfigList, error)
|
||||
ListNamespaced(namespace string, opts metav1.ListOptions) (*CisConfigList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() CisConfigController
|
||||
AddHandler(ctx context.Context, name string, sync CisConfigHandlerFunc)
|
||||
AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync CisConfigHandlerFunc)
|
||||
AddLifecycle(ctx context.Context, name string, lifecycle CisConfigLifecycle)
|
||||
AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle CisConfigLifecycle)
|
||||
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync CisConfigHandlerFunc)
|
||||
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync CisConfigHandlerFunc)
|
||||
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle CisConfigLifecycle)
|
||||
AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle CisConfigLifecycle)
|
||||
}
|
||||
|
||||
type cisConfigLister struct {
|
||||
controller *cisConfigController
|
||||
}
|
||||
|
||||
func (l *cisConfigLister) List(namespace string, selector labels.Selector) (ret []*CisConfig, err error) {
|
||||
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
|
||||
ret = append(ret, obj.(*CisConfig))
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (l *cisConfigLister) Get(namespace, name string) (*CisConfig, error) {
|
||||
var key string
|
||||
if namespace != "" {
|
||||
key = namespace + "/" + name
|
||||
} else {
|
||||
key = name
|
||||
}
|
||||
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(schema.GroupResource{
|
||||
Group: CisConfigGroupVersionKind.Group,
|
||||
Resource: "cisConfig",
|
||||
}, key)
|
||||
}
|
||||
return obj.(*CisConfig), nil
|
||||
}
|
||||
|
||||
type cisConfigController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *cisConfigController) Generic() controller.GenericController {
|
||||
return c.GenericController
|
||||
}
|
||||
|
||||
func (c *cisConfigController) Lister() CisConfigLister {
|
||||
return &cisConfigLister{
|
||||
controller: c,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *cisConfigController) AddHandler(ctx context.Context, name string, handler CisConfigHandlerFunc) {
|
||||
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
|
||||
if obj == nil {
|
||||
return handler(key, nil)
|
||||
} else if v, ok := obj.(*CisConfig); ok {
|
||||
return handler(key, v)
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (c *cisConfigController) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, handler CisConfigHandlerFunc) {
|
||||
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
|
||||
if !enabled() {
|
||||
return nil, nil
|
||||
} else if obj == nil {
|
||||
return handler(key, nil)
|
||||
} else if v, ok := obj.(*CisConfig); ok {
|
||||
return handler(key, v)
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (c *cisConfigController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler CisConfigHandlerFunc) {
|
||||
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
|
||||
if obj == nil {
|
||||
return handler(key, nil)
|
||||
} else if v, ok := obj.(*CisConfig); ok && controller.ObjectInCluster(cluster, obj) {
|
||||
return handler(key, v)
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (c *cisConfigController) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, cluster string, handler CisConfigHandlerFunc) {
|
||||
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
|
||||
if !enabled() {
|
||||
return nil, nil
|
||||
} else if obj == nil {
|
||||
return handler(key, nil)
|
||||
} else if v, ok := obj.(*CisConfig); ok && controller.ObjectInCluster(cluster, obj) {
|
||||
return handler(key, v)
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
type cisConfigFactory struct {
|
||||
}
|
||||
|
||||
func (c cisConfigFactory) Object() runtime.Object {
|
||||
return &CisConfig{}
|
||||
}
|
||||
|
||||
func (c cisConfigFactory) List() runtime.Object {
|
||||
return &CisConfigList{}
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) Controller() CisConfigController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.cisConfigControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(CisConfigGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
|
||||
c = &cisConfigController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.cisConfigControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type cisConfigClient struct {
|
||||
client *Client
|
||||
ns string
|
||||
objectClient *objectclient.ObjectClient
|
||||
controller CisConfigController
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) ObjectClient() *objectclient.ObjectClient {
|
||||
return s.objectClient
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) Create(o *CisConfig) (*CisConfig, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*CisConfig), err
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) Get(name string, opts metav1.GetOptions) (*CisConfig, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*CisConfig), err
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*CisConfig, error) {
|
||||
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
|
||||
return obj.(*CisConfig), err
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) Update(o *CisConfig) (*CisConfig, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*CisConfig), err
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) List(opts metav1.ListOptions) (*CisConfigList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*CisConfigList), err
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) ListNamespaced(namespace string, opts metav1.ListOptions) (*CisConfigList, error) {
|
||||
obj, err := s.objectClient.ListNamespaced(namespace, opts)
|
||||
return obj.(*CisConfigList), err
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched deployment.
|
||||
func (s *cisConfigClient) Patch(o *CisConfig, patchType types.PatchType, data []byte, subresources ...string) (*CisConfig, error) {
|
||||
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
|
||||
return obj.(*CisConfig), err
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) AddHandler(ctx context.Context, name string, sync CisConfigHandlerFunc) {
|
||||
s.Controller().AddHandler(ctx, name, sync)
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync CisConfigHandlerFunc) {
|
||||
s.Controller().AddFeatureHandler(ctx, enabled, name, sync)
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) AddLifecycle(ctx context.Context, name string, lifecycle CisConfigLifecycle) {
|
||||
sync := NewCisConfigLifecycleAdapter(name, false, s, lifecycle)
|
||||
s.Controller().AddHandler(ctx, name, sync)
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle CisConfigLifecycle) {
|
||||
sync := NewCisConfigLifecycleAdapter(name, false, s, lifecycle)
|
||||
s.Controller().AddFeatureHandler(ctx, enabled, name, sync)
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync CisConfigHandlerFunc) {
|
||||
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync CisConfigHandlerFunc) {
|
||||
s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync)
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle CisConfigLifecycle) {
|
||||
sync := NewCisConfigLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
|
||||
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
|
||||
}
|
||||
|
||||
func (s *cisConfigClient) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle CisConfigLifecycle) {
|
||||
sync := NewCisConfigLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
|
||||
s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync)
|
||||
}
|
||||
|
||||
type CisConfigIndexer func(obj *CisConfig) ([]string, error)
|
||||
|
||||
type CisConfigClientCache interface {
|
||||
Get(namespace, name string) (*CisConfig, error)
|
||||
List(namespace string, selector labels.Selector) ([]*CisConfig, error)
|
||||
|
||||
Index(name string, indexer CisConfigIndexer)
|
||||
GetIndexed(name, key string) ([]*CisConfig, error)
|
||||
}
|
||||
|
||||
type CisConfigClient interface {
|
||||
Create(*CisConfig) (*CisConfig, error)
|
||||
Get(namespace, name string, opts metav1.GetOptions) (*CisConfig, error)
|
||||
Update(*CisConfig) (*CisConfig, error)
|
||||
Delete(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(namespace string, opts metav1.ListOptions) (*CisConfigList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
|
||||
Cache() CisConfigClientCache
|
||||
|
||||
OnCreate(ctx context.Context, name string, sync CisConfigChangeHandlerFunc)
|
||||
OnChange(ctx context.Context, name string, sync CisConfigChangeHandlerFunc)
|
||||
OnRemove(ctx context.Context, name string, sync CisConfigChangeHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
|
||||
Generic() controller.GenericController
|
||||
ObjectClient() *objectclient.ObjectClient
|
||||
Interface() CisConfigInterface
|
||||
}
|
||||
|
||||
type cisConfigClientCache struct {
|
||||
client *cisConfigClient2
|
||||
}
|
||||
|
||||
type cisConfigClient2 struct {
|
||||
iface CisConfigInterface
|
||||
controller CisConfigController
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) Interface() CisConfigInterface {
|
||||
return n.iface
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) Generic() controller.GenericController {
|
||||
return n.iface.Controller().Generic()
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) ObjectClient() *objectclient.ObjectClient {
|
||||
return n.Interface().ObjectClient()
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) Enqueue(namespace, name string) {
|
||||
n.iface.Controller().Enqueue(namespace, name)
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) Create(obj *CisConfig) (*CisConfig, error) {
|
||||
return n.iface.Create(obj)
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) Get(namespace, name string, opts metav1.GetOptions) (*CisConfig, error) {
|
||||
return n.iface.GetNamespaced(namespace, name, opts)
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) Update(obj *CisConfig) (*CisConfig, error) {
|
||||
return n.iface.Update(obj)
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
|
||||
return n.iface.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) List(namespace string, opts metav1.ListOptions) (*CisConfigList, error) {
|
||||
return n.iface.List(opts)
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return n.iface.Watch(opts)
|
||||
}
|
||||
|
||||
func (n *cisConfigClientCache) Get(namespace, name string) (*CisConfig, error) {
|
||||
return n.client.controller.Lister().Get(namespace, name)
|
||||
}
|
||||
|
||||
func (n *cisConfigClientCache) List(namespace string, selector labels.Selector) ([]*CisConfig, error) {
|
||||
return n.client.controller.Lister().List(namespace, selector)
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) Cache() CisConfigClientCache {
|
||||
n.loadController()
|
||||
return &cisConfigClientCache{
|
||||
client: n,
|
||||
}
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) OnCreate(ctx context.Context, name string, sync CisConfigChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name+"-create", &cisConfigLifecycleDelegate{create: sync})
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) OnChange(ctx context.Context, name string, sync CisConfigChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name+"-change", &cisConfigLifecycleDelegate{update: sync})
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) OnRemove(ctx context.Context, name string, sync CisConfigChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &cisConfigLifecycleDelegate{remove: sync})
|
||||
}
|
||||
|
||||
func (n *cisConfigClientCache) Index(name string, indexer CisConfigIndexer) {
|
||||
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
|
||||
name: func(obj interface{}) ([]string, error) {
|
||||
if v, ok := obj.(*CisConfig); ok {
|
||||
return indexer(v)
|
||||
}
|
||||
return nil, nil
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *cisConfigClientCache) GetIndexed(name, key string) ([]*CisConfig, error) {
|
||||
var result []*CisConfig
|
||||
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, obj := range objs {
|
||||
if v, ok := obj.(*CisConfig); ok {
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (n *cisConfigClient2) loadController() {
|
||||
if n.controller == nil {
|
||||
n.controller = n.iface.Controller()
|
||||
}
|
||||
}
|
||||
|
||||
type cisConfigLifecycleDelegate struct {
|
||||
create CisConfigChangeHandlerFunc
|
||||
update CisConfigChangeHandlerFunc
|
||||
remove CisConfigChangeHandlerFunc
|
||||
}
|
||||
|
||||
func (n *cisConfigLifecycleDelegate) HasCreate() bool {
|
||||
return n.create != nil
|
||||
}
|
||||
|
||||
func (n *cisConfigLifecycleDelegate) Create(obj *CisConfig) (runtime.Object, error) {
|
||||
if n.create == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.create(obj)
|
||||
}
|
||||
|
||||
func (n *cisConfigLifecycleDelegate) HasFinalize() bool {
|
||||
return n.remove != nil
|
||||
}
|
||||
|
||||
func (n *cisConfigLifecycleDelegate) Remove(obj *CisConfig) (runtime.Object, error) {
|
||||
if n.remove == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.remove(obj)
|
||||
}
|
||||
|
||||
func (n *cisConfigLifecycleDelegate) Updated(obj *CisConfig) (runtime.Object, error) {
|
||||
if n.update == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.update(obj)
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/lifecycle"
|
||||
"github.com/rancher/norman/resource"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
type CisConfigLifecycle interface {
|
||||
Create(obj *CisConfig) (runtime.Object, error)
|
||||
Remove(obj *CisConfig) (runtime.Object, error)
|
||||
Updated(obj *CisConfig) (runtime.Object, error)
|
||||
}
|
||||
|
||||
type cisConfigLifecycleAdapter struct {
|
||||
lifecycle CisConfigLifecycle
|
||||
}
|
||||
|
||||
func (w *cisConfigLifecycleAdapter) HasCreate() bool {
|
||||
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
|
||||
return !ok || o.HasCreate()
|
||||
}
|
||||
|
||||
func (w *cisConfigLifecycleAdapter) HasFinalize() bool {
|
||||
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
|
||||
return !ok || o.HasFinalize()
|
||||
}
|
||||
|
||||
func (w *cisConfigLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Create(obj.(*CisConfig))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *cisConfigLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Remove(obj.(*CisConfig))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *cisConfigLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Updated(obj.(*CisConfig))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func NewCisConfigLifecycleAdapter(name string, clusterScoped bool, client CisConfigInterface, l CisConfigLifecycle) CisConfigHandlerFunc {
|
||||
if clusterScoped {
|
||||
resource.PutClusterScoped(CisConfigGroupVersionResource)
|
||||
}
|
||||
adapter := &cisConfigLifecycleAdapter{lifecycle: l}
|
||||
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
|
||||
return func(key string, obj *CisConfig) (runtime.Object, error) {
|
||||
newObj, err := syncFn(key, obj)
|
||||
if o, ok := newObj.(runtime.Object); ok {
|
||||
return o, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
}
|
@ -924,6 +924,160 @@ func (in *ChangePasswordInput) DeepCopy() *ChangePasswordInput {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CisBenchmarkVersion) DeepCopyInto(out *CisBenchmarkVersion) {
|
||||
*out = *in
|
||||
out.Namespaced = in.Namespaced
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Info = in.Info
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CisBenchmarkVersion.
|
||||
func (in *CisBenchmarkVersion) DeepCopy() *CisBenchmarkVersion {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CisBenchmarkVersion)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *CisBenchmarkVersion) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CisBenchmarkVersionInfo) DeepCopyInto(out *CisBenchmarkVersionInfo) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CisBenchmarkVersionInfo.
|
||||
func (in *CisBenchmarkVersionInfo) DeepCopy() *CisBenchmarkVersionInfo {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CisBenchmarkVersionInfo)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CisBenchmarkVersionList) DeepCopyInto(out *CisBenchmarkVersionList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]CisBenchmarkVersion, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CisBenchmarkVersionList.
|
||||
func (in *CisBenchmarkVersionList) DeepCopy() *CisBenchmarkVersionList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CisBenchmarkVersionList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *CisBenchmarkVersionList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CisConfig) DeepCopyInto(out *CisConfig) {
|
||||
*out = *in
|
||||
out.Namespaced = in.Namespaced
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Params = in.Params
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CisConfig.
|
||||
func (in *CisConfig) DeepCopy() *CisConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CisConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *CisConfig) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CisConfigList) DeepCopyInto(out *CisConfigList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]CisConfig, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CisConfigList.
|
||||
func (in *CisConfigList) DeepCopy() *CisConfigList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CisConfigList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *CisConfigList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CisConfigParams) DeepCopyInto(out *CisConfigParams) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CisConfigParams.
|
||||
func (in *CisConfigParams) DeepCopy() *CisConfigParams {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CisConfigParams)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CisScanConfig) DeepCopyInto(out *CisScanConfig) {
|
||||
*out = *in
|
||||
|
@ -82,6 +82,8 @@ type Interface interface {
|
||||
RKEK8sSystemImagesGetter
|
||||
RKEK8sServiceOptionsGetter
|
||||
RKEAddonsGetter
|
||||
CisConfigsGetter
|
||||
CisBenchmarkVersionsGetter
|
||||
}
|
||||
|
||||
type Clients struct {
|
||||
@ -149,6 +151,8 @@ type Clients struct {
|
||||
RKEK8sSystemImage RKEK8sSystemImageClient
|
||||
RKEK8sServiceOption RKEK8sServiceOptionClient
|
||||
RKEAddon RKEAddonClient
|
||||
CisConfig CisConfigClient
|
||||
CisBenchmarkVersion CisBenchmarkVersionClient
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
@ -218,6 +222,8 @@ type Client struct {
|
||||
rkeK8sSystemImageControllers map[string]RKEK8sSystemImageController
|
||||
rkeK8sServiceOptionControllers map[string]RKEK8sServiceOptionController
|
||||
rkeAddonControllers map[string]RKEAddonController
|
||||
cisConfigControllers map[string]CisConfigController
|
||||
cisBenchmarkVersionControllers map[string]CisBenchmarkVersionController
|
||||
}
|
||||
|
||||
func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) {
|
||||
@ -439,6 +445,12 @@ func NewClientsFromInterface(iface Interface) *Clients {
|
||||
RKEAddon: &rkeAddonClient2{
|
||||
iface: iface.RKEAddons(""),
|
||||
},
|
||||
CisConfig: &cisConfigClient2{
|
||||
iface: iface.CisConfigs(""),
|
||||
},
|
||||
CisBenchmarkVersion: &cisBenchmarkVersionClient2{
|
||||
iface: iface.CisBenchmarkVersions(""),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,6 +529,8 @@ func NewForConfig(config rest.Config) (Interface, error) {
|
||||
rkeK8sSystemImageControllers: map[string]RKEK8sSystemImageController{},
|
||||
rkeK8sServiceOptionControllers: map[string]RKEK8sServiceOptionController{},
|
||||
rkeAddonControllers: map[string]RKEAddonController{},
|
||||
cisConfigControllers: map[string]CisConfigController{},
|
||||
cisBenchmarkVersionControllers: map[string]CisBenchmarkVersionController{},
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -1337,3 +1351,29 @@ func (c *Client) RKEAddons(namespace string) RKEAddonInterface {
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
||||
|
||||
type CisConfigsGetter interface {
|
||||
CisConfigs(namespace string) CisConfigInterface
|
||||
}
|
||||
|
||||
func (c *Client) CisConfigs(namespace string) CisConfigInterface {
|
||||
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &CisConfigResource, CisConfigGroupVersionKind, cisConfigFactory{})
|
||||
return &cisConfigClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
||||
|
||||
type CisBenchmarkVersionsGetter interface {
|
||||
CisBenchmarkVersions(namespace string) CisBenchmarkVersionInterface
|
||||
}
|
||||
|
||||
func (c *Client) CisBenchmarkVersions(namespace string) CisBenchmarkVersionInterface {
|
||||
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &CisBenchmarkVersionResource, CisBenchmarkVersionGroupVersionKind, cisBenchmarkVersionFactory{})
|
||||
return &cisBenchmarkVersionClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
||||
|
@ -157,6 +157,10 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
&RKEK8sServiceOptionList{},
|
||||
&RKEAddon{},
|
||||
&RKEAddonList{},
|
||||
&CisConfig{},
|
||||
&CisConfigList{},
|
||||
&CisBenchmarkVersion{},
|
||||
&CisBenchmarkVersionList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
|
101
client/management/v3/zz_generated_cis_benchmark_version.go
Normal file
101
client/management/v3/zz_generated_cis_benchmark_version.go
Normal file
@ -0,0 +1,101 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/types"
|
||||
)
|
||||
|
||||
const (
|
||||
CisBenchmarkVersionType = "cisBenchmarkVersion"
|
||||
CisBenchmarkVersionFieldAnnotations = "annotations"
|
||||
CisBenchmarkVersionFieldCreated = "created"
|
||||
CisBenchmarkVersionFieldCreatorID = "creatorId"
|
||||
CisBenchmarkVersionFieldInfo = "info"
|
||||
CisBenchmarkVersionFieldLabels = "labels"
|
||||
CisBenchmarkVersionFieldName = "name"
|
||||
CisBenchmarkVersionFieldOwnerReferences = "ownerReferences"
|
||||
CisBenchmarkVersionFieldRemoved = "removed"
|
||||
CisBenchmarkVersionFieldUUID = "uuid"
|
||||
)
|
||||
|
||||
type CisBenchmarkVersion struct {
|
||||
types.Resource
|
||||
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
|
||||
Created string `json:"created,omitempty" yaml:"created,omitempty"`
|
||||
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
|
||||
Info *CisBenchmarkVersionInfo `json:"info,omitempty" yaml:"info,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"`
|
||||
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
|
||||
UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
|
||||
}
|
||||
|
||||
type CisBenchmarkVersionCollection struct {
|
||||
types.Collection
|
||||
Data []CisBenchmarkVersion `json:"data,omitempty"`
|
||||
client *CisBenchmarkVersionClient
|
||||
}
|
||||
|
||||
type CisBenchmarkVersionClient struct {
|
||||
apiClient *Client
|
||||
}
|
||||
|
||||
type CisBenchmarkVersionOperations interface {
|
||||
List(opts *types.ListOpts) (*CisBenchmarkVersionCollection, error)
|
||||
Create(opts *CisBenchmarkVersion) (*CisBenchmarkVersion, error)
|
||||
Update(existing *CisBenchmarkVersion, updates interface{}) (*CisBenchmarkVersion, error)
|
||||
Replace(existing *CisBenchmarkVersion) (*CisBenchmarkVersion, error)
|
||||
ByID(id string) (*CisBenchmarkVersion, error)
|
||||
Delete(container *CisBenchmarkVersion) error
|
||||
}
|
||||
|
||||
func newCisBenchmarkVersionClient(apiClient *Client) *CisBenchmarkVersionClient {
|
||||
return &CisBenchmarkVersionClient{
|
||||
apiClient: apiClient,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *CisBenchmarkVersionClient) Create(container *CisBenchmarkVersion) (*CisBenchmarkVersion, error) {
|
||||
resp := &CisBenchmarkVersion{}
|
||||
err := c.apiClient.Ops.DoCreate(CisBenchmarkVersionType, container, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *CisBenchmarkVersionClient) Update(existing *CisBenchmarkVersion, updates interface{}) (*CisBenchmarkVersion, error) {
|
||||
resp := &CisBenchmarkVersion{}
|
||||
err := c.apiClient.Ops.DoUpdate(CisBenchmarkVersionType, &existing.Resource, updates, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *CisBenchmarkVersionClient) Replace(obj *CisBenchmarkVersion) (*CisBenchmarkVersion, error) {
|
||||
resp := &CisBenchmarkVersion{}
|
||||
err := c.apiClient.Ops.DoReplace(CisBenchmarkVersionType, &obj.Resource, obj, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *CisBenchmarkVersionClient) List(opts *types.ListOpts) (*CisBenchmarkVersionCollection, error) {
|
||||
resp := &CisBenchmarkVersionCollection{}
|
||||
err := c.apiClient.Ops.DoList(CisBenchmarkVersionType, opts, resp)
|
||||
resp.client = c
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (cc *CisBenchmarkVersionCollection) Next() (*CisBenchmarkVersionCollection, error) {
|
||||
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
|
||||
resp := &CisBenchmarkVersionCollection{}
|
||||
err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)
|
||||
resp.client = cc.client
|
||||
return resp, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *CisBenchmarkVersionClient) ByID(id string) (*CisBenchmarkVersion, error) {
|
||||
resp := &CisBenchmarkVersion{}
|
||||
err := c.apiClient.Ops.DoByID(CisBenchmarkVersionType, id, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *CisBenchmarkVersionClient) Delete(container *CisBenchmarkVersion) error {
|
||||
return c.apiClient.Ops.DoResourceDelete(CisBenchmarkVersionType, &container.Resource)
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package client
|
||||
|
||||
const (
|
||||
CisBenchmarkVersionInfoType = "cisBenchmarkVersionInfo"
|
||||
CisBenchmarkVersionInfoFieldMinKubernetesVersion = "minKubernetesVersion"
|
||||
)
|
||||
|
||||
type CisBenchmarkVersionInfo struct {
|
||||
MinKubernetesVersion string `json:"minKubernetesVersion,omitempty" yaml:"minKubernetesVersion,omitempty"`
|
||||
}
|
101
client/management/v3/zz_generated_cis_config.go
Normal file
101
client/management/v3/zz_generated_cis_config.go
Normal file
@ -0,0 +1,101 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/types"
|
||||
)
|
||||
|
||||
const (
|
||||
CisConfigType = "cisConfig"
|
||||
CisConfigFieldAnnotations = "annotations"
|
||||
CisConfigFieldCreated = "created"
|
||||
CisConfigFieldCreatorID = "creatorId"
|
||||
CisConfigFieldLabels = "labels"
|
||||
CisConfigFieldName = "name"
|
||||
CisConfigFieldOwnerReferences = "ownerReferences"
|
||||
CisConfigFieldParams = "params"
|
||||
CisConfigFieldRemoved = "removed"
|
||||
CisConfigFieldUUID = "uuid"
|
||||
)
|
||||
|
||||
type CisConfig struct {
|
||||
types.Resource
|
||||
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
|
||||
Created string `json:"created,omitempty" yaml:"created,omitempty"`
|
||||
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"`
|
||||
Params *CisConfigParams `json:"params,omitempty" yaml:"params,omitempty"`
|
||||
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
|
||||
UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
|
||||
}
|
||||
|
||||
type CisConfigCollection struct {
|
||||
types.Collection
|
||||
Data []CisConfig `json:"data,omitempty"`
|
||||
client *CisConfigClient
|
||||
}
|
||||
|
||||
type CisConfigClient struct {
|
||||
apiClient *Client
|
||||
}
|
||||
|
||||
type CisConfigOperations interface {
|
||||
List(opts *types.ListOpts) (*CisConfigCollection, error)
|
||||
Create(opts *CisConfig) (*CisConfig, error)
|
||||
Update(existing *CisConfig, updates interface{}) (*CisConfig, error)
|
||||
Replace(existing *CisConfig) (*CisConfig, error)
|
||||
ByID(id string) (*CisConfig, error)
|
||||
Delete(container *CisConfig) error
|
||||
}
|
||||
|
||||
func newCisConfigClient(apiClient *Client) *CisConfigClient {
|
||||
return &CisConfigClient{
|
||||
apiClient: apiClient,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *CisConfigClient) Create(container *CisConfig) (*CisConfig, error) {
|
||||
resp := &CisConfig{}
|
||||
err := c.apiClient.Ops.DoCreate(CisConfigType, container, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *CisConfigClient) Update(existing *CisConfig, updates interface{}) (*CisConfig, error) {
|
||||
resp := &CisConfig{}
|
||||
err := c.apiClient.Ops.DoUpdate(CisConfigType, &existing.Resource, updates, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *CisConfigClient) Replace(obj *CisConfig) (*CisConfig, error) {
|
||||
resp := &CisConfig{}
|
||||
err := c.apiClient.Ops.DoReplace(CisConfigType, &obj.Resource, obj, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *CisConfigClient) List(opts *types.ListOpts) (*CisConfigCollection, error) {
|
||||
resp := &CisConfigCollection{}
|
||||
err := c.apiClient.Ops.DoList(CisConfigType, opts, resp)
|
||||
resp.client = c
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (cc *CisConfigCollection) Next() (*CisConfigCollection, error) {
|
||||
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
|
||||
resp := &CisConfigCollection{}
|
||||
err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)
|
||||
resp.client = cc.client
|
||||
return resp, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *CisConfigClient) ByID(id string) (*CisConfig, error) {
|
||||
resp := &CisConfig{}
|
||||
err := c.apiClient.Ops.DoByID(CisConfigType, id, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *CisConfigClient) Delete(container *CisConfig) error {
|
||||
return c.apiClient.Ops.DoResourceDelete(CisConfigType, &container.Resource)
|
||||
}
|
10
client/management/v3/zz_generated_cis_config_params.go
Normal file
10
client/management/v3/zz_generated_cis_config_params.go
Normal file
@ -0,0 +1,10 @@
|
||||
package client
|
||||
|
||||
const (
|
||||
CisConfigParamsType = "cisConfigParams"
|
||||
CisConfigParamsFieldBenchmarkVersion = "benchmarkVersion"
|
||||
)
|
||||
|
||||
type CisConfigParams struct {
|
||||
BenchmarkVersion string `json:"benchmarkVersion,omitempty" yaml:"benchmarkVersion,omitempty"`
|
||||
}
|
@ -69,6 +69,8 @@ type Client struct {
|
||||
RKEK8sSystemImage RKEK8sSystemImageOperations
|
||||
RKEK8sServiceOption RKEK8sServiceOptionOperations
|
||||
RKEAddon RKEAddonOperations
|
||||
CisConfig CisConfigOperations
|
||||
CisBenchmarkVersion CisBenchmarkVersionOperations
|
||||
}
|
||||
|
||||
func NewClient(opts *clientbase.ClientOpts) (*Client, error) {
|
||||
@ -143,6 +145,8 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) {
|
||||
client.RKEK8sSystemImage = newRKEK8sSystemImageClient(client)
|
||||
client.RKEK8sServiceOption = newRKEK8sServiceOptionClient(client)
|
||||
client.RKEAddon = newRKEAddonClient(client)
|
||||
client.CisConfig = newCisConfigClient(client)
|
||||
client.CisBenchmarkVersion = newCisBenchmarkVersionClient(client)
|
||||
|
||||
return client, nil
|
||||
}
|
||||
|
@ -68,6 +68,8 @@ type Config struct {
|
||||
RKEK8sSystemImages map[string]managementClient.RKEK8sSystemImage `json:"rkeK8sSystemImages,omitempty" yaml:"rkeK8sSystemImages,omitempty"`
|
||||
RKEK8sServiceOptions map[string]managementClient.RKEK8sServiceOption `json:"rkeK8sServiceOptions,omitempty" yaml:"rkeK8sServiceOptions,omitempty"`
|
||||
RKEAddons map[string]managementClient.RKEAddon `json:"rkeAddons,omitempty" yaml:"rkeAddons,omitempty"`
|
||||
CisConfigs map[string]managementClient.CisConfig `json:"cisConfigs,omitempty" yaml:"cisConfigs,omitempty"`
|
||||
CisBenchmarkVersions map[string]managementClient.CisBenchmarkVersion `json:"cisBenchmarkVersions,omitempty" yaml:"cisBenchmarkVersions,omitempty"`
|
||||
|
||||
// Cluster Client
|
||||
Namespaces map[string]clusterClient.Namespace `json:"namespaces,omitempty" yaml:"namespaces,omitempty"`
|
||||
|
Loading…
Reference in New Issue
Block a user