mirror of
https://github.com/rancher/types.git
synced 2025-07-15 22:15:49 +00:00
Update generated code
This commit is contained in:
parent
04e281d25e
commit
93e27221b2
@ -211,6 +211,14 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
in.(*ListOpts).DeepCopyInto(out.(*ListOpts))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&ListOpts{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*ListenConfig).DeepCopyInto(out.(*ListenConfig))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&ListenConfig{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*ListenConfigList).DeepCopyInto(out.(*ListenConfigList))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&ListenConfigList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*LocalCredential).DeepCopyInto(out.(*LocalCredential))
|
||||
return nil
|
||||
@ -379,6 +387,14 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
in.(*SetPasswordInput).DeepCopyInto(out.(*SetPasswordInput))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SetPasswordInput{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*Setting).DeepCopyInto(out.(*Setting))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&Setting{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SettingList).DeepCopyInto(out.(*SettingList))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SettingList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*Stack).DeepCopyInto(out.(*Stack))
|
||||
return nil
|
||||
@ -1727,6 +1743,82 @@ func (in *ListOpts) DeepCopy() *ListOpts {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ListenConfig) DeepCopyInto(out *ListenConfig) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Domains != nil {
|
||||
in, out := &in.Domains, &out.Domains
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.TOS != nil {
|
||||
in, out := &in.TOS, &out.TOS
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.SubjectAlternativeNames != nil {
|
||||
in, out := &in.SubjectAlternativeNames, &out.SubjectAlternativeNames
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListenConfig.
|
||||
func (in *ListenConfig) DeepCopy() *ListenConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ListenConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ListenConfig) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ListenConfigList) DeepCopyInto(out *ListenConfigList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]ListenConfig, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListenConfigList.
|
||||
func (in *ListenConfigList) DeepCopy() *ListenConfigList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ListenConfigList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ListenConfigList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *LocalCredential) DeepCopyInto(out *LocalCredential) {
|
||||
*out = *in
|
||||
@ -2857,6 +2949,67 @@ func (in *SetPasswordInput) DeepCopy() *SetPasswordInput {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Setting) DeepCopyInto(out *Setting) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Setting.
|
||||
func (in *Setting) DeepCopy() *Setting {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Setting)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Setting) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SettingList) DeepCopyInto(out *SettingList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Setting, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SettingList.
|
||||
func (in *SettingList) DeepCopy() *SettingList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SettingList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *SettingList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Stack) DeepCopyInto(out *Stack) {
|
||||
*out = *in
|
||||
|
@ -38,6 +38,8 @@ type Interface interface {
|
||||
DynamicSchemasGetter
|
||||
StacksGetter
|
||||
PreferencesGetter
|
||||
ListenConfigsGetter
|
||||
SettingsGetter
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
@ -69,6 +71,8 @@ type Client struct {
|
||||
dynamicSchemaControllers map[string]DynamicSchemaController
|
||||
stackControllers map[string]StackController
|
||||
preferenceControllers map[string]PreferenceController
|
||||
listenConfigControllers map[string]ListenConfigController
|
||||
settingControllers map[string]SettingController
|
||||
}
|
||||
|
||||
func NewForConfig(config rest.Config) (Interface, error) {
|
||||
@ -109,6 +113,8 @@ func NewForConfig(config rest.Config) (Interface, error) {
|
||||
dynamicSchemaControllers: map[string]DynamicSchemaController{},
|
||||
stackControllers: map[string]StackController{},
|
||||
preferenceControllers: map[string]PreferenceController{},
|
||||
listenConfigControllers: map[string]ListenConfigController{},
|
||||
settingControllers: map[string]SettingController{},
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -435,3 +441,29 @@ func (c *Client) Preferences(namespace string) PreferenceInterface {
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
||||
|
||||
type ListenConfigsGetter interface {
|
||||
ListenConfigs(namespace string) ListenConfigInterface
|
||||
}
|
||||
|
||||
func (c *Client) ListenConfigs(namespace string) ListenConfigInterface {
|
||||
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ListenConfigResource, ListenConfigGroupVersionKind, listenConfigFactory{})
|
||||
return &listenConfigClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
||||
|
||||
type SettingsGetter interface {
|
||||
Settings(namespace string) SettingInterface
|
||||
}
|
||||
|
||||
func (c *Client) Settings(namespace string) SettingInterface {
|
||||
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &SettingResource, SettingGroupVersionKind, settingFactory{})
|
||||
return &settingClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,251 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/rancher/norman/clientbase"
|
||||
"github.com/rancher/norman/controller"
|
||||
"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/watch"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
var (
|
||||
ListenConfigGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: Version,
|
||||
Group: GroupName,
|
||||
Kind: "ListenConfig",
|
||||
}
|
||||
ListenConfigResource = metav1.APIResource{
|
||||
Name: "listenconfigs",
|
||||
SingularName: "listenconfig",
|
||||
Namespaced: false,
|
||||
Kind: ListenConfigGroupVersionKind.Kind,
|
||||
}
|
||||
)
|
||||
|
||||
type ListenConfigList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ListenConfig
|
||||
}
|
||||
|
||||
type ListenConfigHandlerFunc func(key string, obj *ListenConfig) error
|
||||
|
||||
type ListenConfigLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*ListenConfig, err error)
|
||||
Get(namespace, name string) (*ListenConfig, error)
|
||||
}
|
||||
|
||||
type ListenConfigController interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() ListenConfigLister
|
||||
AddHandler(name string, handler ListenConfigHandlerFunc)
|
||||
AddClusterScopedHandler(name, clusterName string, handler ListenConfigHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type ListenConfigInterface interface {
|
||||
ObjectClient() *clientbase.ObjectClient
|
||||
Create(*ListenConfig) (*ListenConfig, error)
|
||||
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ListenConfig, error)
|
||||
Get(name string, opts metav1.GetOptions) (*ListenConfig, error)
|
||||
Update(*ListenConfig) (*ListenConfig, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*ListenConfigList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() ListenConfigController
|
||||
AddHandler(name string, sync ListenConfigHandlerFunc)
|
||||
AddLifecycle(name string, lifecycle ListenConfigLifecycle)
|
||||
AddClusterScopedHandler(name, clusterName string, sync ListenConfigHandlerFunc)
|
||||
AddClusterScopedLifecycle(name, clusterName string, lifecycle ListenConfigLifecycle)
|
||||
}
|
||||
|
||||
type listenConfigLister struct {
|
||||
controller *listenConfigController
|
||||
}
|
||||
|
||||
func (l *listenConfigLister) List(namespace string, selector labels.Selector) (ret []*ListenConfig, err error) {
|
||||
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
|
||||
ret = append(ret, obj.(*ListenConfig))
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (l *listenConfigLister) Get(namespace, name string) (*ListenConfig, 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: ListenConfigGroupVersionKind.Group,
|
||||
Resource: "listenConfig",
|
||||
}, name)
|
||||
}
|
||||
return obj.(*ListenConfig), nil
|
||||
}
|
||||
|
||||
type listenConfigController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *listenConfigController) Lister() ListenConfigLister {
|
||||
return &listenConfigLister{
|
||||
controller: c,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *listenConfigController) AddHandler(name string, handler ListenConfigHandlerFunc) {
|
||||
c.GenericController.AddHandler(name, func(key string) error {
|
||||
obj, exists, err := c.Informer().GetStore().GetByKey(key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !exists {
|
||||
return handler(key, nil)
|
||||
}
|
||||
return handler(key, obj.(*ListenConfig))
|
||||
})
|
||||
}
|
||||
|
||||
func (c *listenConfigController) AddClusterScopedHandler(name, cluster string, handler ListenConfigHandlerFunc) {
|
||||
c.GenericController.AddHandler(name, func(key string) error {
|
||||
obj, exists, err := c.Informer().GetStore().GetByKey(key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !exists {
|
||||
return handler(key, nil)
|
||||
}
|
||||
|
||||
if !controller.ObjectInCluster(cluster, obj) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return handler(key, obj.(*ListenConfig))
|
||||
})
|
||||
}
|
||||
|
||||
type listenConfigFactory struct {
|
||||
}
|
||||
|
||||
func (c listenConfigFactory) Object() runtime.Object {
|
||||
return &ListenConfig{}
|
||||
}
|
||||
|
||||
func (c listenConfigFactory) List() runtime.Object {
|
||||
return &ListenConfigList{}
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) Controller() ListenConfigController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.listenConfigControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(ListenConfigGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
|
||||
c = &listenConfigController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.listenConfigControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type listenConfigClient struct {
|
||||
client *Client
|
||||
ns string
|
||||
objectClient *clientbase.ObjectClient
|
||||
controller ListenConfigController
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) ObjectClient() *clientbase.ObjectClient {
|
||||
return s.objectClient
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) Create(o *ListenConfig) (*ListenConfig, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*ListenConfig), err
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) Get(name string, opts metav1.GetOptions) (*ListenConfig, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*ListenConfig), err
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ListenConfig, error) {
|
||||
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
|
||||
return obj.(*ListenConfig), err
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) Update(o *ListenConfig) (*ListenConfig, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*ListenConfig), err
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) List(opts metav1.ListOptions) (*ListenConfigList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*ListenConfigList), err
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched deployment.
|
||||
func (s *listenConfigClient) Patch(o *ListenConfig, data []byte, subresources ...string) (*ListenConfig, error) {
|
||||
obj, err := s.objectClient.Patch(o.Name, o, data, subresources...)
|
||||
return obj.(*ListenConfig), err
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) AddHandler(name string, sync ListenConfigHandlerFunc) {
|
||||
s.Controller().AddHandler(name, sync)
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) AddLifecycle(name string, lifecycle ListenConfigLifecycle) {
|
||||
sync := NewListenConfigLifecycleAdapter(name, false, s, lifecycle)
|
||||
s.AddHandler(name, sync)
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) AddClusterScopedHandler(name, clusterName string, sync ListenConfigHandlerFunc) {
|
||||
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
|
||||
}
|
||||
|
||||
func (s *listenConfigClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ListenConfigLifecycle) {
|
||||
sync := NewListenConfigLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
|
||||
s.AddClusterScopedHandler(name, clusterName, sync)
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/lifecycle"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
type ListenConfigLifecycle interface {
|
||||
Create(obj *ListenConfig) (*ListenConfig, error)
|
||||
Remove(obj *ListenConfig) (*ListenConfig, error)
|
||||
Updated(obj *ListenConfig) (*ListenConfig, error)
|
||||
}
|
||||
|
||||
type listenConfigLifecycleAdapter struct {
|
||||
lifecycle ListenConfigLifecycle
|
||||
}
|
||||
|
||||
func (w *listenConfigLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Create(obj.(*ListenConfig))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *listenConfigLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Remove(obj.(*ListenConfig))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *listenConfigLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Updated(obj.(*ListenConfig))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func NewListenConfigLifecycleAdapter(name string, clusterScoped bool, client ListenConfigInterface, l ListenConfigLifecycle) ListenConfigHandlerFunc {
|
||||
adapter := &listenConfigLifecycleAdapter{lifecycle: l}
|
||||
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
|
||||
return func(key string, obj *ListenConfig) error {
|
||||
if obj == nil {
|
||||
return syncFn(key, nil)
|
||||
}
|
||||
return syncFn(key, obj)
|
||||
}
|
||||
}
|
@ -81,6 +81,10 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
&StackList{},
|
||||
&Preference{},
|
||||
&PreferenceList{},
|
||||
&ListenConfig{},
|
||||
&ListenConfigList{},
|
||||
&Setting{},
|
||||
&SettingList{},
|
||||
)
|
||||
return nil
|
||||
}
|
||||
|
251
apis/management.cattle.io/v3/zz_generated_setting_controller.go
Normal file
251
apis/management.cattle.io/v3/zz_generated_setting_controller.go
Normal file
@ -0,0 +1,251 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/rancher/norman/clientbase"
|
||||
"github.com/rancher/norman/controller"
|
||||
"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/watch"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
var (
|
||||
SettingGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: Version,
|
||||
Group: GroupName,
|
||||
Kind: "Setting",
|
||||
}
|
||||
SettingResource = metav1.APIResource{
|
||||
Name: "settings",
|
||||
SingularName: "setting",
|
||||
Namespaced: false,
|
||||
Kind: SettingGroupVersionKind.Kind,
|
||||
}
|
||||
)
|
||||
|
||||
type SettingList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Setting
|
||||
}
|
||||
|
||||
type SettingHandlerFunc func(key string, obj *Setting) error
|
||||
|
||||
type SettingLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*Setting, err error)
|
||||
Get(namespace, name string) (*Setting, error)
|
||||
}
|
||||
|
||||
type SettingController interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() SettingLister
|
||||
AddHandler(name string, handler SettingHandlerFunc)
|
||||
AddClusterScopedHandler(name, clusterName string, handler SettingHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type SettingInterface interface {
|
||||
ObjectClient() *clientbase.ObjectClient
|
||||
Create(*Setting) (*Setting, error)
|
||||
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*Setting, error)
|
||||
Get(name string, opts metav1.GetOptions) (*Setting, error)
|
||||
Update(*Setting) (*Setting, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*SettingList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() SettingController
|
||||
AddHandler(name string, sync SettingHandlerFunc)
|
||||
AddLifecycle(name string, lifecycle SettingLifecycle)
|
||||
AddClusterScopedHandler(name, clusterName string, sync SettingHandlerFunc)
|
||||
AddClusterScopedLifecycle(name, clusterName string, lifecycle SettingLifecycle)
|
||||
}
|
||||
|
||||
type settingLister struct {
|
||||
controller *settingController
|
||||
}
|
||||
|
||||
func (l *settingLister) List(namespace string, selector labels.Selector) (ret []*Setting, err error) {
|
||||
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
|
||||
ret = append(ret, obj.(*Setting))
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (l *settingLister) Get(namespace, name string) (*Setting, 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: SettingGroupVersionKind.Group,
|
||||
Resource: "setting",
|
||||
}, name)
|
||||
}
|
||||
return obj.(*Setting), nil
|
||||
}
|
||||
|
||||
type settingController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *settingController) Lister() SettingLister {
|
||||
return &settingLister{
|
||||
controller: c,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *settingController) AddHandler(name string, handler SettingHandlerFunc) {
|
||||
c.GenericController.AddHandler(name, func(key string) error {
|
||||
obj, exists, err := c.Informer().GetStore().GetByKey(key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !exists {
|
||||
return handler(key, nil)
|
||||
}
|
||||
return handler(key, obj.(*Setting))
|
||||
})
|
||||
}
|
||||
|
||||
func (c *settingController) AddClusterScopedHandler(name, cluster string, handler SettingHandlerFunc) {
|
||||
c.GenericController.AddHandler(name, func(key string) error {
|
||||
obj, exists, err := c.Informer().GetStore().GetByKey(key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !exists {
|
||||
return handler(key, nil)
|
||||
}
|
||||
|
||||
if !controller.ObjectInCluster(cluster, obj) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return handler(key, obj.(*Setting))
|
||||
})
|
||||
}
|
||||
|
||||
type settingFactory struct {
|
||||
}
|
||||
|
||||
func (c settingFactory) Object() runtime.Object {
|
||||
return &Setting{}
|
||||
}
|
||||
|
||||
func (c settingFactory) List() runtime.Object {
|
||||
return &SettingList{}
|
||||
}
|
||||
|
||||
func (s *settingClient) Controller() SettingController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.settingControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(SettingGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
|
||||
c = &settingController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.settingControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type settingClient struct {
|
||||
client *Client
|
||||
ns string
|
||||
objectClient *clientbase.ObjectClient
|
||||
controller SettingController
|
||||
}
|
||||
|
||||
func (s *settingClient) ObjectClient() *clientbase.ObjectClient {
|
||||
return s.objectClient
|
||||
}
|
||||
|
||||
func (s *settingClient) Create(o *Setting) (*Setting, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*Setting), err
|
||||
}
|
||||
|
||||
func (s *settingClient) Get(name string, opts metav1.GetOptions) (*Setting, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*Setting), err
|
||||
}
|
||||
|
||||
func (s *settingClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*Setting, error) {
|
||||
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
|
||||
return obj.(*Setting), err
|
||||
}
|
||||
|
||||
func (s *settingClient) Update(o *Setting) (*Setting, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*Setting), err
|
||||
}
|
||||
|
||||
func (s *settingClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *settingClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (s *settingClient) List(opts metav1.ListOptions) (*SettingList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*SettingList), err
|
||||
}
|
||||
|
||||
func (s *settingClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched deployment.
|
||||
func (s *settingClient) Patch(o *Setting, data []byte, subresources ...string) (*Setting, error) {
|
||||
obj, err := s.objectClient.Patch(o.Name, o, data, subresources...)
|
||||
return obj.(*Setting), err
|
||||
}
|
||||
|
||||
func (s *settingClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
||||
|
||||
func (s *settingClient) AddHandler(name string, sync SettingHandlerFunc) {
|
||||
s.Controller().AddHandler(name, sync)
|
||||
}
|
||||
|
||||
func (s *settingClient) AddLifecycle(name string, lifecycle SettingLifecycle) {
|
||||
sync := NewSettingLifecycleAdapter(name, false, s, lifecycle)
|
||||
s.AddHandler(name, sync)
|
||||
}
|
||||
|
||||
func (s *settingClient) AddClusterScopedHandler(name, clusterName string, sync SettingHandlerFunc) {
|
||||
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
|
||||
}
|
||||
|
||||
func (s *settingClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle SettingLifecycle) {
|
||||
sync := NewSettingLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
|
||||
s.AddClusterScopedHandler(name, clusterName, sync)
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/lifecycle"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
type SettingLifecycle interface {
|
||||
Create(obj *Setting) (*Setting, error)
|
||||
Remove(obj *Setting) (*Setting, error)
|
||||
Updated(obj *Setting) (*Setting, error)
|
||||
}
|
||||
|
||||
type settingLifecycleAdapter struct {
|
||||
lifecycle SettingLifecycle
|
||||
}
|
||||
|
||||
func (w *settingLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Create(obj.(*Setting))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *settingLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Remove(obj.(*Setting))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *settingLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Updated(obj.(*Setting))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func NewSettingLifecycleAdapter(name string, clusterScoped bool, client SettingInterface, l SettingLifecycle) SettingHandlerFunc {
|
||||
adapter := &settingLifecycleAdapter{lifecycle: l}
|
||||
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
|
||||
return func(key string, obj *Setting) error {
|
||||
if obj == nil {
|
||||
return syncFn(key, nil)
|
||||
}
|
||||
return syncFn(key, obj)
|
||||
}
|
||||
}
|
@ -32,6 +32,8 @@ type Client struct {
|
||||
DynamicSchema DynamicSchemaOperations
|
||||
Stack StackOperations
|
||||
Preference PreferenceOperations
|
||||
ListenConfig ListenConfigOperations
|
||||
Setting SettingOperations
|
||||
}
|
||||
|
||||
func NewClient(opts *clientbase.ClientOpts) (*Client, error) {
|
||||
@ -69,6 +71,8 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) {
|
||||
client.DynamicSchema = newDynamicSchemaClient(client)
|
||||
client.Stack = newStackClient(client)
|
||||
client.Preference = newPreferenceClient(client)
|
||||
client.ListenConfig = newListenConfigClient(client)
|
||||
client.Setting = newSettingClient(client)
|
||||
|
||||
return client, nil
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ const (
|
||||
ClusterFieldEmbedded = "embedded"
|
||||
ClusterFieldEmbeddedConfig = "embeddedConfig"
|
||||
ClusterFieldGoogleKubernetesEngineConfig = "googleKubernetesEngineConfig"
|
||||
ClusterFieldImported = "imported"
|
||||
ClusterFieldInternal = "internal"
|
||||
ClusterFieldLabels = "labels"
|
||||
ClusterFieldLimits = "limits"
|
||||
@ -57,6 +58,7 @@ type Cluster struct {
|
||||
Embedded *bool `json:"embedded,omitempty"`
|
||||
EmbeddedConfig *K8sServerConfig `json:"embeddedConfig,omitempty"`
|
||||
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"`
|
||||
Imported *bool `json:"imported,omitempty"`
|
||||
Internal *bool `json:"internal,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
Limits map[string]string `json:"limits,omitempty"`
|
||||
|
@ -10,6 +10,7 @@ const (
|
||||
ClusterSpecFieldEmbedded = "embedded"
|
||||
ClusterSpecFieldEmbeddedConfig = "embeddedConfig"
|
||||
ClusterSpecFieldGoogleKubernetesEngineConfig = "googleKubernetesEngineConfig"
|
||||
ClusterSpecFieldImported = "imported"
|
||||
ClusterSpecFieldInternal = "internal"
|
||||
ClusterSpecFieldNodes = "nodes"
|
||||
ClusterSpecFieldRancherKubernetesEngineConfig = "rancherKubernetesEngineConfig"
|
||||
@ -24,6 +25,7 @@ type ClusterSpec struct {
|
||||
Embedded *bool `json:"embedded,omitempty"`
|
||||
EmbeddedConfig *K8sServerConfig `json:"embeddedConfig,omitempty"`
|
||||
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"`
|
||||
Imported *bool `json:"imported,omitempty"`
|
||||
Internal *bool `json:"internal,omitempty"`
|
||||
Nodes []MachineConfig `json:"nodes,omitempty"`
|
||||
RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty"`
|
||||
|
127
client/management/v3/zz_generated_listen_config.go
Normal file
127
client/management/v3/zz_generated_listen_config.go
Normal file
@ -0,0 +1,127 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/types"
|
||||
)
|
||||
|
||||
const (
|
||||
ListenConfigType = "listenConfig"
|
||||
ListenConfigFieldAlgorithm = "algorithm"
|
||||
ListenConfigFieldAnnotations = "annotations"
|
||||
ListenConfigFieldCACerts = "caCerts"
|
||||
ListenConfigFieldCN = "cn"
|
||||
ListenConfigFieldCert = "cert"
|
||||
ListenConfigFieldCertFingerprint = "certFingerprint"
|
||||
ListenConfigFieldCreated = "created"
|
||||
ListenConfigFieldCreatorID = "creatorId"
|
||||
ListenConfigFieldDescription = "description"
|
||||
ListenConfigFieldDomains = "domains"
|
||||
ListenConfigFieldEnabled = "enabled"
|
||||
ListenConfigFieldExpiresAt = "expiresAt"
|
||||
ListenConfigFieldIssuedAt = "issuedAt"
|
||||
ListenConfigFieldIssuer = "issuer"
|
||||
ListenConfigFieldKey = "key"
|
||||
ListenConfigFieldKeySize = "keySize"
|
||||
ListenConfigFieldLabels = "labels"
|
||||
ListenConfigFieldMode = "mode"
|
||||
ListenConfigFieldName = "name"
|
||||
ListenConfigFieldOwnerReferences = "ownerReferences"
|
||||
ListenConfigFieldRemoved = "removed"
|
||||
ListenConfigFieldSerialNumber = "serialNumber"
|
||||
ListenConfigFieldSubjectAlternativeNames = "subjectAlternativeNames"
|
||||
ListenConfigFieldTOS = "tos"
|
||||
ListenConfigFieldUuid = "uuid"
|
||||
ListenConfigFieldVersion = "version"
|
||||
)
|
||||
|
||||
type ListenConfig struct {
|
||||
types.Resource
|
||||
Algorithm string `json:"algorithm,omitempty"`
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
CACerts string `json:"caCerts,omitempty"`
|
||||
CN string `json:"cn,omitempty"`
|
||||
Cert string `json:"cert,omitempty"`
|
||||
CertFingerprint string `json:"certFingerprint,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
CreatorID string `json:"creatorId,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Domains []string `json:"domains,omitempty"`
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
ExpiresAt string `json:"expiresAt,omitempty"`
|
||||
IssuedAt string `json:"issuedAt,omitempty"`
|
||||
Issuer string `json:"issuer,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
KeySize *int64 `json:"keySize,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
Mode string `json:"mode,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"`
|
||||
Removed string `json:"removed,omitempty"`
|
||||
SerialNumber string `json:"serialNumber,omitempty"`
|
||||
SubjectAlternativeNames []string `json:"subjectAlternativeNames,omitempty"`
|
||||
TOS []string `json:"tos,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
Version *int64 `json:"version,omitempty"`
|
||||
}
|
||||
type ListenConfigCollection struct {
|
||||
types.Collection
|
||||
Data []ListenConfig `json:"data,omitempty"`
|
||||
client *ListenConfigClient
|
||||
}
|
||||
|
||||
type ListenConfigClient struct {
|
||||
apiClient *Client
|
||||
}
|
||||
|
||||
type ListenConfigOperations interface {
|
||||
List(opts *types.ListOpts) (*ListenConfigCollection, error)
|
||||
Create(opts *ListenConfig) (*ListenConfig, error)
|
||||
Update(existing *ListenConfig, updates interface{}) (*ListenConfig, error)
|
||||
ByID(id string) (*ListenConfig, error)
|
||||
Delete(container *ListenConfig) error
|
||||
}
|
||||
|
||||
func newListenConfigClient(apiClient *Client) *ListenConfigClient {
|
||||
return &ListenConfigClient{
|
||||
apiClient: apiClient,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ListenConfigClient) Create(container *ListenConfig) (*ListenConfig, error) {
|
||||
resp := &ListenConfig{}
|
||||
err := c.apiClient.Ops.DoCreate(ListenConfigType, container, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *ListenConfigClient) Update(existing *ListenConfig, updates interface{}) (*ListenConfig, error) {
|
||||
resp := &ListenConfig{}
|
||||
err := c.apiClient.Ops.DoUpdate(ListenConfigType, &existing.Resource, updates, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *ListenConfigClient) List(opts *types.ListOpts) (*ListenConfigCollection, error) {
|
||||
resp := &ListenConfigCollection{}
|
||||
err := c.apiClient.Ops.DoList(ListenConfigType, opts, resp)
|
||||
resp.client = c
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (cc *ListenConfigCollection) Next() (*ListenConfigCollection, error) {
|
||||
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
|
||||
resp := &ListenConfigCollection{}
|
||||
err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)
|
||||
resp.client = cc.client
|
||||
return resp, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *ListenConfigClient) ByID(id string) (*ListenConfig, error) {
|
||||
resp := &ListenConfig{}
|
||||
err := c.apiClient.Ops.DoByID(ListenConfigType, id, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *ListenConfigClient) Delete(container *ListenConfig) error {
|
||||
return c.apiClient.Ops.DoResourceDelete(ListenConfigType, &container.Resource)
|
||||
}
|
97
client/management/v3/zz_generated_setting.go
Normal file
97
client/management/v3/zz_generated_setting.go
Normal file
@ -0,0 +1,97 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/types"
|
||||
)
|
||||
|
||||
const (
|
||||
SettingType = "setting"
|
||||
SettingFieldAnnotations = "annotations"
|
||||
SettingFieldCreated = "created"
|
||||
SettingFieldCreatorID = "creatorId"
|
||||
SettingFieldHideValue = "hideValue"
|
||||
SettingFieldLabels = "labels"
|
||||
SettingFieldName = "name"
|
||||
SettingFieldOwnerReferences = "ownerReferences"
|
||||
SettingFieldReadOnly = "readOnly"
|
||||
SettingFieldRemoved = "removed"
|
||||
SettingFieldUuid = "uuid"
|
||||
SettingFieldValue = "value"
|
||||
)
|
||||
|
||||
type Setting struct {
|
||||
types.Resource
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
CreatorID string `json:"creatorId,omitempty"`
|
||||
HideValue *bool `json:"hideValue,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"`
|
||||
ReadOnly *bool `json:"readOnly,omitempty"`
|
||||
Removed string `json:"removed,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
}
|
||||
type SettingCollection struct {
|
||||
types.Collection
|
||||
Data []Setting `json:"data,omitempty"`
|
||||
client *SettingClient
|
||||
}
|
||||
|
||||
type SettingClient struct {
|
||||
apiClient *Client
|
||||
}
|
||||
|
||||
type SettingOperations interface {
|
||||
List(opts *types.ListOpts) (*SettingCollection, error)
|
||||
Create(opts *Setting) (*Setting, error)
|
||||
Update(existing *Setting, updates interface{}) (*Setting, error)
|
||||
ByID(id string) (*Setting, error)
|
||||
Delete(container *Setting) error
|
||||
}
|
||||
|
||||
func newSettingClient(apiClient *Client) *SettingClient {
|
||||
return &SettingClient{
|
||||
apiClient: apiClient,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *SettingClient) Create(container *Setting) (*Setting, error) {
|
||||
resp := &Setting{}
|
||||
err := c.apiClient.Ops.DoCreate(SettingType, container, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *SettingClient) Update(existing *Setting, updates interface{}) (*Setting, error) {
|
||||
resp := &Setting{}
|
||||
err := c.apiClient.Ops.DoUpdate(SettingType, &existing.Resource, updates, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *SettingClient) List(opts *types.ListOpts) (*SettingCollection, error) {
|
||||
resp := &SettingCollection{}
|
||||
err := c.apiClient.Ops.DoList(SettingType, opts, resp)
|
||||
resp.client = c
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (cc *SettingCollection) Next() (*SettingCollection, error) {
|
||||
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
|
||||
resp := &SettingCollection{}
|
||||
err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)
|
||||
resp.client = cc.client
|
||||
return resp, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *SettingClient) ByID(id string) (*Setting, error) {
|
||||
resp := &Setting{}
|
||||
err := c.apiClient.Ops.DoByID(SettingType, id, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *SettingClient) Delete(container *Setting) error {
|
||||
return c.apiClient.Ops.DoResourceDelete(SettingType, &container.Resource)
|
||||
}
|
Loading…
Reference in New Issue
Block a user