From 6d2c7ea0d4e27684cdc7c79e27ab8644589e4ab7 Mon Sep 17 00:00:00 2001 From: Jeeva Kandasamy Date: Tue, 5 Sep 2023 13:59:45 +0530 Subject: [PATCH] introduce upgrade mechanism and add upgrade patch to v1 storage migration Signed-off-by: Jeeva Kandasamy --- go.mod | 2 +- go.sum | 4 +- pkg/apis/operator/v1alpha1/const.go | 1 + .../v1alpha1/tektonconfig_lifecycle.go | 16 + pkg/client/injection/client/client.go | 1325 -- .../filtered/openshiftpipelinesascode.go | 65 - .../openshiftpipelinesascode.go | 58 - .../tektonaddon/filtered/tektonaddon.go | 65 - .../v1alpha1/tektonaddon/tektonaddon.go | 58 - .../tektonchain/filtered/tektonchain.go | 65 - .../v1alpha1/tektonchain/tektonchain.go | 58 - .../tektonconfig/filtered/tektonconfig.go | 65 - .../v1alpha1/tektonconfig/tektonconfig.go | 58 - .../filtered/tektondashboard.go | 65 - .../tektondashboard/tektondashboard.go | 58 - .../v1alpha1/tektonhub/filtered/tektonhub.go | 65 - .../operator/v1alpha1/tektonhub/tektonhub.go | 58 - .../filtered/tektoninstallerset.go | 65 - .../tektoninstallerset/tektoninstallerset.go | 58 - .../tektonpipeline/filtered/tektonpipeline.go | 65 - .../v1alpha1/tektonpipeline/tektonpipeline.go | 58 - .../tektonresult/filtered/tektonresult.go | 65 - .../v1alpha1/tektonresult/tektonresult.go | 58 - .../tektontrigger/filtered/tektontrigger.go | 65 - .../v1alpha1/tektontrigger/tektontrigger.go | 58 - pkg/reconciler/platform/platform.go | 5 + .../shared/tektonconfig/tektonconfig.go | 12 +- test/e2e-common.sh | 10 + upgrade/helper/storage_version_migrator.go | 61 + upgrade/upgrade.go | 225 + upgrade/v0_68_0__1.go | 52 + upgrade/versions.go | 34 + .../apiextensions/storageversion/migrator.go | 121 + .../pkg/apis/duck/v1/destination.go | 23 + .../pkg/apis/duck/v1/knative_reference.go | 9 + .../pkg/apis/duck/v1/kresource_type.go | 7 + .../pkg/apis/duck/v1/source_types.go | 5 + .../pkg/apis/duck/v1/zz_generated.deepcopy.go | 5 + .../pkg/apis/duck/v1beta1/destination.go | 21 + .../client/injection/kube/client/client.go | 18293 ---------------- .../injection/kube/client/client_expansion.go | 160 - .../mutatingwebhookconfiguration.go | 58 - .../validatingwebhookconfiguration.go | 58 - .../apps/v1/deployment/deployment.go | 64 - .../informers/core/v1/namespace/namespace.go | 58 - .../core/v1/serviceaccount/serviceaccount.go | 64 - .../rbac/v1/clusterrole/clusterrole.go | 58 - .../clusterrolebinding/clusterrolebinding.go | 58 - .../codegen/cmd/injection-gen/args/args.go | 4 +- .../cmd/injection-gen/generators/client.go | 583 +- .../generators/filtered_informer.go | 117 - .../cmd/injection-gen/generators/informer.go | 125 +- .../cmd/injection-gen/generators/packages.go | 43 +- .../pkg/codegen/cmd/injection-gen/main.go | 4 - .../pkg/environment/client_config.go | 16 +- vendor/knative.dev/pkg/injection/clients.go | 19 - .../clients/dynamicclient/dynamicclient.go | 49 - .../informers/core/v1/secret/secret.go | 54 - vendor/knative.dev/pkg/injection/informers.go | 35 - vendor/knative.dev/pkg/injection/interface.go | 29 - vendor/knative.dev/pkg/version/version.go | 2 +- .../defaulting/controller.go | 55 +- .../resourcesemantics/defaulting/options.go | 64 + .../validation/controller.go | 44 +- .../resourcesemantics/validation/options.go | 68 + vendor/knative.dev/pkg/webhook/webhook.go | 50 +- vendor/modules.txt | 6 +- 67 files changed, 887 insertions(+), 22519 deletions(-) create mode 100644 upgrade/helper/storage_version_migrator.go create mode 100644 upgrade/upgrade.go create mode 100644 upgrade/v0_68_0__1.go create mode 100644 upgrade/versions.go create mode 100644 vendor/knative.dev/pkg/apiextensions/storageversion/migrator.go delete mode 100644 vendor/knative.dev/pkg/client/injection/kube/client/client_expansion.go delete mode 100644 vendor/knative.dev/pkg/injection/clients/dynamicclient/dynamicclient.go create mode 100644 vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/options.go create mode 100644 vendor/knative.dev/pkg/webhook/resourcesemantics/validation/options.go diff --git a/go.mod b/go.mod index 85f79d4eee..910cfa3aa3 100644 --- a/go.mod +++ b/go.mod @@ -43,7 +43,7 @@ replace ( k8s.io/client-go => k8s.io/client-go v0.25.9 k8s.io/code-generator => k8s.io/code-generator v0.25.9 k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20230525220651-2546d827e515 - knative.dev/pkg => knative.dev/pkg v0.0.0-20230418073056-dfad48eaa5d0 + knative.dev/pkg => knative.dev/pkg v0.0.0-20230718152110-aef227e72ead ) require ( diff --git a/go.sum b/go.sum index 92369aad96..8d4e035e24 100644 --- a/go.sum +++ b/go.sum @@ -2240,8 +2240,8 @@ k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSn k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= knative.dev/eventing v0.38.0 h1:n6/k9IJ1kOvpZx4CMLqa1FG7g2iBiyKXwBu1Fy/81q4= knative.dev/networking v0.0.0-20220404212543-dde40b019aff h1:pqzWi29qb44TY+5xtc9vty4mSyUYvojXZGCp0y/91eo= -knative.dev/pkg v0.0.0-20230418073056-dfad48eaa5d0 h1:EFQcoUo8I4bc+U3y6tR1B3ONYZSHWUdAfI7Vh7dae8g= -knative.dev/pkg v0.0.0-20230418073056-dfad48eaa5d0/go.mod h1:2qWPP9Gjh9Q7ETti+WRHnBnGCSCq+6q7m3p/nmUQviE= +knative.dev/pkg v0.0.0-20230718152110-aef227e72ead h1:2dDzorpKuVZW3Qp7TbirMMq16FbId8f6bacQFX8jXLw= +knative.dev/pkg v0.0.0-20230718152110-aef227e72ead/go.mod h1:WmrwRV/P+hGHoMraAEfwg6ec+fBTf+Obu41v354Iabc= knative.dev/serving v0.30.1-0.20220402124840-21c05dc9d9a4 h1:iRFWsFKsA5ddhi+eKZVJdf8gPBomTfjIyRAKk9Uh7Ko= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= diff --git a/pkg/apis/operator/v1alpha1/const.go b/pkg/apis/operator/v1alpha1/const.go index a6e6235be8..c6e54b7a4a 100644 --- a/pkg/apis/operator/v1alpha1/const.go +++ b/pkg/apis/operator/v1alpha1/const.go @@ -49,6 +49,7 @@ const ( InstallerSetType = "operator.tekton.dev/type" LabelOperandName = "operator.tekton.dev/operand-name" DbSecretHash = "operator.tekton.dev/db-secret-hash" + LastAppliedUpgradeKey = "operator.tekton.dev/last-applied-upgrade" UpgradePending = "upgrade pending" Reinstalling = "reinstalling" diff --git a/pkg/apis/operator/v1alpha1/tektonconfig_lifecycle.go b/pkg/apis/operator/v1alpha1/tektonconfig_lifecycle.go index d220671dc8..05526b0a4c 100644 --- a/pkg/apis/operator/v1alpha1/tektonconfig_lifecycle.go +++ b/pkg/apis/operator/v1alpha1/tektonconfig_lifecycle.go @@ -107,3 +107,19 @@ func (tcs *TektonConfigStatus) GetVersion() string { func (tcs *TektonConfigStatus) SetVersion(version string) { tcs.Version = version } + +// returns last applied upgrade version +func (tcs *TektonConfigStatus) GetLastAppliedUpgradeVersion() string { + if tcs.Annotations == nil { + return "" + } + return tcs.Annotations[LastAppliedUpgradeKey] +} + +// updates last applied upgrade version +func (tcs *TektonConfigStatus) SetLastAppliedUpgradeVersion(lastAppliedUpgradeVersion string) { + if tcs.Annotations == nil { + tcs.Annotations = map[string]string{} + } + tcs.Annotations[LastAppliedUpgradeKey] = lastAppliedUpgradeVersion +} diff --git a/pkg/client/injection/client/client.go b/pkg/client/injection/client/client.go index f7a98883f8..b32dd0e524 100644 --- a/pkg/client/injection/client/client.go +++ b/pkg/client/injection/client/client.go @@ -20,24 +20,10 @@ package client import ( context "context" - json "encoding/json" - errors "errors" - fmt "fmt" - v1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" - typedoperatorv1alpha1 "github.com/tektoncd/operator/pkg/client/clientset/versioned/typed/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - discovery "k8s.io/client-go/discovery" - dynamic "k8s.io/client-go/dynamic" rest "k8s.io/client-go/rest" injection "knative.dev/pkg/injection" - dynamicclient "knative.dev/pkg/injection/clients/dynamicclient" logging "knative.dev/pkg/logging" ) @@ -46,7 +32,6 @@ func init() { injection.Default.RegisterClientFetcher(func(ctx context.Context) interface{} { return Get(ctx) }) - injection.Dynamic.RegisterDynamicClient(withClientFromDynamic) } // Key is used as the key for associating information with a context.Context. @@ -56,10 +41,6 @@ func withClientFromConfig(ctx context.Context, cfg *rest.Config) context.Context return context.WithValue(ctx, Key{}, versioned.NewForConfigOrDie(cfg)) } -func withClientFromDynamic(ctx context.Context) context.Context { - return context.WithValue(ctx, Key{}, &wrapClient{dyn: dynamicclient.Get(ctx)}) -} - // Get extracts the versioned.Interface client from the context. func Get(ctx context.Context) versioned.Interface { untyped := ctx.Value(Key{}) @@ -74,1309 +55,3 @@ func Get(ctx context.Context) versioned.Interface { } return untyped.(versioned.Interface) } - -type wrapClient struct { - dyn dynamic.Interface -} - -var _ versioned.Interface = (*wrapClient)(nil) - -func (w *wrapClient) Discovery() discovery.DiscoveryInterface { - panic("Discovery called on dynamic client!") -} - -func convert(from interface{}, to runtime.Object) error { - bs, err := json.Marshal(from) - if err != nil { - return fmt.Errorf("Marshal() = %w", err) - } - if err := json.Unmarshal(bs, to); err != nil { - return fmt.Errorf("Unmarshal() = %w", err) - } - return nil -} - -// OperatorV1alpha1 retrieves the OperatorV1alpha1Client -func (w *wrapClient) OperatorV1alpha1() typedoperatorv1alpha1.OperatorV1alpha1Interface { - return &wrapOperatorV1alpha1{ - dyn: w.dyn, - } -} - -type wrapOperatorV1alpha1 struct { - dyn dynamic.Interface -} - -func (w *wrapOperatorV1alpha1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapOperatorV1alpha1) OpenShiftPipelinesAsCodes() typedoperatorv1alpha1.OpenShiftPipelinesAsCodeInterface { - return &wrapOperatorV1alpha1OpenShiftPipelinesAsCodeImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Resource: "openshiftpipelinesascodes", - }), - } -} - -type wrapOperatorV1alpha1OpenShiftPipelinesAsCodeImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedoperatorv1alpha1.OpenShiftPipelinesAsCodeInterface = (*wrapOperatorV1alpha1OpenShiftPipelinesAsCodeImpl)(nil) - -func (w *wrapOperatorV1alpha1OpenShiftPipelinesAsCodeImpl) Create(ctx context.Context, in *v1alpha1.OpenShiftPipelinesAsCode, opts v1.CreateOptions) (*v1alpha1.OpenShiftPipelinesAsCode, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "OpenShiftPipelinesAsCode", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.OpenShiftPipelinesAsCode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1OpenShiftPipelinesAsCodeImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapOperatorV1alpha1OpenShiftPipelinesAsCodeImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapOperatorV1alpha1OpenShiftPipelinesAsCodeImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.OpenShiftPipelinesAsCode, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.OpenShiftPipelinesAsCode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1OpenShiftPipelinesAsCodeImpl) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.OpenShiftPipelinesAsCodeList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.OpenShiftPipelinesAsCodeList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1OpenShiftPipelinesAsCodeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.OpenShiftPipelinesAsCode, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.OpenShiftPipelinesAsCode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1OpenShiftPipelinesAsCodeImpl) Update(ctx context.Context, in *v1alpha1.OpenShiftPipelinesAsCode, opts v1.UpdateOptions) (*v1alpha1.OpenShiftPipelinesAsCode, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "OpenShiftPipelinesAsCode", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.OpenShiftPipelinesAsCode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1OpenShiftPipelinesAsCodeImpl) UpdateStatus(ctx context.Context, in *v1alpha1.OpenShiftPipelinesAsCode, opts v1.UpdateOptions) (*v1alpha1.OpenShiftPipelinesAsCode, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "OpenShiftPipelinesAsCode", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.OpenShiftPipelinesAsCode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1OpenShiftPipelinesAsCodeImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapOperatorV1alpha1) TektonAddons() typedoperatorv1alpha1.TektonAddonInterface { - return &wrapOperatorV1alpha1TektonAddonImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Resource: "tektonaddons", - }), - } -} - -type wrapOperatorV1alpha1TektonAddonImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedoperatorv1alpha1.TektonAddonInterface = (*wrapOperatorV1alpha1TektonAddonImpl)(nil) - -func (w *wrapOperatorV1alpha1TektonAddonImpl) Create(ctx context.Context, in *v1alpha1.TektonAddon, opts v1.CreateOptions) (*v1alpha1.TektonAddon, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonAddon", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonAddon{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonAddonImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapOperatorV1alpha1TektonAddonImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapOperatorV1alpha1TektonAddonImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.TektonAddon, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonAddon{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonAddonImpl) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TektonAddonList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonAddonList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonAddonImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TektonAddon, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonAddon{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonAddonImpl) Update(ctx context.Context, in *v1alpha1.TektonAddon, opts v1.UpdateOptions) (*v1alpha1.TektonAddon, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonAddon", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonAddon{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonAddonImpl) UpdateStatus(ctx context.Context, in *v1alpha1.TektonAddon, opts v1.UpdateOptions) (*v1alpha1.TektonAddon, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonAddon", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonAddon{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonAddonImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapOperatorV1alpha1) TektonChains() typedoperatorv1alpha1.TektonChainInterface { - return &wrapOperatorV1alpha1TektonChainImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Resource: "tektonchains", - }), - } -} - -type wrapOperatorV1alpha1TektonChainImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedoperatorv1alpha1.TektonChainInterface = (*wrapOperatorV1alpha1TektonChainImpl)(nil) - -func (w *wrapOperatorV1alpha1TektonChainImpl) Create(ctx context.Context, in *v1alpha1.TektonChain, opts v1.CreateOptions) (*v1alpha1.TektonChain, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonChain", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonChain{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonChainImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapOperatorV1alpha1TektonChainImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapOperatorV1alpha1TektonChainImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.TektonChain, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonChain{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonChainImpl) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TektonChainList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonChainList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonChainImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TektonChain, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonChain{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonChainImpl) Update(ctx context.Context, in *v1alpha1.TektonChain, opts v1.UpdateOptions) (*v1alpha1.TektonChain, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonChain", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonChain{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonChainImpl) UpdateStatus(ctx context.Context, in *v1alpha1.TektonChain, opts v1.UpdateOptions) (*v1alpha1.TektonChain, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonChain", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonChain{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonChainImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapOperatorV1alpha1) TektonConfigs() typedoperatorv1alpha1.TektonConfigInterface { - return &wrapOperatorV1alpha1TektonConfigImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Resource: "tektonconfigs", - }), - } -} - -type wrapOperatorV1alpha1TektonConfigImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedoperatorv1alpha1.TektonConfigInterface = (*wrapOperatorV1alpha1TektonConfigImpl)(nil) - -func (w *wrapOperatorV1alpha1TektonConfigImpl) Create(ctx context.Context, in *v1alpha1.TektonConfig, opts v1.CreateOptions) (*v1alpha1.TektonConfig, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonConfig", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonConfig{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonConfigImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapOperatorV1alpha1TektonConfigImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapOperatorV1alpha1TektonConfigImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.TektonConfig, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonConfig{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonConfigImpl) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TektonConfigList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonConfigList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonConfigImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TektonConfig, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonConfig{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonConfigImpl) Update(ctx context.Context, in *v1alpha1.TektonConfig, opts v1.UpdateOptions) (*v1alpha1.TektonConfig, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonConfig", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonConfig{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonConfigImpl) UpdateStatus(ctx context.Context, in *v1alpha1.TektonConfig, opts v1.UpdateOptions) (*v1alpha1.TektonConfig, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonConfig", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonConfig{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonConfigImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapOperatorV1alpha1) TektonDashboards() typedoperatorv1alpha1.TektonDashboardInterface { - return &wrapOperatorV1alpha1TektonDashboardImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Resource: "tektondashboards", - }), - } -} - -type wrapOperatorV1alpha1TektonDashboardImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedoperatorv1alpha1.TektonDashboardInterface = (*wrapOperatorV1alpha1TektonDashboardImpl)(nil) - -func (w *wrapOperatorV1alpha1TektonDashboardImpl) Create(ctx context.Context, in *v1alpha1.TektonDashboard, opts v1.CreateOptions) (*v1alpha1.TektonDashboard, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonDashboard", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonDashboard{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonDashboardImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapOperatorV1alpha1TektonDashboardImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapOperatorV1alpha1TektonDashboardImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.TektonDashboard, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonDashboard{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonDashboardImpl) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TektonDashboardList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonDashboardList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonDashboardImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TektonDashboard, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonDashboard{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonDashboardImpl) Update(ctx context.Context, in *v1alpha1.TektonDashboard, opts v1.UpdateOptions) (*v1alpha1.TektonDashboard, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonDashboard", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonDashboard{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonDashboardImpl) UpdateStatus(ctx context.Context, in *v1alpha1.TektonDashboard, opts v1.UpdateOptions) (*v1alpha1.TektonDashboard, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonDashboard", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonDashboard{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonDashboardImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapOperatorV1alpha1) TektonHubs() typedoperatorv1alpha1.TektonHubInterface { - return &wrapOperatorV1alpha1TektonHubImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Resource: "tektonhubs", - }), - } -} - -type wrapOperatorV1alpha1TektonHubImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedoperatorv1alpha1.TektonHubInterface = (*wrapOperatorV1alpha1TektonHubImpl)(nil) - -func (w *wrapOperatorV1alpha1TektonHubImpl) Create(ctx context.Context, in *v1alpha1.TektonHub, opts v1.CreateOptions) (*v1alpha1.TektonHub, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonHub", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonHub{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonHubImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapOperatorV1alpha1TektonHubImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapOperatorV1alpha1TektonHubImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.TektonHub, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonHub{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonHubImpl) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TektonHubList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonHubList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonHubImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TektonHub, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonHub{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonHubImpl) Update(ctx context.Context, in *v1alpha1.TektonHub, opts v1.UpdateOptions) (*v1alpha1.TektonHub, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonHub", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonHub{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonHubImpl) UpdateStatus(ctx context.Context, in *v1alpha1.TektonHub, opts v1.UpdateOptions) (*v1alpha1.TektonHub, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonHub", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonHub{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonHubImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapOperatorV1alpha1) TektonInstallerSets() typedoperatorv1alpha1.TektonInstallerSetInterface { - return &wrapOperatorV1alpha1TektonInstallerSetImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Resource: "tektoninstallersets", - }), - } -} - -type wrapOperatorV1alpha1TektonInstallerSetImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedoperatorv1alpha1.TektonInstallerSetInterface = (*wrapOperatorV1alpha1TektonInstallerSetImpl)(nil) - -func (w *wrapOperatorV1alpha1TektonInstallerSetImpl) Create(ctx context.Context, in *v1alpha1.TektonInstallerSet, opts v1.CreateOptions) (*v1alpha1.TektonInstallerSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonInstallerSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonInstallerSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonInstallerSetImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapOperatorV1alpha1TektonInstallerSetImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapOperatorV1alpha1TektonInstallerSetImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.TektonInstallerSet, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonInstallerSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonInstallerSetImpl) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TektonInstallerSetList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonInstallerSetList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonInstallerSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TektonInstallerSet, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonInstallerSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonInstallerSetImpl) Update(ctx context.Context, in *v1alpha1.TektonInstallerSet, opts v1.UpdateOptions) (*v1alpha1.TektonInstallerSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonInstallerSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonInstallerSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonInstallerSetImpl) UpdateStatus(ctx context.Context, in *v1alpha1.TektonInstallerSet, opts v1.UpdateOptions) (*v1alpha1.TektonInstallerSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonInstallerSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonInstallerSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonInstallerSetImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapOperatorV1alpha1) TektonPipelines() typedoperatorv1alpha1.TektonPipelineInterface { - return &wrapOperatorV1alpha1TektonPipelineImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Resource: "tektonpipelines", - }), - } -} - -type wrapOperatorV1alpha1TektonPipelineImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedoperatorv1alpha1.TektonPipelineInterface = (*wrapOperatorV1alpha1TektonPipelineImpl)(nil) - -func (w *wrapOperatorV1alpha1TektonPipelineImpl) Create(ctx context.Context, in *v1alpha1.TektonPipeline, opts v1.CreateOptions) (*v1alpha1.TektonPipeline, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonPipeline", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonPipeline{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonPipelineImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapOperatorV1alpha1TektonPipelineImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapOperatorV1alpha1TektonPipelineImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.TektonPipeline, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonPipeline{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonPipelineImpl) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TektonPipelineList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonPipelineList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonPipelineImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TektonPipeline, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonPipeline{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonPipelineImpl) Update(ctx context.Context, in *v1alpha1.TektonPipeline, opts v1.UpdateOptions) (*v1alpha1.TektonPipeline, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonPipeline", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonPipeline{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonPipelineImpl) UpdateStatus(ctx context.Context, in *v1alpha1.TektonPipeline, opts v1.UpdateOptions) (*v1alpha1.TektonPipeline, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonPipeline", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonPipeline{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonPipelineImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapOperatorV1alpha1) TektonResults() typedoperatorv1alpha1.TektonResultInterface { - return &wrapOperatorV1alpha1TektonResultImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Resource: "tektonresults", - }), - } -} - -type wrapOperatorV1alpha1TektonResultImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedoperatorv1alpha1.TektonResultInterface = (*wrapOperatorV1alpha1TektonResultImpl)(nil) - -func (w *wrapOperatorV1alpha1TektonResultImpl) Create(ctx context.Context, in *v1alpha1.TektonResult, opts v1.CreateOptions) (*v1alpha1.TektonResult, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonResult", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonResult{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonResultImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapOperatorV1alpha1TektonResultImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapOperatorV1alpha1TektonResultImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.TektonResult, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonResult{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonResultImpl) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TektonResultList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonResultList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonResultImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TektonResult, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonResult{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonResultImpl) Update(ctx context.Context, in *v1alpha1.TektonResult, opts v1.UpdateOptions) (*v1alpha1.TektonResult, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonResult", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonResult{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonResultImpl) UpdateStatus(ctx context.Context, in *v1alpha1.TektonResult, opts v1.UpdateOptions) (*v1alpha1.TektonResult, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonResult", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonResult{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonResultImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapOperatorV1alpha1) TektonTriggers() typedoperatorv1alpha1.TektonTriggerInterface { - return &wrapOperatorV1alpha1TektonTriggerImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Resource: "tektontriggers", - }), - } -} - -type wrapOperatorV1alpha1TektonTriggerImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedoperatorv1alpha1.TektonTriggerInterface = (*wrapOperatorV1alpha1TektonTriggerImpl)(nil) - -func (w *wrapOperatorV1alpha1TektonTriggerImpl) Create(ctx context.Context, in *v1alpha1.TektonTrigger, opts v1.CreateOptions) (*v1alpha1.TektonTrigger, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonTrigger", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonTrigger{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonTriggerImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapOperatorV1alpha1TektonTriggerImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapOperatorV1alpha1TektonTriggerImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.TektonTrigger, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonTrigger{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonTriggerImpl) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TektonTriggerList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonTriggerList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonTriggerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TektonTrigger, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonTrigger{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonTriggerImpl) Update(ctx context.Context, in *v1alpha1.TektonTrigger, opts v1.UpdateOptions) (*v1alpha1.TektonTrigger, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonTrigger", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonTrigger{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonTriggerImpl) UpdateStatus(ctx context.Context, in *v1alpha1.TektonTrigger, opts v1.UpdateOptions) (*v1alpha1.TektonTrigger, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "operator.tekton.dev", - Version: "v1alpha1", - Kind: "TektonTrigger", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &v1alpha1.TektonTrigger{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapOperatorV1alpha1TektonTriggerImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/openshiftpipelinesascode/filtered/openshiftpipelinesascode.go b/pkg/client/injection/informers/operator/v1alpha1/openshiftpipelinesascode/filtered/openshiftpipelinesascode.go index 207fff1d57..e7a28f0d92 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/openshiftpipelinesascode/filtered/openshiftpipelinesascode.go +++ b/pkg/client/injection/informers/operator/v1alpha1/openshiftpipelinesascode/filtered/openshiftpipelinesascode.go @@ -21,15 +21,8 @@ package filtered import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" filtered "github.com/tektoncd/operator/pkg/client/injection/informers/factory/filtered" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -62,20 +54,6 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } -func withDynamicInformer(ctx context.Context) context.Context { - untyped := ctx.Value(filtered.LabelKey{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch labelkey from context.") - } - labelSelectors := untyped.([]string) - for _, selector := range labelSelectors { - inf := &wrapper{client: client.Get(ctx), selector: selector} - ctx = context.WithValue(ctx, Key{Selector: selector}, inf) - } - return ctx -} - // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1alpha1.OpenShiftPipelinesAsCodeInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -85,46 +63,3 @@ func Get(ctx context.Context, selector string) v1alpha1.OpenShiftPipelinesAsCode } return untyped.(v1alpha1.OpenShiftPipelinesAsCodeInformer) } - -type wrapper struct { - client versioned.Interface - - selector string -} - -var _ v1alpha1.OpenShiftPipelinesAsCodeInformer = (*wrapper)(nil) -var _ operatorv1alpha1.OpenShiftPipelinesAsCodeLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.OpenShiftPipelinesAsCode{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.OpenShiftPipelinesAsCodeLister { - return w -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.OpenShiftPipelinesAsCode, err error) { - reqs, err := labels.ParseToRequirements(w.selector) - if err != nil { - return nil, err - } - selector = selector.Add(reqs...) - lo, err := w.client.OperatorV1alpha1().OpenShiftPipelinesAsCodes().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.OpenShiftPipelinesAsCode, error) { - // TODO(mattmoor): Check that the fetched object matches the selector. - return w.client.OperatorV1alpha1().OpenShiftPipelinesAsCodes().Get(context.TODO(), name, v1.GetOptions{ - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/openshiftpipelinesascode/openshiftpipelinesascode.go b/pkg/client/injection/informers/operator/v1alpha1/openshiftpipelinesascode/openshiftpipelinesascode.go index 0b5366ee60..1385e82585 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/openshiftpipelinesascode/openshiftpipelinesascode.go +++ b/pkg/client/injection/informers/operator/v1alpha1/openshiftpipelinesascode/openshiftpipelinesascode.go @@ -21,15 +21,8 @@ package openshiftpipelinesascode import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" factory "github.com/tektoncd/operator/pkg/client/injection/informers/factory" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1alpha1.OpenShiftPipelinesAsCodeInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1alpha1.OpenShiftPipelinesAsCodeInformer { } return untyped.(v1alpha1.OpenShiftPipelinesAsCodeInformer) } - -type wrapper struct { - client versioned.Interface - - resourceVersion string -} - -var _ v1alpha1.OpenShiftPipelinesAsCodeInformer = (*wrapper)(nil) -var _ operatorv1alpha1.OpenShiftPipelinesAsCodeLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.OpenShiftPipelinesAsCode{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.OpenShiftPipelinesAsCodeLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.OpenShiftPipelinesAsCode, err error) { - lo, err := w.client.OperatorV1alpha1().OpenShiftPipelinesAsCodes().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.OpenShiftPipelinesAsCode, error) { - return w.client.OperatorV1alpha1().OpenShiftPipelinesAsCodes().Get(context.TODO(), name, v1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonaddon/filtered/tektonaddon.go b/pkg/client/injection/informers/operator/v1alpha1/tektonaddon/filtered/tektonaddon.go index b0a4a04c9b..dd4a124577 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonaddon/filtered/tektonaddon.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonaddon/filtered/tektonaddon.go @@ -21,15 +21,8 @@ package filtered import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" filtered "github.com/tektoncd/operator/pkg/client/injection/informers/factory/filtered" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -62,20 +54,6 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } -func withDynamicInformer(ctx context.Context) context.Context { - untyped := ctx.Value(filtered.LabelKey{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch labelkey from context.") - } - labelSelectors := untyped.([]string) - for _, selector := range labelSelectors { - inf := &wrapper{client: client.Get(ctx), selector: selector} - ctx = context.WithValue(ctx, Key{Selector: selector}, inf) - } - return ctx -} - // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1alpha1.TektonAddonInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -85,46 +63,3 @@ func Get(ctx context.Context, selector string) v1alpha1.TektonAddonInformer { } return untyped.(v1alpha1.TektonAddonInformer) } - -type wrapper struct { - client versioned.Interface - - selector string -} - -var _ v1alpha1.TektonAddonInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonAddonLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonAddon{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonAddonLister { - return w -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonAddon, err error) { - reqs, err := labels.ParseToRequirements(w.selector) - if err != nil { - return nil, err - } - selector = selector.Add(reqs...) - lo, err := w.client.OperatorV1alpha1().TektonAddons().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonAddon, error) { - // TODO(mattmoor): Check that the fetched object matches the selector. - return w.client.OperatorV1alpha1().TektonAddons().Get(context.TODO(), name, v1.GetOptions{ - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonaddon/tektonaddon.go b/pkg/client/injection/informers/operator/v1alpha1/tektonaddon/tektonaddon.go index 5a125fdaf4..b8f78752be 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonaddon/tektonaddon.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonaddon/tektonaddon.go @@ -21,15 +21,8 @@ package tektonaddon import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" factory "github.com/tektoncd/operator/pkg/client/injection/informers/factory" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1alpha1.TektonAddonInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1alpha1.TektonAddonInformer { } return untyped.(v1alpha1.TektonAddonInformer) } - -type wrapper struct { - client versioned.Interface - - resourceVersion string -} - -var _ v1alpha1.TektonAddonInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonAddonLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonAddon{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonAddonLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonAddon, err error) { - lo, err := w.client.OperatorV1alpha1().TektonAddons().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonAddon, error) { - return w.client.OperatorV1alpha1().TektonAddons().Get(context.TODO(), name, v1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonchain/filtered/tektonchain.go b/pkg/client/injection/informers/operator/v1alpha1/tektonchain/filtered/tektonchain.go index 7442723765..2e6342ec4a 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonchain/filtered/tektonchain.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonchain/filtered/tektonchain.go @@ -21,15 +21,8 @@ package filtered import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" filtered "github.com/tektoncd/operator/pkg/client/injection/informers/factory/filtered" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -62,20 +54,6 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } -func withDynamicInformer(ctx context.Context) context.Context { - untyped := ctx.Value(filtered.LabelKey{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch labelkey from context.") - } - labelSelectors := untyped.([]string) - for _, selector := range labelSelectors { - inf := &wrapper{client: client.Get(ctx), selector: selector} - ctx = context.WithValue(ctx, Key{Selector: selector}, inf) - } - return ctx -} - // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1alpha1.TektonChainInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -85,46 +63,3 @@ func Get(ctx context.Context, selector string) v1alpha1.TektonChainInformer { } return untyped.(v1alpha1.TektonChainInformer) } - -type wrapper struct { - client versioned.Interface - - selector string -} - -var _ v1alpha1.TektonChainInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonChainLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonChain{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonChainLister { - return w -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonChain, err error) { - reqs, err := labels.ParseToRequirements(w.selector) - if err != nil { - return nil, err - } - selector = selector.Add(reqs...) - lo, err := w.client.OperatorV1alpha1().TektonChains().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonChain, error) { - // TODO(mattmoor): Check that the fetched object matches the selector. - return w.client.OperatorV1alpha1().TektonChains().Get(context.TODO(), name, v1.GetOptions{ - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonchain/tektonchain.go b/pkg/client/injection/informers/operator/v1alpha1/tektonchain/tektonchain.go index 55ad9e30da..1ca52a9e27 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonchain/tektonchain.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonchain/tektonchain.go @@ -21,15 +21,8 @@ package tektonchain import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" factory "github.com/tektoncd/operator/pkg/client/injection/informers/factory" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1alpha1.TektonChainInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1alpha1.TektonChainInformer { } return untyped.(v1alpha1.TektonChainInformer) } - -type wrapper struct { - client versioned.Interface - - resourceVersion string -} - -var _ v1alpha1.TektonChainInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonChainLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonChain{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonChainLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonChain, err error) { - lo, err := w.client.OperatorV1alpha1().TektonChains().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonChain, error) { - return w.client.OperatorV1alpha1().TektonChains().Get(context.TODO(), name, v1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonconfig/filtered/tektonconfig.go b/pkg/client/injection/informers/operator/v1alpha1/tektonconfig/filtered/tektonconfig.go index ada5602dcb..ea84bef988 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonconfig/filtered/tektonconfig.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonconfig/filtered/tektonconfig.go @@ -21,15 +21,8 @@ package filtered import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" filtered "github.com/tektoncd/operator/pkg/client/injection/informers/factory/filtered" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -62,20 +54,6 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } -func withDynamicInformer(ctx context.Context) context.Context { - untyped := ctx.Value(filtered.LabelKey{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch labelkey from context.") - } - labelSelectors := untyped.([]string) - for _, selector := range labelSelectors { - inf := &wrapper{client: client.Get(ctx), selector: selector} - ctx = context.WithValue(ctx, Key{Selector: selector}, inf) - } - return ctx -} - // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1alpha1.TektonConfigInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -85,46 +63,3 @@ func Get(ctx context.Context, selector string) v1alpha1.TektonConfigInformer { } return untyped.(v1alpha1.TektonConfigInformer) } - -type wrapper struct { - client versioned.Interface - - selector string -} - -var _ v1alpha1.TektonConfigInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonConfigLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonConfig{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonConfigLister { - return w -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonConfig, err error) { - reqs, err := labels.ParseToRequirements(w.selector) - if err != nil { - return nil, err - } - selector = selector.Add(reqs...) - lo, err := w.client.OperatorV1alpha1().TektonConfigs().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonConfig, error) { - // TODO(mattmoor): Check that the fetched object matches the selector. - return w.client.OperatorV1alpha1().TektonConfigs().Get(context.TODO(), name, v1.GetOptions{ - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonconfig/tektonconfig.go b/pkg/client/injection/informers/operator/v1alpha1/tektonconfig/tektonconfig.go index 3b87a9b30a..a5e617bf69 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonconfig/tektonconfig.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonconfig/tektonconfig.go @@ -21,15 +21,8 @@ package tektonconfig import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" factory "github.com/tektoncd/operator/pkg/client/injection/informers/factory" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1alpha1.TektonConfigInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1alpha1.TektonConfigInformer { } return untyped.(v1alpha1.TektonConfigInformer) } - -type wrapper struct { - client versioned.Interface - - resourceVersion string -} - -var _ v1alpha1.TektonConfigInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonConfigLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonConfig{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonConfigLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonConfig, err error) { - lo, err := w.client.OperatorV1alpha1().TektonConfigs().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonConfig, error) { - return w.client.OperatorV1alpha1().TektonConfigs().Get(context.TODO(), name, v1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektondashboard/filtered/tektondashboard.go b/pkg/client/injection/informers/operator/v1alpha1/tektondashboard/filtered/tektondashboard.go index abd8b5a470..9fe07ea7aa 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektondashboard/filtered/tektondashboard.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektondashboard/filtered/tektondashboard.go @@ -21,15 +21,8 @@ package filtered import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" filtered "github.com/tektoncd/operator/pkg/client/injection/informers/factory/filtered" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -62,20 +54,6 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } -func withDynamicInformer(ctx context.Context) context.Context { - untyped := ctx.Value(filtered.LabelKey{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch labelkey from context.") - } - labelSelectors := untyped.([]string) - for _, selector := range labelSelectors { - inf := &wrapper{client: client.Get(ctx), selector: selector} - ctx = context.WithValue(ctx, Key{Selector: selector}, inf) - } - return ctx -} - // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1alpha1.TektonDashboardInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -85,46 +63,3 @@ func Get(ctx context.Context, selector string) v1alpha1.TektonDashboardInformer } return untyped.(v1alpha1.TektonDashboardInformer) } - -type wrapper struct { - client versioned.Interface - - selector string -} - -var _ v1alpha1.TektonDashboardInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonDashboardLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonDashboard{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonDashboardLister { - return w -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonDashboard, err error) { - reqs, err := labels.ParseToRequirements(w.selector) - if err != nil { - return nil, err - } - selector = selector.Add(reqs...) - lo, err := w.client.OperatorV1alpha1().TektonDashboards().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonDashboard, error) { - // TODO(mattmoor): Check that the fetched object matches the selector. - return w.client.OperatorV1alpha1().TektonDashboards().Get(context.TODO(), name, v1.GetOptions{ - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektondashboard/tektondashboard.go b/pkg/client/injection/informers/operator/v1alpha1/tektondashboard/tektondashboard.go index 30692dd1c8..cb519081e0 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektondashboard/tektondashboard.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektondashboard/tektondashboard.go @@ -21,15 +21,8 @@ package tektondashboard import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" factory "github.com/tektoncd/operator/pkg/client/injection/informers/factory" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1alpha1.TektonDashboardInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1alpha1.TektonDashboardInformer { } return untyped.(v1alpha1.TektonDashboardInformer) } - -type wrapper struct { - client versioned.Interface - - resourceVersion string -} - -var _ v1alpha1.TektonDashboardInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonDashboardLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonDashboard{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonDashboardLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonDashboard, err error) { - lo, err := w.client.OperatorV1alpha1().TektonDashboards().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonDashboard, error) { - return w.client.OperatorV1alpha1().TektonDashboards().Get(context.TODO(), name, v1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonhub/filtered/tektonhub.go b/pkg/client/injection/informers/operator/v1alpha1/tektonhub/filtered/tektonhub.go index afb71bd517..c9667e9327 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonhub/filtered/tektonhub.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonhub/filtered/tektonhub.go @@ -21,15 +21,8 @@ package filtered import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" filtered "github.com/tektoncd/operator/pkg/client/injection/informers/factory/filtered" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -62,20 +54,6 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } -func withDynamicInformer(ctx context.Context) context.Context { - untyped := ctx.Value(filtered.LabelKey{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch labelkey from context.") - } - labelSelectors := untyped.([]string) - for _, selector := range labelSelectors { - inf := &wrapper{client: client.Get(ctx), selector: selector} - ctx = context.WithValue(ctx, Key{Selector: selector}, inf) - } - return ctx -} - // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1alpha1.TektonHubInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -85,46 +63,3 @@ func Get(ctx context.Context, selector string) v1alpha1.TektonHubInformer { } return untyped.(v1alpha1.TektonHubInformer) } - -type wrapper struct { - client versioned.Interface - - selector string -} - -var _ v1alpha1.TektonHubInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonHubLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonHub{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonHubLister { - return w -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonHub, err error) { - reqs, err := labels.ParseToRequirements(w.selector) - if err != nil { - return nil, err - } - selector = selector.Add(reqs...) - lo, err := w.client.OperatorV1alpha1().TektonHubs().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonHub, error) { - // TODO(mattmoor): Check that the fetched object matches the selector. - return w.client.OperatorV1alpha1().TektonHubs().Get(context.TODO(), name, v1.GetOptions{ - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonhub/tektonhub.go b/pkg/client/injection/informers/operator/v1alpha1/tektonhub/tektonhub.go index 9e0e02a8a1..b99c855746 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonhub/tektonhub.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonhub/tektonhub.go @@ -21,15 +21,8 @@ package tektonhub import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" factory "github.com/tektoncd/operator/pkg/client/injection/informers/factory" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1alpha1.TektonHubInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1alpha1.TektonHubInformer { } return untyped.(v1alpha1.TektonHubInformer) } - -type wrapper struct { - client versioned.Interface - - resourceVersion string -} - -var _ v1alpha1.TektonHubInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonHubLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonHub{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonHubLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonHub, err error) { - lo, err := w.client.OperatorV1alpha1().TektonHubs().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonHub, error) { - return w.client.OperatorV1alpha1().TektonHubs().Get(context.TODO(), name, v1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektoninstallerset/filtered/tektoninstallerset.go b/pkg/client/injection/informers/operator/v1alpha1/tektoninstallerset/filtered/tektoninstallerset.go index 24596e1ea2..03da985e65 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektoninstallerset/filtered/tektoninstallerset.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektoninstallerset/filtered/tektoninstallerset.go @@ -21,15 +21,8 @@ package filtered import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" filtered "github.com/tektoncd/operator/pkg/client/injection/informers/factory/filtered" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -62,20 +54,6 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } -func withDynamicInformer(ctx context.Context) context.Context { - untyped := ctx.Value(filtered.LabelKey{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch labelkey from context.") - } - labelSelectors := untyped.([]string) - for _, selector := range labelSelectors { - inf := &wrapper{client: client.Get(ctx), selector: selector} - ctx = context.WithValue(ctx, Key{Selector: selector}, inf) - } - return ctx -} - // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1alpha1.TektonInstallerSetInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -85,46 +63,3 @@ func Get(ctx context.Context, selector string) v1alpha1.TektonInstallerSetInform } return untyped.(v1alpha1.TektonInstallerSetInformer) } - -type wrapper struct { - client versioned.Interface - - selector string -} - -var _ v1alpha1.TektonInstallerSetInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonInstallerSetLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonInstallerSet{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonInstallerSetLister { - return w -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonInstallerSet, err error) { - reqs, err := labels.ParseToRequirements(w.selector) - if err != nil { - return nil, err - } - selector = selector.Add(reqs...) - lo, err := w.client.OperatorV1alpha1().TektonInstallerSets().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonInstallerSet, error) { - // TODO(mattmoor): Check that the fetched object matches the selector. - return w.client.OperatorV1alpha1().TektonInstallerSets().Get(context.TODO(), name, v1.GetOptions{ - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektoninstallerset/tektoninstallerset.go b/pkg/client/injection/informers/operator/v1alpha1/tektoninstallerset/tektoninstallerset.go index 793c418bf0..87496d722d 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektoninstallerset/tektoninstallerset.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektoninstallerset/tektoninstallerset.go @@ -21,15 +21,8 @@ package tektoninstallerset import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" factory "github.com/tektoncd/operator/pkg/client/injection/informers/factory" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1alpha1.TektonInstallerSetInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1alpha1.TektonInstallerSetInformer { } return untyped.(v1alpha1.TektonInstallerSetInformer) } - -type wrapper struct { - client versioned.Interface - - resourceVersion string -} - -var _ v1alpha1.TektonInstallerSetInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonInstallerSetLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonInstallerSet{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonInstallerSetLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonInstallerSet, err error) { - lo, err := w.client.OperatorV1alpha1().TektonInstallerSets().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonInstallerSet, error) { - return w.client.OperatorV1alpha1().TektonInstallerSets().Get(context.TODO(), name, v1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonpipeline/filtered/tektonpipeline.go b/pkg/client/injection/informers/operator/v1alpha1/tektonpipeline/filtered/tektonpipeline.go index 404a565d87..ea2ba1e102 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonpipeline/filtered/tektonpipeline.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonpipeline/filtered/tektonpipeline.go @@ -21,15 +21,8 @@ package filtered import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" filtered "github.com/tektoncd/operator/pkg/client/injection/informers/factory/filtered" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -62,20 +54,6 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } -func withDynamicInformer(ctx context.Context) context.Context { - untyped := ctx.Value(filtered.LabelKey{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch labelkey from context.") - } - labelSelectors := untyped.([]string) - for _, selector := range labelSelectors { - inf := &wrapper{client: client.Get(ctx), selector: selector} - ctx = context.WithValue(ctx, Key{Selector: selector}, inf) - } - return ctx -} - // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1alpha1.TektonPipelineInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -85,46 +63,3 @@ func Get(ctx context.Context, selector string) v1alpha1.TektonPipelineInformer { } return untyped.(v1alpha1.TektonPipelineInformer) } - -type wrapper struct { - client versioned.Interface - - selector string -} - -var _ v1alpha1.TektonPipelineInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonPipelineLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonPipeline{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonPipelineLister { - return w -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonPipeline, err error) { - reqs, err := labels.ParseToRequirements(w.selector) - if err != nil { - return nil, err - } - selector = selector.Add(reqs...) - lo, err := w.client.OperatorV1alpha1().TektonPipelines().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonPipeline, error) { - // TODO(mattmoor): Check that the fetched object matches the selector. - return w.client.OperatorV1alpha1().TektonPipelines().Get(context.TODO(), name, v1.GetOptions{ - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonpipeline/tektonpipeline.go b/pkg/client/injection/informers/operator/v1alpha1/tektonpipeline/tektonpipeline.go index 9232864860..3062afbb21 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonpipeline/tektonpipeline.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonpipeline/tektonpipeline.go @@ -21,15 +21,8 @@ package tektonpipeline import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" factory "github.com/tektoncd/operator/pkg/client/injection/informers/factory" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1alpha1.TektonPipelineInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1alpha1.TektonPipelineInformer { } return untyped.(v1alpha1.TektonPipelineInformer) } - -type wrapper struct { - client versioned.Interface - - resourceVersion string -} - -var _ v1alpha1.TektonPipelineInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonPipelineLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonPipeline{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonPipelineLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonPipeline, err error) { - lo, err := w.client.OperatorV1alpha1().TektonPipelines().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonPipeline, error) { - return w.client.OperatorV1alpha1().TektonPipelines().Get(context.TODO(), name, v1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonresult/filtered/tektonresult.go b/pkg/client/injection/informers/operator/v1alpha1/tektonresult/filtered/tektonresult.go index 7853fb1968..3761214efa 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonresult/filtered/tektonresult.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonresult/filtered/tektonresult.go @@ -21,15 +21,8 @@ package filtered import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" filtered "github.com/tektoncd/operator/pkg/client/injection/informers/factory/filtered" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -62,20 +54,6 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } -func withDynamicInformer(ctx context.Context) context.Context { - untyped := ctx.Value(filtered.LabelKey{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch labelkey from context.") - } - labelSelectors := untyped.([]string) - for _, selector := range labelSelectors { - inf := &wrapper{client: client.Get(ctx), selector: selector} - ctx = context.WithValue(ctx, Key{Selector: selector}, inf) - } - return ctx -} - // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1alpha1.TektonResultInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -85,46 +63,3 @@ func Get(ctx context.Context, selector string) v1alpha1.TektonResultInformer { } return untyped.(v1alpha1.TektonResultInformer) } - -type wrapper struct { - client versioned.Interface - - selector string -} - -var _ v1alpha1.TektonResultInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonResultLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonResult{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonResultLister { - return w -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonResult, err error) { - reqs, err := labels.ParseToRequirements(w.selector) - if err != nil { - return nil, err - } - selector = selector.Add(reqs...) - lo, err := w.client.OperatorV1alpha1().TektonResults().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonResult, error) { - // TODO(mattmoor): Check that the fetched object matches the selector. - return w.client.OperatorV1alpha1().TektonResults().Get(context.TODO(), name, v1.GetOptions{ - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonresult/tektonresult.go b/pkg/client/injection/informers/operator/v1alpha1/tektonresult/tektonresult.go index 9caac52725..911d62d858 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonresult/tektonresult.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonresult/tektonresult.go @@ -21,15 +21,8 @@ package tektonresult import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" factory "github.com/tektoncd/operator/pkg/client/injection/informers/factory" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1alpha1.TektonResultInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1alpha1.TektonResultInformer { } return untyped.(v1alpha1.TektonResultInformer) } - -type wrapper struct { - client versioned.Interface - - resourceVersion string -} - -var _ v1alpha1.TektonResultInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonResultLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonResult{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonResultLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonResult, err error) { - lo, err := w.client.OperatorV1alpha1().TektonResults().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonResult, error) { - return w.client.OperatorV1alpha1().TektonResults().Get(context.TODO(), name, v1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektontrigger/filtered/tektontrigger.go b/pkg/client/injection/informers/operator/v1alpha1/tektontrigger/filtered/tektontrigger.go index ac9468162e..a2e829a033 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektontrigger/filtered/tektontrigger.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektontrigger/filtered/tektontrigger.go @@ -21,15 +21,8 @@ package filtered import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" filtered "github.com/tektoncd/operator/pkg/client/injection/informers/factory/filtered" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterFilteredInformers(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -62,20 +54,6 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) return ctx, infs } -func withDynamicInformer(ctx context.Context) context.Context { - untyped := ctx.Value(filtered.LabelKey{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch labelkey from context.") - } - labelSelectors := untyped.([]string) - for _, selector := range labelSelectors { - inf := &wrapper{client: client.Get(ctx), selector: selector} - ctx = context.WithValue(ctx, Key{Selector: selector}, inf) - } - return ctx -} - // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1alpha1.TektonTriggerInformer { untyped := ctx.Value(Key{Selector: selector}) @@ -85,46 +63,3 @@ func Get(ctx context.Context, selector string) v1alpha1.TektonTriggerInformer { } return untyped.(v1alpha1.TektonTriggerInformer) } - -type wrapper struct { - client versioned.Interface - - selector string -} - -var _ v1alpha1.TektonTriggerInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonTriggerLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonTrigger{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonTriggerLister { - return w -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonTrigger, err error) { - reqs, err := labels.ParseToRequirements(w.selector) - if err != nil { - return nil, err - } - selector = selector.Add(reqs...) - lo, err := w.client.OperatorV1alpha1().TektonTriggers().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonTrigger, error) { - // TODO(mattmoor): Check that the fetched object matches the selector. - return w.client.OperatorV1alpha1().TektonTriggers().Get(context.TODO(), name, v1.GetOptions{ - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) -} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektontrigger/tektontrigger.go b/pkg/client/injection/informers/operator/v1alpha1/tektontrigger/tektontrigger.go index 453f722c38..f6c9326311 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektontrigger/tektontrigger.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektontrigger/tektontrigger.go @@ -21,15 +21,8 @@ package tektontrigger import ( context "context" - apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" v1alpha1 "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - client "github.com/tektoncd/operator/pkg/client/injection/client" factory "github.com/tektoncd/operator/pkg/client/injection/informers/factory" - operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1alpha1.TektonTriggerInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1alpha1.TektonTriggerInformer { } return untyped.(v1alpha1.TektonTriggerInformer) } - -type wrapper struct { - client versioned.Interface - - resourceVersion string -} - -var _ v1alpha1.TektonTriggerInformer = (*wrapper)(nil) -var _ operatorv1alpha1.TektonTriggerLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apisoperatorv1alpha1.TektonTrigger{}, 0, nil) -} - -func (w *wrapper) Lister() operatorv1alpha1.TektonTriggerLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apisoperatorv1alpha1.TektonTrigger, err error) { - lo, err := w.client.OperatorV1alpha1().TektonTriggers().List(context.TODO(), v1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apisoperatorv1alpha1.TektonTrigger, error) { - return w.client.OperatorV1alpha1().TektonTriggers().Get(context.TODO(), name, v1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/pkg/reconciler/platform/platform.go b/pkg/reconciler/platform/platform.go index c8b769d948..c7c1abc573 100644 --- a/pkg/reconciler/platform/platform.go +++ b/pkg/reconciler/platform/platform.go @@ -7,6 +7,7 @@ import ( "strings" installer "github.com/tektoncd/operator/pkg/reconciler/shared/tektoninstallerset" + "github.com/tektoncd/operator/upgrade" "knative.dev/pkg/injection" "knative.dev/pkg/injection/sharedmain" "knative.dev/pkg/signals" @@ -109,6 +110,10 @@ func startMain(p Platform, ctrls ControllerMap) { ctx, _ := injection.EnableInjectionOrDie(signals.NewContext(), cfg) ctx = contextWithPlatformName(ctx, pParams.Name) installer.InitTektonInstallerSetClient(ctx) + + // execute upgrade patches + upgrade.StartUpgrade(ctx, cfg) + sharedmain.MainWithConfig(ctx, pParams.SharedMainName, cfg, diff --git a/pkg/reconciler/shared/tektonconfig/tektonconfig.go b/pkg/reconciler/shared/tektonconfig/tektonconfig.go index 4c95bf0274..2236d385ed 100644 --- a/pkg/reconciler/shared/tektonconfig/tektonconfig.go +++ b/pkg/reconciler/shared/tektonconfig/tektonconfig.go @@ -29,9 +29,9 @@ import ( "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/chain" "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/pipeline" "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/trigger" + "github.com/tektoncd/operator/upgrade" apierrs "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "knative.dev/pkg/logging" pkgreconciler "knative.dev/pkg/reconciler" @@ -100,6 +100,12 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, tc *v1alpha1.TektonConfi tc.Status.InitializeConditions() tc.Status.SetVersion(r.operatorVersion) + // if there is not lastAppliedUpgradeVersion defined, assumes this is fresh installation, + // and updates the lastAppliedUpgradeVersion to most recent to avoid run upgrade patches on fresh installation + if tc.Status.GetLastAppliedUpgradeVersion() == "" { + tc.Status.SetLastAppliedUpgradeVersion(upgrade.GetLatestUpgradeVersion().String()) + } + logger.Infow("Reconciling TektonConfig", "status", tc.Status) if tc.GetName() != v1alpha1.ConfigResourceName { msg := fmt.Sprintf("Resource ignored, Expected Name: %s, Got Name: %s", @@ -193,7 +199,7 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, tc *v1alpha1.TektonConfi tc.Status.MarkPostInstallComplete() // Update the object for any spec changes - if _, err := r.operatorClientSet.OperatorV1alpha1().TektonConfigs().Update(ctx, tc, v1.UpdateOptions{}); err != nil { + if _, err := r.operatorClientSet.OperatorV1alpha1().TektonConfigs().Update(ctx, tc, metav1.UpdateOptions{}); err != nil { return err } @@ -241,7 +247,7 @@ func (r *Reconciler) markUpgrade(ctx context.Context, tc *v1alpha1.TektonConfig) // Update the object for any spec changes if _, err := r.operatorClientSet.OperatorV1alpha1().TektonConfigs().Update(ctx, - tc, v1.UpdateOptions{}); err != nil { + tc, metav1.UpdateOptions{}); err != nil { return err } return v1alpha1.RECONCILE_AGAIN_ERR diff --git a/test/e2e-common.sh b/test/e2e-common.sh index c4d9449c7d..63462590df 100755 --- a/test/e2e-common.sh +++ b/test/e2e-common.sh @@ -128,5 +128,15 @@ function install_latest_released_version() { # Wait for pods to be running in the namespaces we are deploying to local operator_namespace=$(get_operator_namespace) + echo "waiting to pods up and running" wait_until_pods_running ${operator_namespace} || fail_test "Tekton Operator controller did not come up" + + echo "tekton-operator logs:" + echo "---------------------------------------" + kubectl logs -l app=tekton-operator,name=tekton-operator --namespace ${operator_namespace} --all-containers + echo "" + echo "tekton-operator-webhook logs:" + echo "---------------------------------------" + kubectl logs -l app=tekton-operator,name=tekton-operator-webhook --namespace ${operator_namespace} --all-containers + } diff --git a/upgrade/helper/storage_version_migrator.go b/upgrade/helper/storage_version_migrator.go new file mode 100644 index 0000000000..9a9882bc52 --- /dev/null +++ b/upgrade/helper/storage_version_migrator.go @@ -0,0 +1,61 @@ +/* +Copyright 2023 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package upgrade + +import ( + "context" + "fmt" + + "go.uber.org/zap" + apixclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + apierrs "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/dynamic" + "k8s.io/client-go/rest" + "knative.dev/pkg/apiextensions/storageversion" +) + +// performs crd storage version upgrade +// lists all the resources and, +// keeps only one storage version on the crd +func MigrateStorageVersion(ctx context.Context, logger *zap.SugaredLogger, cfg *rest.Config, crdGroups []string) error { + migrator := storageversion.NewMigrator( + dynamic.NewForConfigOrDie(cfg), + apixclient.NewForConfigOrDie(cfg), + ) + + logger.Infof("migrating %d group resources", len(crdGroups)) + + for _, crdGroupString := range crdGroups { + crdGroup := schema.ParseGroupResource(crdGroupString) + if crdGroup.Empty() { + logger.Errorf("unable to parse group version: %s", crdGroupString) + return fmt.Errorf("unable to parse group version: %s", crdGroupString) + } + logger.Info("migrating group resource ", crdGroup) + if err := migrator.Migrate(ctx, crdGroup); err != nil { + if apierrs.IsNotFound(err) { + logger.Infof("ignoring resource migration - unable to fetch crd %s", crdGroup, zap.Error(err)) + continue + } + logger.Error("failed to migrate: ", zap.Error(err)) + return err + } + } + + return nil +} diff --git a/upgrade/upgrade.go b/upgrade/upgrade.go new file mode 100644 index 0000000000..2727b3da5c --- /dev/null +++ b/upgrade/upgrade.go @@ -0,0 +1,225 @@ +/* +Copyright 2023 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package upgrade + +import ( + "context" + "fmt" + "sort" + "time" + + "github.com/Masterminds/semver" + "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" + operatorclient "github.com/tektoncd/operator/pkg/client/injection/client" + "github.com/tektoncd/operator/pkg/reconciler/common" + "go.uber.org/zap" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + corev1 "k8s.io/api/core/v1" + apierrs "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" + kubeclient "knative.dev/pkg/client/injection/kube/client" + + "knative.dev/pkg/logging" +) + +const ( + operatorValidationWebhookName = "validation.webhook.operator.tekton.dev" +) + +var ( + semanticVersions []*semver.Version +) + +func init() { + // parse semVer + semvers, err := versions(upgrades) + if err != nil { + panic(err) + } + semanticVersions = semvers +} + +// version return the list of semantic version sorted +func versions(versions map[string]upgradeFunction) ([]*semver.Version, error) { + versionLists := make([]*semver.Version, len(versions)) + versionIndex := 0 + for v := range versions { + semv, err := semver.NewVersion(v) + if err != nil { + return nil, err + } + versionLists[versionIndex] = semv + versionIndex++ + } + + // to apply the updates in order + sort.Sort(semver.Collection(versionLists)) + return versionLists, nil +} + +// returns the most recent upgrade version +// will be used in on new installation. +// add in the tektonConfig CR as a reference, to avoid upgrades on fresh installation +func GetLatestUpgradeVersion() *semver.Version { + size := len(semanticVersions) + return semanticVersions[size-1] +} + +// starts the upgrade process +func StartUpgrade(ctx context.Context, cfg *rest.Config) { + logger := logging.FromContext(ctx).Named("upgrade") + + // get kubernetes client + k8sClient := kubeclient.Get(ctx) + + // get operator client + operatorClient := operatorclient.Get(ctx) + + // get the last applied upgrade version + cr, err := operatorClient.OperatorV1alpha1().TektonConfigs().Get(ctx, v1alpha1.ConfigResourceName, metav1.GetOptions{}) + if err != nil { + if apierrs.IsNotFound(err) { + logger.Info("looks like this is fresh installation, upgrade not required.") + return + } + logger.Fatalw("error on getting tektonConfig CR", err) + } + + // get the last applied version + lastAppliedUpgrade := cr.Status.GetLastAppliedUpgradeVersion() + if lastAppliedUpgrade == "" { // there is no upgrade performed yet, keep 0.0.0 as reference version + lastAppliedUpgrade = "0.0.0" + } + + lastAppliedUpgradeVersion, err := semver.NewVersion(lastAppliedUpgrade) + if err != nil { + logger.Fatal("error on parsing version", zap.String("lastAppliedUpgradeVersion", lastAppliedUpgrade), zap.Error(err)) + } + + // check, if upgrade required + latestUpgradeVersion := GetLatestUpgradeVersion() + if latestUpgradeVersion.GreaterThan(lastAppliedUpgradeVersion) { + waitConditionFunc := operatorWebhookAvailableStatusFunc(ctx, logger, k8sClient) + interval := time.Second * 10 + timeout := time.Minute * 3 + logger.Infow("waiting for operator webhook endpoint availability", + "webhookName", operatorValidationWebhookName, + "pollInterval", interval.String(), + "pollTimeout", timeout.String(), + ) + err = wait.PollImmediate(interval, timeout, waitConditionFunc) + if err != nil { + logger.Fatalw("error on waiting to operator webhook availability", "webhookName", operatorValidationWebhookName, err) + } + } else { + // upgrade not required + logger.Infow("lastAppliedUpgradeVersion is greater than or equal to latestUpgradeVersion, skipping upgrade", + "lastAppliedUpgradeVersion", lastAppliedUpgradeVersion.String(), + "latestUpgradeVersion", latestUpgradeVersion.String(), + ) + return + } + + // execute all the required upgrades + for _, targetUpgradeVersion := range semanticVersions { + if targetUpgradeVersion.GreaterThan(lastAppliedUpgradeVersion) { + logger.Infow("upgrade triggered", "targetUpgradeVersion", targetUpgradeVersion.String()) + err = upgrades[targetUpgradeVersion.String()](ctx, logger, k8sClient, cfg) + if err != nil { + logger.Fatalw("error on upgrade", "targetUpgradeVersion", targetUpgradeVersion.String(), err) + } + + appliedUpgradeVersion := targetUpgradeVersion.String() + logger.Infow("upgrade successful", "appliedUpgradeVersion", appliedUpgradeVersion) + + // update last applied version into TektonConfig CR, under status + _cr, err := operatorClient.OperatorV1alpha1().TektonConfigs().Get(ctx, v1alpha1.ConfigResourceName, metav1.GetOptions{}) + if err != nil { + logger.Fatalw("error on getting tektonConfig CR", "appliedUpgradeVersion", appliedUpgradeVersion, err) + } + _cr.Status.SetLastAppliedUpgradeVersion(appliedUpgradeVersion) + _, err = operatorClient.OperatorV1alpha1().TektonConfigs().UpdateStatus(ctx, _cr, metav1.UpdateOptions{}) + if err != nil { + logger.Fatalw("error on updating tektonConfig CR status", "appliedUpgradeVersion", appliedUpgradeVersion, err) + } + } + } +} + +func operatorWebhookAvailableStatusFunc(ctx context.Context, logger *zap.SugaredLogger, k8sClient kubernetes.Interface) wait.ConditionFunc { + return func() (bool, error) { + webhookCfg, err := k8sClient.AdmissionregistrationV1().ValidatingWebhookConfigurations().Get(ctx, operatorValidationWebhookName, metav1.GetOptions{}) + if err != nil { + if apierrs.IsNotFound(err) { + logger.Infow("webhook not available", "webhookName", operatorValidationWebhookName) + return false, nil + } + return false, err + } + + var serviceReference *admissionregistrationv1.ServiceReference + for _, webhook := range webhookCfg.Webhooks { + if webhook.Name == operatorValidationWebhookName { + serviceReference = webhook.ClientConfig.Service + } + } + if serviceReference == nil { + return false, fmt.Errorf("service details are not updated in webhook:%s", operatorValidationWebhookName) + } + + service, err := k8sClient.CoreV1().Services(serviceReference.Namespace).Get(ctx, serviceReference.Name, metav1.GetOptions{}) + if err != nil { + if apierrs.IsNotFound(err) { + logger.Infow("webhook service is available", "webhookName", webhookCfg.Name) + return false, nil + } + return false, err + } + + // verify endpoints availability + endpointSelector := metav1.LabelSelector{ + MatchLabels: service.Spec.Selector, + } + + labelSelector, err := common.LabelSelector(endpointSelector) + if err != nil { + return false, err + } + podList, err := k8sClient.CoreV1().Pods(service.Namespace).List(ctx, metav1.ListOptions{LabelSelector: labelSelector}) + if err != nil { + return false, err + } + if len(podList.Items) > 0 { + for _, pod := range podList.Items { + for _, condition := range pod.Status.Conditions { + if condition.Type == corev1.ContainersReady && condition.Status == corev1.ConditionTrue { + logger.Infow("webhook pod is in running state", "podName", pod.Name, "podNamespace", pod.Namespace) + return true, nil + } + } + logger.Infow("webhook pod is not in running state", "podName", pod.Name, "podNamespace", pod.Namespace) + } + logger.Infow("webhook endpoints are available, but non of pods are in running state", "labelSelector", service.Spec.Selector, "numberOfEndpoints", len(podList.Items)) + return false, nil + } + logger.Infow("webhook endpoints are not available", "labelSelector", service.Spec.Selector) + return false, nil + } +} diff --git a/upgrade/v0_68_0__1.go b/upgrade/v0_68_0__1.go new file mode 100644 index 0000000000..ec7cd99c0e --- /dev/null +++ b/upgrade/v0_68_0__1.go @@ -0,0 +1,52 @@ +/* +Copyright 2023 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package upgrade + +import ( + "context" + + upgrade "github.com/tektoncd/operator/upgrade/helper" + "go.uber.org/zap" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" +) + +// performs storage versions upgrade +// lists all the resources and keeps only one storage version +func upgrade_0_68_0__1(ctx context.Context, logger *zap.SugaredLogger, k8sClient kubernetes.Interface, cfg *rest.Config) error { + // resources to be upgraded + crdGroups := []string{ + "clusterinterceptors.triggers.tekton.dev", + "clustertasks.tekton.dev", + "clustertriggerbindings.triggers.tekton.dev", + "customruns.tekton.dev", + "eventlisteners.triggers.tekton.dev", + "extensions.dashboard.tekton.dev", + "interceptors.triggers.tekton.dev", + "pipelineruns.tekton.dev", + "pipelines.tekton.dev", + "resolutionrequests.resolution.tekton.dev", + "taskruns.tekton.dev", + "tasks.tekton.dev", + "triggerbindings.triggers.tekton.dev", + "triggers.triggers.tekton.dev", + "triggertemplates.triggers.tekton.dev", + "verificationpolicies.tekton.dev", + } + + return upgrade.MigrateStorageVersion(ctx, logger, cfg, crdGroups) +} diff --git a/upgrade/versions.go b/upgrade/versions.go new file mode 100644 index 0000000000..2ab960dfe3 --- /dev/null +++ b/upgrade/versions.go @@ -0,0 +1,34 @@ +/* +Copyright 2023 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package upgrade + +import ( + "context" + + "go.uber.org/zap" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" +) + +type upgradeFunction = func(ctx context.Context, logger *zap.SugaredLogger, k8sClient kubernetes.Interface, cfg *rest.Config) error + +// map all the upgrade paths +// version should start with next release version and maintain sequence of "-1", "-2" to support multiple upgrades with in a version. +// also it is possible to upgrade between development version and production version +var upgrades = map[string]upgradeFunction{ + "0.68.0-1": upgrade_0_68_0__1, // v0.68.0 upgrade #1 +} diff --git a/vendor/knative.dev/pkg/apiextensions/storageversion/migrator.go b/vendor/knative.dev/pkg/apiextensions/storageversion/migrator.go new file mode 100644 index 0000000000..7ac1cc9326 --- /dev/null +++ b/vendor/knative.dev/pkg/apiextensions/storageversion/migrator.go @@ -0,0 +1,121 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package storageversion + +import ( + "context" + "fmt" + + apix "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + apixclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + apierrs "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/dynamic" + "k8s.io/client-go/tools/pager" +) + +// Migrator will read custom resource definitions and upgrade +// the associated resources to the latest storage version +type Migrator struct { + dynamicClient dynamic.Interface + apixClient apixclient.Interface +} + +// NewMigrator will return a new Migrator +func NewMigrator(d dynamic.Interface, a apixclient.Interface) *Migrator { + return &Migrator{ + dynamicClient: d, + apixClient: a, + } +} + +// Migrate takes a group resource (ie. resource.some.group.dev) and +// updates instances of the resource to the latest storage version +// +// This is done by listing all the resources and performing an empty patch +// which triggers a migration on the K8s API server +// +// Finally the migrator will update the CRD's status and drop older storage +// versions +func (m *Migrator) Migrate(ctx context.Context, gr schema.GroupResource) error { + crdClient := m.apixClient.ApiextensionsV1().CustomResourceDefinitions() + + crd, err := crdClient.Get(ctx, gr.String(), metav1.GetOptions{}) + if err != nil { + return fmt.Errorf("unable to fetch crd %s - %w", gr, err) + } + + version := storageVersion(crd) + + if version == "" { + return fmt.Errorf("unable to determine storage version for %s", gr) + } + + if err := m.migrateResources(ctx, gr.WithVersion(version)); err != nil { + return err + } + + patch := `{"status":{"storedVersions":["` + version + `"]}}` + _, err = crdClient.Patch(ctx, crd.Name, types.StrategicMergePatchType, []byte(patch), metav1.PatchOptions{}, "status") + if err != nil { + return fmt.Errorf("unable to drop storage version definition %s - %w", gr, err) + } + + return nil +} + +func (m *Migrator) migrateResources(ctx context.Context, gvr schema.GroupVersionResource) error { + client := m.dynamicClient.Resource(gvr) + + listFunc := func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { + return client.Namespace(metav1.NamespaceAll).List(ctx, opts) + } + + onEach := func(obj runtime.Object) error { + item := obj.(metav1.Object) + + _, err := client.Namespace(item.GetNamespace()). + Patch(ctx, item.GetName(), types.MergePatchType, []byte("{}"), metav1.PatchOptions{}) + + if err != nil && !apierrs.IsNotFound(err) { + return fmt.Errorf("unable to patch resource %s/%s (gvr: %s) - %w", + item.GetNamespace(), item.GetName(), + gvr, err) + } + + return nil + } + + pager := pager.New(listFunc) + return pager.EachListItem(ctx, metav1.ListOptions{}, onEach) +} + +func storageVersion(crd *apix.CustomResourceDefinition) string { + var version string + + for _, v := range crd.Spec.Versions { + if v.Storage { + version = v.Name + break + } + } + + return version +} diff --git a/vendor/knative.dev/pkg/apis/duck/v1/destination.go b/vendor/knative.dev/pkg/apis/duck/v1/destination.go index 15638f4018..8e067a99b5 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/destination.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/destination.go @@ -18,6 +18,8 @@ package v1 import ( "context" + "crypto/x509" + "encoding/pem" "knative.dev/pkg/apis" ) @@ -53,6 +55,7 @@ func (d *Destination) Validate(ctx context.Context) *apis.FieldError { func ValidateDestination(ctx context.Context, dest Destination) *apis.FieldError { ref := dest.Ref uri := dest.URI + caCerts := dest.CACerts if ref == nil && uri == nil { return apis.ErrGeneric("expected at least one, got none", "ref", "uri") } @@ -67,6 +70,9 @@ func ValidateDestination(ctx context.Context, dest Destination) *apis.FieldError if ref != nil && uri == nil { return ref.Validate(ctx).ViaField("ref") } + if caCerts != nil { + return validateCACerts(caCerts) + } return nil } @@ -88,3 +94,20 @@ func (d *Destination) SetDefaults(ctx context.Context) { d.Ref.Namespace = apis.ParentMeta(ctx).Namespace } } + +func validateCACerts(CACert *string) *apis.FieldError { + // Check the object. + var errs *apis.FieldError + + block, err := pem.Decode([]byte(*CACert)) + if err != nil && block == nil { + errs = errs.Also(apis.ErrInvalidValue("CA Cert provided is invalid", "caCert")) + return errs + } + if block.Type != "CERTIFICATE" { + errs = errs.Also(apis.ErrInvalidValue("CA Cert provided is not a certificate", "caCert")) + } else if _, err := x509.ParseCertificate(block.Bytes); err != nil { + errs = errs.Also(apis.ErrInvalidValue("CA Cert provided is invalid", "caCert")) + } + return errs +} diff --git a/vendor/knative.dev/pkg/apis/duck/v1/knative_reference.go b/vendor/knative.dev/pkg/apis/duck/v1/knative_reference.go index c723c147a9..4d03b6b97c 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/knative_reference.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/knative_reference.go @@ -128,3 +128,12 @@ func isKReferenceGroupAllowed(ctx context.Context) bool { func KReferenceGroupAllowed(ctx context.Context) context.Context { return context.WithValue(ctx, isGroupAllowed{}, struct{}{}) } + +func (kr *KReference) String() string { + address := "" + if kr.Address != nil { + address = *kr.Address + } + return fmt.Sprintf("Kind = %s, Namespace = %s, Name = %s, APIVersion = %s, Group = %s, Address = %s", + kr.Kind, kr.Namespace, kr.Name, kr.APIVersion, kr.Group, address) +} diff --git a/vendor/knative.dev/pkg/apis/duck/v1/kresource_type.go b/vendor/knative.dev/pkg/apis/duck/v1/kresource_type.go index 491c13f1f6..1f6ee8264e 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/kresource_type.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/kresource_type.go @@ -23,6 +23,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "knative.dev/pkg/apis/duck/ducktypes" "knative.dev/pkg/apis" @@ -41,6 +42,7 @@ type KRShaped interface { // Asserts KResource conformance with KRShaped var _ KRShaped = (*KResource)(nil) +// +genduck // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // KResource is a skeleton type wrapping Conditions in the manner we expect @@ -54,6 +56,11 @@ type KResource struct { Status Status `json:"status"` } +// GetFullType implements duck.Implementable +func (*KResource) GetFullType() ducktypes.Populatable { + return &KResource{} +} + // Populate implements duck.Populatable func (t *KResource) Populate() { t.Status.ObservedGeneration = 42 diff --git a/vendor/knative.dev/pkg/apis/duck/v1/source_types.go b/vendor/knative.dev/pkg/apis/duck/v1/source_types.go index bed832f32f..1f67403464 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/source_types.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/source_types.go @@ -84,6 +84,11 @@ type SourceStatus struct { // as part of its CloudEvents. // +optional CloudEventAttributes []CloudEventAttributes `json:"ceAttributes,omitempty"` + + // SinkCACerts are Certification Authority (CA) certificates in PEM format + // according to https://www.rfc-editor.org/rfc/rfc7468. + // +optional + SinkCACerts *string `json:"sinkCACerts,omitempty"` } // CloudEventAttributes specifies the attributes that a Source diff --git a/vendor/knative.dev/pkg/apis/duck/v1/zz_generated.deepcopy.go b/vendor/knative.dev/pkg/apis/duck/v1/zz_generated.deepcopy.go index 83cccfd3b8..744a38bb08 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/zz_generated.deepcopy.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/zz_generated.deepcopy.go @@ -630,6 +630,11 @@ func (in *SourceStatus) DeepCopyInto(out *SourceStatus) { *out = make([]CloudEventAttributes, len(*in)) copy(*out, *in) } + if in.SinkCACerts != nil { + in, out := &in.SinkCACerts, &out.SinkCACerts + *out = new(string) + **out = **in + } return } diff --git a/vendor/knative.dev/pkg/apis/duck/v1beta1/destination.go b/vendor/knative.dev/pkg/apis/duck/v1beta1/destination.go index 4c361d7c1c..ba83f1d4ee 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1beta1/destination.go +++ b/vendor/knative.dev/pkg/apis/duck/v1beta1/destination.go @@ -18,6 +18,8 @@ package v1beta1 import ( "context" + "crypto/x509" + "encoding/pem" corev1 "k8s.io/api/core/v1" "knative.dev/pkg/apis" @@ -117,6 +119,9 @@ func ValidateDestination(dest Destination, allowDeprecatedFields bool) *apis.Fie } return validateDestinationRef(*ref) } + if dest.CACerts != nil { + return validateCACerts(dest.CACerts) + } return nil } @@ -162,3 +167,19 @@ func validateDestinationRef(ref corev1.ObjectReference) *apis.FieldError { return errs } +func validateCACerts(CACert *string) *apis.FieldError { + // Check the object. + var errs *apis.FieldError + + block, err := pem.Decode([]byte(*CACert)) + if err != nil && block == nil { + errs = errs.Also(apis.ErrInvalidValue("CA Cert provided is invalid", "caCert")) + return errs + } + if block.Type != "CERTIFICATE" { + errs = errs.Also(apis.ErrInvalidValue("CA Cert provided is not a certificate", "caCert")) + } else if _, err := x509.ParseCertificate(block.Bytes); err != nil { + errs = errs.Also(apis.ErrInvalidValue("CA Cert provided is invalid", "caCert")) + } + return errs +} diff --git a/vendor/knative.dev/pkg/client/injection/kube/client/client.go b/vendor/knative.dev/pkg/client/injection/kube/client/client.go index f490241e1d..b5735bbb06 100644 --- a/vendor/knative.dev/pkg/client/injection/kube/client/client.go +++ b/vendor/knative.dev/pkg/client/injection/kube/client/client.go @@ -20,158 +20,11 @@ package client import ( context "context" - json "encoding/json" - errors "errors" - fmt "fmt" - admissionregistrationv1 "k8s.io/api/admissionregistration/v1" - admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" - apiserverinternalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" - apiappsv1 "k8s.io/api/apps/v1" - apiappsv1beta1 "k8s.io/api/apps/v1beta1" - appsv1beta2 "k8s.io/api/apps/v1beta2" - authenticationv1 "k8s.io/api/authentication/v1" - authenticationv1beta1 "k8s.io/api/authentication/v1beta1" - authorizationv1 "k8s.io/api/authorization/v1" - authorizationv1beta1 "k8s.io/api/authorization/v1beta1" - autoscalingv1 "k8s.io/api/autoscaling/v1" - autoscalingv2 "k8s.io/api/autoscaling/v2" - autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" - apibatchv1 "k8s.io/api/batch/v1" - apibatchv1beta1 "k8s.io/api/batch/v1beta1" - apicertificatesv1 "k8s.io/api/certificates/v1" - apicertificatesv1beta1 "k8s.io/api/certificates/v1beta1" - apicoordinationv1 "k8s.io/api/coordination/v1" - apicoordinationv1beta1 "k8s.io/api/coordination/v1beta1" - apicorev1 "k8s.io/api/core/v1" - apidiscoveryv1 "k8s.io/api/discovery/v1" - apidiscoveryv1beta1 "k8s.io/api/discovery/v1beta1" - apieventsv1 "k8s.io/api/events/v1" - apieventsv1beta1 "k8s.io/api/events/v1beta1" - apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" - apiflowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" - apiflowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" - apiflowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" - apinetworkingv1 "k8s.io/api/networking/v1" - apinetworkingv1alpha1 "k8s.io/api/networking/v1alpha1" - apinetworkingv1beta1 "k8s.io/api/networking/v1beta1" - apinodev1 "k8s.io/api/node/v1" - apinodev1alpha1 "k8s.io/api/node/v1alpha1" - apinodev1beta1 "k8s.io/api/node/v1beta1" - apipolicyv1 "k8s.io/api/policy/v1" - apipolicyv1beta1 "k8s.io/api/policy/v1beta1" - apirbacv1 "k8s.io/api/rbac/v1" - apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" - apirbacv1beta1 "k8s.io/api/rbac/v1beta1" - apischedulingv1 "k8s.io/api/scheduling/v1" - apischedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" - apischedulingv1beta1 "k8s.io/api/scheduling/v1beta1" - apistoragev1 "k8s.io/api/storage/v1" - apistoragev1alpha1 "k8s.io/api/storage/v1alpha1" - apistoragev1beta1 "k8s.io/api/storage/v1beta1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - v1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1" - v1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1" - v1alpha1 "k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1" - appsv1 "k8s.io/client-go/applyconfigurations/apps/v1" - appsv1beta1 "k8s.io/client-go/applyconfigurations/apps/v1beta1" - v1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2" - applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" - v2 "k8s.io/client-go/applyconfigurations/autoscaling/v2" - v2beta1 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta1" - v2beta2 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta2" - batchv1 "k8s.io/client-go/applyconfigurations/batch/v1" - batchv1beta1 "k8s.io/client-go/applyconfigurations/batch/v1beta1" - certificatesv1 "k8s.io/client-go/applyconfigurations/certificates/v1" - certificatesv1beta1 "k8s.io/client-go/applyconfigurations/certificates/v1beta1" - coordinationv1 "k8s.io/client-go/applyconfigurations/coordination/v1" - coordinationv1beta1 "k8s.io/client-go/applyconfigurations/coordination/v1beta1" - corev1 "k8s.io/client-go/applyconfigurations/core/v1" - discoveryv1 "k8s.io/client-go/applyconfigurations/discovery/v1" - discoveryv1beta1 "k8s.io/client-go/applyconfigurations/discovery/v1beta1" - eventsv1 "k8s.io/client-go/applyconfigurations/events/v1" - eventsv1beta1 "k8s.io/client-go/applyconfigurations/events/v1beta1" - extensionsv1beta1 "k8s.io/client-go/applyconfigurations/extensions/v1beta1" - flowcontrolv1alpha1 "k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1" - flowcontrolv1beta1 "k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1" - flowcontrolv1beta2 "k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2" - networkingv1 "k8s.io/client-go/applyconfigurations/networking/v1" - networkingv1alpha1 "k8s.io/client-go/applyconfigurations/networking/v1alpha1" - networkingv1beta1 "k8s.io/client-go/applyconfigurations/networking/v1beta1" - nodev1 "k8s.io/client-go/applyconfigurations/node/v1" - nodev1alpha1 "k8s.io/client-go/applyconfigurations/node/v1alpha1" - nodev1beta1 "k8s.io/client-go/applyconfigurations/node/v1beta1" - policyv1 "k8s.io/client-go/applyconfigurations/policy/v1" - policyv1beta1 "k8s.io/client-go/applyconfigurations/policy/v1beta1" - rbacv1 "k8s.io/client-go/applyconfigurations/rbac/v1" - rbacv1alpha1 "k8s.io/client-go/applyconfigurations/rbac/v1alpha1" - rbacv1beta1 "k8s.io/client-go/applyconfigurations/rbac/v1beta1" - schedulingv1 "k8s.io/client-go/applyconfigurations/scheduling/v1" - schedulingv1alpha1 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha1" - schedulingv1beta1 "k8s.io/client-go/applyconfigurations/scheduling/v1beta1" - storagev1 "k8s.io/client-go/applyconfigurations/storage/v1" - storagev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1" - storagev1beta1 "k8s.io/client-go/applyconfigurations/storage/v1beta1" - discovery "k8s.io/client-go/discovery" - dynamic "k8s.io/client-go/dynamic" kubernetes "k8s.io/client-go/kubernetes" - typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1" - typedadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1" - typedinternalv1alpha1 "k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1" - typedappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1" - typedappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1" - typedappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2" - typedauthenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1" - typedauthenticationv1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1" - typedauthorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1" - typedauthorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1" - typedautoscalingv1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1" - typedautoscalingv2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2" - typedautoscalingv2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1" - typedautoscalingv2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2" - typedbatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1" - typedbatchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1" - typedcertificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1" - typedcertificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1" - typedcoordinationv1 "k8s.io/client-go/kubernetes/typed/coordination/v1" - typedcoordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1" - typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" - typeddiscoveryv1 "k8s.io/client-go/kubernetes/typed/discovery/v1" - typeddiscoveryv1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1" - typedeventsv1 "k8s.io/client-go/kubernetes/typed/events/v1" - typedeventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1" - typedextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1" - typedflowcontrolv1alpha1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1" - typedflowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1" - typedflowcontrolv1beta2 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2" - typednetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1" - typednetworkingv1alpha1 "k8s.io/client-go/kubernetes/typed/networking/v1alpha1" - typednetworkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1" - typednodev1 "k8s.io/client-go/kubernetes/typed/node/v1" - typednodev1alpha1 "k8s.io/client-go/kubernetes/typed/node/v1alpha1" - typednodev1beta1 "k8s.io/client-go/kubernetes/typed/node/v1beta1" - typedpolicyv1 "k8s.io/client-go/kubernetes/typed/policy/v1" - typedpolicyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1" - typedrbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1" - typedrbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1" - typedrbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1" - typedschedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1" - typedschedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1" - typedschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" - typedstoragev1 "k8s.io/client-go/kubernetes/typed/storage/v1" - typedstoragev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1" - typedstoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1" rest "k8s.io/client-go/rest" injection "knative.dev/pkg/injection" - dynamicclient "knative.dev/pkg/injection/clients/dynamicclient" logging "knative.dev/pkg/logging" - ptr "knative.dev/pkg/ptr" ) func init() { @@ -179,7 +32,6 @@ func init() { injection.Default.RegisterClientFetcher(func(ctx context.Context) interface{} { return Get(ctx) }) - injection.Dynamic.RegisterDynamicClient(withClientFromDynamic) } // Key is used as the key for associating information with a context.Context. @@ -189,10 +41,6 @@ func withClientFromConfig(ctx context.Context, cfg *rest.Config) context.Context return context.WithValue(ctx, Key{}, kubernetes.NewForConfigOrDie(cfg)) } -func withClientFromDynamic(ctx context.Context) context.Context { - return context.WithValue(ctx, Key{}, &wrapClient{dyn: dynamicclient.Get(ctx)}) -} - // Get extracts the kubernetes.Interface client from the context. func Get(ctx context.Context) kubernetes.Interface { untyped := ctx.Value(Key{}) @@ -207,18144 +55,3 @@ func Get(ctx context.Context) kubernetes.Interface { } return untyped.(kubernetes.Interface) } - -type wrapClient struct { - dyn dynamic.Interface -} - -var _ kubernetes.Interface = (*wrapClient)(nil) - -func (w *wrapClient) Discovery() discovery.DiscoveryInterface { - panic("Discovery called on dynamic client!") -} - -func convert(from interface{}, to runtime.Object) error { - bs, err := json.Marshal(from) - if err != nil { - return fmt.Errorf("Marshal() = %w", err) - } - if err := json.Unmarshal(bs, to); err != nil { - return fmt.Errorf("Unmarshal() = %w", err) - } - return nil -} - -// AdmissionregistrationV1 retrieves the AdmissionregistrationV1Client -func (w *wrapClient) AdmissionregistrationV1() typedadmissionregistrationv1.AdmissionregistrationV1Interface { - return &wrapAdmissionregistrationV1{ - dyn: w.dyn, - } -} - -type wrapAdmissionregistrationV1 struct { - dyn dynamic.Interface -} - -func (w *wrapAdmissionregistrationV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapAdmissionregistrationV1) MutatingWebhookConfigurations() typedadmissionregistrationv1.MutatingWebhookConfigurationInterface { - return &wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "admissionregistration.k8s.io", - Version: "v1", - Resource: "mutatingwebhookconfigurations", - }), - } -} - -type wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedadmissionregistrationv1.MutatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl)(nil) - -func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Apply(ctx context.Context, in *v1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.MutatingWebhookConfiguration, err error) { - in.Kind = ptr.String("MutatingWebhookConfiguration") - - in.APIVersion = ptr.String("admissionregistration.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) ApplyStatus(ctx context.Context, in *v1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.MutatingWebhookConfiguration, err error) { - in.Kind = ptr.String("MutatingWebhookConfiguration") - - in.APIVersion = ptr.String("admissionregistration.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Create(ctx context.Context, in *admissionregistrationv1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (*admissionregistrationv1.MutatingWebhookConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "admissionregistration.k8s.io", - Version: "v1", - Kind: "MutatingWebhookConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*admissionregistrationv1.MutatingWebhookConfiguration, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*admissionregistrationv1.MutatingWebhookConfigurationList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.MutatingWebhookConfigurationList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *admissionregistrationv1.MutatingWebhookConfiguration, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Update(ctx context.Context, in *admissionregistrationv1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1.MutatingWebhookConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "admissionregistration.k8s.io", - Version: "v1", - Kind: "MutatingWebhookConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) UpdateStatus(ctx context.Context, in *admissionregistrationv1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1.MutatingWebhookConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "admissionregistration.k8s.io", - Version: "v1", - Kind: "MutatingWebhookConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAdmissionregistrationV1) ValidatingWebhookConfigurations() typedadmissionregistrationv1.ValidatingWebhookConfigurationInterface { - return &wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "admissionregistration.k8s.io", - Version: "v1", - Resource: "validatingwebhookconfigurations", - }), - } -} - -type wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedadmissionregistrationv1.ValidatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl)(nil) - -func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Apply(ctx context.Context, in *v1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.ValidatingWebhookConfiguration, err error) { - in.Kind = ptr.String("ValidatingWebhookConfiguration") - - in.APIVersion = ptr.String("admissionregistration.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) ApplyStatus(ctx context.Context, in *v1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.ValidatingWebhookConfiguration, err error) { - in.Kind = ptr.String("ValidatingWebhookConfiguration") - - in.APIVersion = ptr.String("admissionregistration.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Create(ctx context.Context, in *admissionregistrationv1.ValidatingWebhookConfiguration, opts metav1.CreateOptions) (*admissionregistrationv1.ValidatingWebhookConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "admissionregistration.k8s.io", - Version: "v1", - Kind: "ValidatingWebhookConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*admissionregistrationv1.ValidatingWebhookConfiguration, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*admissionregistrationv1.ValidatingWebhookConfigurationList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.ValidatingWebhookConfigurationList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *admissionregistrationv1.ValidatingWebhookConfiguration, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Update(ctx context.Context, in *admissionregistrationv1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1.ValidatingWebhookConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "admissionregistration.k8s.io", - Version: "v1", - Kind: "ValidatingWebhookConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) UpdateStatus(ctx context.Context, in *admissionregistrationv1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1.ValidatingWebhookConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "admissionregistration.k8s.io", - Version: "v1", - Kind: "ValidatingWebhookConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// AdmissionregistrationV1beta1 retrieves the AdmissionregistrationV1beta1Client -func (w *wrapClient) AdmissionregistrationV1beta1() typedadmissionregistrationv1beta1.AdmissionregistrationV1beta1Interface { - return &wrapAdmissionregistrationV1beta1{ - dyn: w.dyn, - } -} - -type wrapAdmissionregistrationV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapAdmissionregistrationV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapAdmissionregistrationV1beta1) MutatingWebhookConfigurations() typedadmissionregistrationv1beta1.MutatingWebhookConfigurationInterface { - return &wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "admissionregistration.k8s.io", - Version: "v1beta1", - Resource: "mutatingwebhookconfigurations", - }), - } -} - -type wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedadmissionregistrationv1beta1.MutatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl)(nil) - -func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Apply(ctx context.Context, in *v1beta1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1beta1.MutatingWebhookConfiguration, err error) { - in.Kind = ptr.String("MutatingWebhookConfiguration") - - in.APIVersion = ptr.String("admissionregistration.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) ApplyStatus(ctx context.Context, in *v1beta1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1beta1.MutatingWebhookConfiguration, err error) { - in.Kind = ptr.String("MutatingWebhookConfiguration") - - in.APIVersion = ptr.String("admissionregistration.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Create(ctx context.Context, in *admissionregistrationv1beta1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (*admissionregistrationv1beta1.MutatingWebhookConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "admissionregistration.k8s.io", - Version: "v1beta1", - Kind: "MutatingWebhookConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*admissionregistrationv1beta1.MutatingWebhookConfiguration, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*admissionregistrationv1beta1.MutatingWebhookConfigurationList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.MutatingWebhookConfigurationList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *admissionregistrationv1beta1.MutatingWebhookConfiguration, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Update(ctx context.Context, in *admissionregistrationv1beta1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1beta1.MutatingWebhookConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "admissionregistration.k8s.io", - Version: "v1beta1", - Kind: "MutatingWebhookConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) UpdateStatus(ctx context.Context, in *admissionregistrationv1beta1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1beta1.MutatingWebhookConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "admissionregistration.k8s.io", - Version: "v1beta1", - Kind: "MutatingWebhookConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAdmissionregistrationV1beta1) ValidatingWebhookConfigurations() typedadmissionregistrationv1beta1.ValidatingWebhookConfigurationInterface { - return &wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "admissionregistration.k8s.io", - Version: "v1beta1", - Resource: "validatingwebhookconfigurations", - }), - } -} - -type wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedadmissionregistrationv1beta1.ValidatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl)(nil) - -func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Apply(ctx context.Context, in *v1beta1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1beta1.ValidatingWebhookConfiguration, err error) { - in.Kind = ptr.String("ValidatingWebhookConfiguration") - - in.APIVersion = ptr.String("admissionregistration.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) ApplyStatus(ctx context.Context, in *v1beta1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1beta1.ValidatingWebhookConfiguration, err error) { - in.Kind = ptr.String("ValidatingWebhookConfiguration") - - in.APIVersion = ptr.String("admissionregistration.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Create(ctx context.Context, in *admissionregistrationv1beta1.ValidatingWebhookConfiguration, opts metav1.CreateOptions) (*admissionregistrationv1beta1.ValidatingWebhookConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "admissionregistration.k8s.io", - Version: "v1beta1", - Kind: "ValidatingWebhookConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*admissionregistrationv1beta1.ValidatingWebhookConfiguration, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*admissionregistrationv1beta1.ValidatingWebhookConfigurationList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.ValidatingWebhookConfigurationList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *admissionregistrationv1beta1.ValidatingWebhookConfiguration, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Update(ctx context.Context, in *admissionregistrationv1beta1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1beta1.ValidatingWebhookConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "admissionregistration.k8s.io", - Version: "v1beta1", - Kind: "ValidatingWebhookConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) UpdateStatus(ctx context.Context, in *admissionregistrationv1beta1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1beta1.ValidatingWebhookConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "admissionregistration.k8s.io", - Version: "v1beta1", - Kind: "ValidatingWebhookConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// InternalV1alpha1 retrieves the InternalV1alpha1Client -func (w *wrapClient) InternalV1alpha1() typedinternalv1alpha1.InternalV1alpha1Interface { - return &wrapInternalV1alpha1{ - dyn: w.dyn, - } -} - -type wrapInternalV1alpha1 struct { - dyn dynamic.Interface -} - -func (w *wrapInternalV1alpha1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapInternalV1alpha1) StorageVersions() typedinternalv1alpha1.StorageVersionInterface { - return &wrapInternalV1alpha1StorageVersionImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "internal.apiserver.k8s.io", - Version: "v1alpha1", - Resource: "storageversions", - }), - } -} - -type wrapInternalV1alpha1StorageVersionImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedinternalv1alpha1.StorageVersionInterface = (*wrapInternalV1alpha1StorageVersionImpl)(nil) - -func (w *wrapInternalV1alpha1StorageVersionImpl) Apply(ctx context.Context, in *v1alpha1.StorageVersionApplyConfiguration, opts metav1.ApplyOptions) (result *apiserverinternalv1alpha1.StorageVersion, err error) { - in.Kind = ptr.String("StorageVersion") - - in.APIVersion = ptr.String("internal.apiserver.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiserverinternalv1alpha1.StorageVersion{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapInternalV1alpha1StorageVersionImpl) ApplyStatus(ctx context.Context, in *v1alpha1.StorageVersionApplyConfiguration, opts metav1.ApplyOptions) (result *apiserverinternalv1alpha1.StorageVersion, err error) { - in.Kind = ptr.String("StorageVersion") - - in.APIVersion = ptr.String("internal.apiserver.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiserverinternalv1alpha1.StorageVersion{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapInternalV1alpha1StorageVersionImpl) Create(ctx context.Context, in *apiserverinternalv1alpha1.StorageVersion, opts metav1.CreateOptions) (*apiserverinternalv1alpha1.StorageVersion, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "internal.apiserver.k8s.io", - Version: "v1alpha1", - Kind: "StorageVersion", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiserverinternalv1alpha1.StorageVersion{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapInternalV1alpha1StorageVersionImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapInternalV1alpha1StorageVersionImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapInternalV1alpha1StorageVersionImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiserverinternalv1alpha1.StorageVersion, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiserverinternalv1alpha1.StorageVersion{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapInternalV1alpha1StorageVersionImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiserverinternalv1alpha1.StorageVersionList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiserverinternalv1alpha1.StorageVersionList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapInternalV1alpha1StorageVersionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiserverinternalv1alpha1.StorageVersion, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiserverinternalv1alpha1.StorageVersion{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapInternalV1alpha1StorageVersionImpl) Update(ctx context.Context, in *apiserverinternalv1alpha1.StorageVersion, opts metav1.UpdateOptions) (*apiserverinternalv1alpha1.StorageVersion, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "internal.apiserver.k8s.io", - Version: "v1alpha1", - Kind: "StorageVersion", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiserverinternalv1alpha1.StorageVersion{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapInternalV1alpha1StorageVersionImpl) UpdateStatus(ctx context.Context, in *apiserverinternalv1alpha1.StorageVersion, opts metav1.UpdateOptions) (*apiserverinternalv1alpha1.StorageVersion, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "internal.apiserver.k8s.io", - Version: "v1alpha1", - Kind: "StorageVersion", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiserverinternalv1alpha1.StorageVersion{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapInternalV1alpha1StorageVersionImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// AppsV1 retrieves the AppsV1Client -func (w *wrapClient) AppsV1() typedappsv1.AppsV1Interface { - return &wrapAppsV1{ - dyn: w.dyn, - } -} - -type wrapAppsV1 struct { - dyn dynamic.Interface -} - -func (w *wrapAppsV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapAppsV1) ControllerRevisions(namespace string) typedappsv1.ControllerRevisionInterface { - return &wrapAppsV1ControllerRevisionImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "apps", - Version: "v1", - Resource: "controllerrevisions", - }), - - namespace: namespace, - } -} - -type wrapAppsV1ControllerRevisionImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedappsv1.ControllerRevisionInterface = (*wrapAppsV1ControllerRevisionImpl)(nil) - -func (w *wrapAppsV1ControllerRevisionImpl) Apply(ctx context.Context, in *appsv1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.ControllerRevision, err error) { - in.Kind = ptr.String("ControllerRevision") - - in.APIVersion = ptr.String("apps/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ControllerRevisionImpl) ApplyStatus(ctx context.Context, in *appsv1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.ControllerRevision, err error) { - in.Kind = ptr.String("ControllerRevision") - - in.APIVersion = ptr.String("apps/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ControllerRevisionImpl) Create(ctx context.Context, in *apiappsv1.ControllerRevision, opts metav1.CreateOptions) (*apiappsv1.ControllerRevision, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "ControllerRevision", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ControllerRevisionImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAppsV1ControllerRevisionImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAppsV1ControllerRevisionImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1.ControllerRevision, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ControllerRevisionImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1.ControllerRevisionList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ControllerRevisionList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ControllerRevisionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1.ControllerRevision, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ControllerRevisionImpl) Update(ctx context.Context, in *apiappsv1.ControllerRevision, opts metav1.UpdateOptions) (*apiappsv1.ControllerRevision, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "ControllerRevision", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ControllerRevisionImpl) UpdateStatus(ctx context.Context, in *apiappsv1.ControllerRevision, opts metav1.UpdateOptions) (*apiappsv1.ControllerRevision, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "ControllerRevision", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ControllerRevisionImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAppsV1) DaemonSets(namespace string) typedappsv1.DaemonSetInterface { - return &wrapAppsV1DaemonSetImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "apps", - Version: "v1", - Resource: "daemonsets", - }), - - namespace: namespace, - } -} - -type wrapAppsV1DaemonSetImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedappsv1.DaemonSetInterface = (*wrapAppsV1DaemonSetImpl)(nil) - -func (w *wrapAppsV1DaemonSetImpl) Apply(ctx context.Context, in *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.DaemonSet, err error) { - in.Kind = ptr.String("DaemonSet") - - in.APIVersion = ptr.String("apps/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DaemonSetImpl) ApplyStatus(ctx context.Context, in *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.DaemonSet, err error) { - in.Kind = ptr.String("DaemonSet") - - in.APIVersion = ptr.String("apps/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DaemonSetImpl) Create(ctx context.Context, in *apiappsv1.DaemonSet, opts metav1.CreateOptions) (*apiappsv1.DaemonSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "DaemonSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DaemonSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAppsV1DaemonSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAppsV1DaemonSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1.DaemonSet, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DaemonSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1.DaemonSetList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.DaemonSetList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DaemonSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1.DaemonSet, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DaemonSetImpl) Update(ctx context.Context, in *apiappsv1.DaemonSet, opts metav1.UpdateOptions) (*apiappsv1.DaemonSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "DaemonSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DaemonSetImpl) UpdateStatus(ctx context.Context, in *apiappsv1.DaemonSet, opts metav1.UpdateOptions) (*apiappsv1.DaemonSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "DaemonSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DaemonSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAppsV1) Deployments(namespace string) typedappsv1.DeploymentInterface { - return &wrapAppsV1DeploymentImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "apps", - Version: "v1", - Resource: "deployments", - }), - - namespace: namespace, - } -} - -type wrapAppsV1DeploymentImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedappsv1.DeploymentInterface = (*wrapAppsV1DeploymentImpl)(nil) - -func (w *wrapAppsV1DeploymentImpl) Apply(ctx context.Context, in *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.Deployment, err error) { - in.Kind = ptr.String("Deployment") - - in.APIVersion = ptr.String("apps/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DeploymentImpl) ApplyStatus(ctx context.Context, in *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.Deployment, err error) { - in.Kind = ptr.String("Deployment") - - in.APIVersion = ptr.String("apps/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DeploymentImpl) Create(ctx context.Context, in *apiappsv1.Deployment, opts metav1.CreateOptions) (*apiappsv1.Deployment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "Deployment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DeploymentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAppsV1DeploymentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAppsV1DeploymentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1.Deployment, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DeploymentImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1.DeploymentList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.DeploymentList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DeploymentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1.Deployment, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DeploymentImpl) Update(ctx context.Context, in *apiappsv1.Deployment, opts metav1.UpdateOptions) (*apiappsv1.Deployment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "Deployment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DeploymentImpl) UpdateStatus(ctx context.Context, in *apiappsv1.Deployment, opts metav1.UpdateOptions) (*apiappsv1.Deployment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "Deployment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1DeploymentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAppsV1DeploymentImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.Scale, error) { - panic("NYI") -} - -func (w *wrapAppsV1DeploymentImpl) UpdateScale(ctx context.Context, _ string, in *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) { - panic("NYI") -} - -func (w *wrapAppsV1DeploymentImpl) ApplyScale(ctx context.Context, name string, in *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (*autoscalingv1.Scale, error) { - panic("NYI") -} - -func (w *wrapAppsV1) ReplicaSets(namespace string) typedappsv1.ReplicaSetInterface { - return &wrapAppsV1ReplicaSetImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "apps", - Version: "v1", - Resource: "replicasets", - }), - - namespace: namespace, - } -} - -type wrapAppsV1ReplicaSetImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedappsv1.ReplicaSetInterface = (*wrapAppsV1ReplicaSetImpl)(nil) - -func (w *wrapAppsV1ReplicaSetImpl) Apply(ctx context.Context, in *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.ReplicaSet, err error) { - in.Kind = ptr.String("ReplicaSet") - - in.APIVersion = ptr.String("apps/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ReplicaSetImpl) ApplyStatus(ctx context.Context, in *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.ReplicaSet, err error) { - in.Kind = ptr.String("ReplicaSet") - - in.APIVersion = ptr.String("apps/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ReplicaSetImpl) Create(ctx context.Context, in *apiappsv1.ReplicaSet, opts metav1.CreateOptions) (*apiappsv1.ReplicaSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "ReplicaSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ReplicaSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAppsV1ReplicaSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAppsV1ReplicaSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1.ReplicaSet, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ReplicaSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1.ReplicaSetList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ReplicaSetList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ReplicaSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1.ReplicaSet, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ReplicaSetImpl) Update(ctx context.Context, in *apiappsv1.ReplicaSet, opts metav1.UpdateOptions) (*apiappsv1.ReplicaSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "ReplicaSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ReplicaSetImpl) UpdateStatus(ctx context.Context, in *apiappsv1.ReplicaSet, opts metav1.UpdateOptions) (*apiappsv1.ReplicaSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "ReplicaSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1ReplicaSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAppsV1ReplicaSetImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.Scale, error) { - panic("NYI") -} - -func (w *wrapAppsV1ReplicaSetImpl) UpdateScale(ctx context.Context, _ string, in *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) { - panic("NYI") -} - -func (w *wrapAppsV1ReplicaSetImpl) ApplyScale(ctx context.Context, name string, in *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (*autoscalingv1.Scale, error) { - panic("NYI") -} - -func (w *wrapAppsV1) StatefulSets(namespace string) typedappsv1.StatefulSetInterface { - return &wrapAppsV1StatefulSetImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "apps", - Version: "v1", - Resource: "statefulsets", - }), - - namespace: namespace, - } -} - -type wrapAppsV1StatefulSetImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedappsv1.StatefulSetInterface = (*wrapAppsV1StatefulSetImpl)(nil) - -func (w *wrapAppsV1StatefulSetImpl) Apply(ctx context.Context, in *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.StatefulSet, err error) { - in.Kind = ptr.String("StatefulSet") - - in.APIVersion = ptr.String("apps/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1StatefulSetImpl) ApplyStatus(ctx context.Context, in *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.StatefulSet, err error) { - in.Kind = ptr.String("StatefulSet") - - in.APIVersion = ptr.String("apps/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1StatefulSetImpl) Create(ctx context.Context, in *apiappsv1.StatefulSet, opts metav1.CreateOptions) (*apiappsv1.StatefulSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "StatefulSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1StatefulSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAppsV1StatefulSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAppsV1StatefulSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1.StatefulSet, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1StatefulSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1.StatefulSetList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.StatefulSetList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1StatefulSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1.StatefulSet, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1StatefulSetImpl) Update(ctx context.Context, in *apiappsv1.StatefulSet, opts metav1.UpdateOptions) (*apiappsv1.StatefulSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "StatefulSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1StatefulSetImpl) UpdateStatus(ctx context.Context, in *apiappsv1.StatefulSet, opts metav1.UpdateOptions) (*apiappsv1.StatefulSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "StatefulSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1StatefulSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAppsV1StatefulSetImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.Scale, error) { - panic("NYI") -} - -func (w *wrapAppsV1StatefulSetImpl) UpdateScale(ctx context.Context, _ string, in *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) { - panic("NYI") -} - -func (w *wrapAppsV1StatefulSetImpl) ApplyScale(ctx context.Context, name string, in *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (*autoscalingv1.Scale, error) { - panic("NYI") -} - -// AppsV1beta1 retrieves the AppsV1beta1Client -func (w *wrapClient) AppsV1beta1() typedappsv1beta1.AppsV1beta1Interface { - return &wrapAppsV1beta1{ - dyn: w.dyn, - } -} - -type wrapAppsV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapAppsV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapAppsV1beta1) ControllerRevisions(namespace string) typedappsv1beta1.ControllerRevisionInterface { - return &wrapAppsV1beta1ControllerRevisionImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "apps", - Version: "v1beta1", - Resource: "controllerrevisions", - }), - - namespace: namespace, - } -} - -type wrapAppsV1beta1ControllerRevisionImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedappsv1beta1.ControllerRevisionInterface = (*wrapAppsV1beta1ControllerRevisionImpl)(nil) - -func (w *wrapAppsV1beta1ControllerRevisionImpl) Apply(ctx context.Context, in *appsv1beta1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.ControllerRevision, err error) { - in.Kind = ptr.String("ControllerRevision") - - in.APIVersion = ptr.String("apps/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1ControllerRevisionImpl) ApplyStatus(ctx context.Context, in *appsv1beta1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.ControllerRevision, err error) { - in.Kind = ptr.String("ControllerRevision") - - in.APIVersion = ptr.String("apps/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1ControllerRevisionImpl) Create(ctx context.Context, in *apiappsv1beta1.ControllerRevision, opts metav1.CreateOptions) (*apiappsv1beta1.ControllerRevision, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta1", - Kind: "ControllerRevision", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1ControllerRevisionImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAppsV1beta1ControllerRevisionImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAppsV1beta1ControllerRevisionImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1beta1.ControllerRevision, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1ControllerRevisionImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1beta1.ControllerRevisionList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.ControllerRevisionList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1ControllerRevisionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1beta1.ControllerRevision, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1ControllerRevisionImpl) Update(ctx context.Context, in *apiappsv1beta1.ControllerRevision, opts metav1.UpdateOptions) (*apiappsv1beta1.ControllerRevision, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta1", - Kind: "ControllerRevision", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1ControllerRevisionImpl) UpdateStatus(ctx context.Context, in *apiappsv1beta1.ControllerRevision, opts metav1.UpdateOptions) (*apiappsv1beta1.ControllerRevision, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta1", - Kind: "ControllerRevision", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1ControllerRevisionImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAppsV1beta1) Deployments(namespace string) typedappsv1beta1.DeploymentInterface { - return &wrapAppsV1beta1DeploymentImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "apps", - Version: "v1beta1", - Resource: "deployments", - }), - - namespace: namespace, - } -} - -type wrapAppsV1beta1DeploymentImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedappsv1beta1.DeploymentInterface = (*wrapAppsV1beta1DeploymentImpl)(nil) - -func (w *wrapAppsV1beta1DeploymentImpl) Apply(ctx context.Context, in *appsv1beta1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.Deployment, err error) { - in.Kind = ptr.String("Deployment") - - in.APIVersion = ptr.String("apps/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1DeploymentImpl) ApplyStatus(ctx context.Context, in *appsv1beta1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.Deployment, err error) { - in.Kind = ptr.String("Deployment") - - in.APIVersion = ptr.String("apps/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1DeploymentImpl) Create(ctx context.Context, in *apiappsv1beta1.Deployment, opts metav1.CreateOptions) (*apiappsv1beta1.Deployment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta1", - Kind: "Deployment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1DeploymentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAppsV1beta1DeploymentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAppsV1beta1DeploymentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1beta1.Deployment, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1DeploymentImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1beta1.DeploymentList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.DeploymentList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1DeploymentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1beta1.Deployment, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1DeploymentImpl) Update(ctx context.Context, in *apiappsv1beta1.Deployment, opts metav1.UpdateOptions) (*apiappsv1beta1.Deployment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta1", - Kind: "Deployment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1DeploymentImpl) UpdateStatus(ctx context.Context, in *apiappsv1beta1.Deployment, opts metav1.UpdateOptions) (*apiappsv1beta1.Deployment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta1", - Kind: "Deployment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1DeploymentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAppsV1beta1) StatefulSets(namespace string) typedappsv1beta1.StatefulSetInterface { - return &wrapAppsV1beta1StatefulSetImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "apps", - Version: "v1beta1", - Resource: "statefulsets", - }), - - namespace: namespace, - } -} - -type wrapAppsV1beta1StatefulSetImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedappsv1beta1.StatefulSetInterface = (*wrapAppsV1beta1StatefulSetImpl)(nil) - -func (w *wrapAppsV1beta1StatefulSetImpl) Apply(ctx context.Context, in *appsv1beta1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.StatefulSet, err error) { - in.Kind = ptr.String("StatefulSet") - - in.APIVersion = ptr.String("apps/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1StatefulSetImpl) ApplyStatus(ctx context.Context, in *appsv1beta1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.StatefulSet, err error) { - in.Kind = ptr.String("StatefulSet") - - in.APIVersion = ptr.String("apps/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1StatefulSetImpl) Create(ctx context.Context, in *apiappsv1beta1.StatefulSet, opts metav1.CreateOptions) (*apiappsv1beta1.StatefulSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta1", - Kind: "StatefulSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1StatefulSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAppsV1beta1StatefulSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAppsV1beta1StatefulSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1beta1.StatefulSet, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1StatefulSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1beta1.StatefulSetList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.StatefulSetList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1StatefulSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1beta1.StatefulSet, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1StatefulSetImpl) Update(ctx context.Context, in *apiappsv1beta1.StatefulSet, opts metav1.UpdateOptions) (*apiappsv1beta1.StatefulSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta1", - Kind: "StatefulSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1StatefulSetImpl) UpdateStatus(ctx context.Context, in *apiappsv1beta1.StatefulSet, opts metav1.UpdateOptions) (*apiappsv1beta1.StatefulSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta1", - Kind: "StatefulSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiappsv1beta1.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta1StatefulSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// AppsV1beta2 retrieves the AppsV1beta2Client -func (w *wrapClient) AppsV1beta2() typedappsv1beta2.AppsV1beta2Interface { - return &wrapAppsV1beta2{ - dyn: w.dyn, - } -} - -type wrapAppsV1beta2 struct { - dyn dynamic.Interface -} - -func (w *wrapAppsV1beta2) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapAppsV1beta2) ControllerRevisions(namespace string) typedappsv1beta2.ControllerRevisionInterface { - return &wrapAppsV1beta2ControllerRevisionImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "apps", - Version: "v1beta2", - Resource: "controllerrevisions", - }), - - namespace: namespace, - } -} - -type wrapAppsV1beta2ControllerRevisionImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedappsv1beta2.ControllerRevisionInterface = (*wrapAppsV1beta2ControllerRevisionImpl)(nil) - -func (w *wrapAppsV1beta2ControllerRevisionImpl) Apply(ctx context.Context, in *v1beta2.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.ControllerRevision, err error) { - in.Kind = ptr.String("ControllerRevision") - - in.APIVersion = ptr.String("apps/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ControllerRevisionImpl) ApplyStatus(ctx context.Context, in *v1beta2.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.ControllerRevision, err error) { - in.Kind = ptr.String("ControllerRevision") - - in.APIVersion = ptr.String("apps/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ControllerRevisionImpl) Create(ctx context.Context, in *appsv1beta2.ControllerRevision, opts metav1.CreateOptions) (*appsv1beta2.ControllerRevision, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "ControllerRevision", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ControllerRevisionImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAppsV1beta2ControllerRevisionImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAppsV1beta2ControllerRevisionImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta2.ControllerRevision, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ControllerRevisionImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1beta2.ControllerRevisionList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ControllerRevisionList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ControllerRevisionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1beta2.ControllerRevision, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ControllerRevisionImpl) Update(ctx context.Context, in *appsv1beta2.ControllerRevision, opts metav1.UpdateOptions) (*appsv1beta2.ControllerRevision, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "ControllerRevision", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ControllerRevisionImpl) UpdateStatus(ctx context.Context, in *appsv1beta2.ControllerRevision, opts metav1.UpdateOptions) (*appsv1beta2.ControllerRevision, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "ControllerRevision", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ControllerRevision{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ControllerRevisionImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAppsV1beta2) DaemonSets(namespace string) typedappsv1beta2.DaemonSetInterface { - return &wrapAppsV1beta2DaemonSetImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "apps", - Version: "v1beta2", - Resource: "daemonsets", - }), - - namespace: namespace, - } -} - -type wrapAppsV1beta2DaemonSetImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedappsv1beta2.DaemonSetInterface = (*wrapAppsV1beta2DaemonSetImpl)(nil) - -func (w *wrapAppsV1beta2DaemonSetImpl) Apply(ctx context.Context, in *v1beta2.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.DaemonSet, err error) { - in.Kind = ptr.String("DaemonSet") - - in.APIVersion = ptr.String("apps/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DaemonSetImpl) ApplyStatus(ctx context.Context, in *v1beta2.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.DaemonSet, err error) { - in.Kind = ptr.String("DaemonSet") - - in.APIVersion = ptr.String("apps/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DaemonSetImpl) Create(ctx context.Context, in *appsv1beta2.DaemonSet, opts metav1.CreateOptions) (*appsv1beta2.DaemonSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "DaemonSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DaemonSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAppsV1beta2DaemonSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAppsV1beta2DaemonSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta2.DaemonSet, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DaemonSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1beta2.DaemonSetList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.DaemonSetList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DaemonSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1beta2.DaemonSet, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DaemonSetImpl) Update(ctx context.Context, in *appsv1beta2.DaemonSet, opts metav1.UpdateOptions) (*appsv1beta2.DaemonSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "DaemonSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DaemonSetImpl) UpdateStatus(ctx context.Context, in *appsv1beta2.DaemonSet, opts metav1.UpdateOptions) (*appsv1beta2.DaemonSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "DaemonSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DaemonSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAppsV1beta2) Deployments(namespace string) typedappsv1beta2.DeploymentInterface { - return &wrapAppsV1beta2DeploymentImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "apps", - Version: "v1beta2", - Resource: "deployments", - }), - - namespace: namespace, - } -} - -type wrapAppsV1beta2DeploymentImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedappsv1beta2.DeploymentInterface = (*wrapAppsV1beta2DeploymentImpl)(nil) - -func (w *wrapAppsV1beta2DeploymentImpl) Apply(ctx context.Context, in *v1beta2.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.Deployment, err error) { - in.Kind = ptr.String("Deployment") - - in.APIVersion = ptr.String("apps/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DeploymentImpl) ApplyStatus(ctx context.Context, in *v1beta2.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.Deployment, err error) { - in.Kind = ptr.String("Deployment") - - in.APIVersion = ptr.String("apps/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DeploymentImpl) Create(ctx context.Context, in *appsv1beta2.Deployment, opts metav1.CreateOptions) (*appsv1beta2.Deployment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "Deployment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DeploymentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAppsV1beta2DeploymentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAppsV1beta2DeploymentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta2.Deployment, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DeploymentImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1beta2.DeploymentList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.DeploymentList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DeploymentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1beta2.Deployment, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DeploymentImpl) Update(ctx context.Context, in *appsv1beta2.Deployment, opts metav1.UpdateOptions) (*appsv1beta2.Deployment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "Deployment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DeploymentImpl) UpdateStatus(ctx context.Context, in *appsv1beta2.Deployment, opts metav1.UpdateOptions) (*appsv1beta2.Deployment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "Deployment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2DeploymentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAppsV1beta2) ReplicaSets(namespace string) typedappsv1beta2.ReplicaSetInterface { - return &wrapAppsV1beta2ReplicaSetImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "apps", - Version: "v1beta2", - Resource: "replicasets", - }), - - namespace: namespace, - } -} - -type wrapAppsV1beta2ReplicaSetImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedappsv1beta2.ReplicaSetInterface = (*wrapAppsV1beta2ReplicaSetImpl)(nil) - -func (w *wrapAppsV1beta2ReplicaSetImpl) Apply(ctx context.Context, in *v1beta2.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.ReplicaSet, err error) { - in.Kind = ptr.String("ReplicaSet") - - in.APIVersion = ptr.String("apps/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ReplicaSetImpl) ApplyStatus(ctx context.Context, in *v1beta2.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.ReplicaSet, err error) { - in.Kind = ptr.String("ReplicaSet") - - in.APIVersion = ptr.String("apps/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ReplicaSetImpl) Create(ctx context.Context, in *appsv1beta2.ReplicaSet, opts metav1.CreateOptions) (*appsv1beta2.ReplicaSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "ReplicaSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ReplicaSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAppsV1beta2ReplicaSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAppsV1beta2ReplicaSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta2.ReplicaSet, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ReplicaSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1beta2.ReplicaSetList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ReplicaSetList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ReplicaSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1beta2.ReplicaSet, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ReplicaSetImpl) Update(ctx context.Context, in *appsv1beta2.ReplicaSet, opts metav1.UpdateOptions) (*appsv1beta2.ReplicaSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "ReplicaSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ReplicaSetImpl) UpdateStatus(ctx context.Context, in *appsv1beta2.ReplicaSet, opts metav1.UpdateOptions) (*appsv1beta2.ReplicaSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "ReplicaSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2ReplicaSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAppsV1beta2) StatefulSets(namespace string) typedappsv1beta2.StatefulSetInterface { - return &wrapAppsV1beta2StatefulSetImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "apps", - Version: "v1beta2", - Resource: "statefulsets", - }), - - namespace: namespace, - } -} - -type wrapAppsV1beta2StatefulSetImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedappsv1beta2.StatefulSetInterface = (*wrapAppsV1beta2StatefulSetImpl)(nil) - -func (w *wrapAppsV1beta2StatefulSetImpl) Apply(ctx context.Context, in *v1beta2.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.StatefulSet, err error) { - in.Kind = ptr.String("StatefulSet") - - in.APIVersion = ptr.String("apps/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2StatefulSetImpl) ApplyStatus(ctx context.Context, in *v1beta2.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.StatefulSet, err error) { - in.Kind = ptr.String("StatefulSet") - - in.APIVersion = ptr.String("apps/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2StatefulSetImpl) Create(ctx context.Context, in *appsv1beta2.StatefulSet, opts metav1.CreateOptions) (*appsv1beta2.StatefulSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "StatefulSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2StatefulSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAppsV1beta2StatefulSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAppsV1beta2StatefulSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta2.StatefulSet, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2StatefulSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1beta2.StatefulSetList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.StatefulSetList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2StatefulSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1beta2.StatefulSet, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2StatefulSetImpl) Update(ctx context.Context, in *appsv1beta2.StatefulSet, opts metav1.UpdateOptions) (*appsv1beta2.StatefulSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "StatefulSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2StatefulSetImpl) UpdateStatus(ctx context.Context, in *appsv1beta2.StatefulSet, opts metav1.UpdateOptions) (*appsv1beta2.StatefulSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1beta2", - Kind: "StatefulSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &appsv1beta2.StatefulSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAppsV1beta2StatefulSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapAppsV1beta2StatefulSetImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta2.Scale, error) { - panic("NYI") -} - -func (w *wrapAppsV1beta2StatefulSetImpl) UpdateScale(ctx context.Context, _ string, in *appsv1beta2.Scale, opts metav1.UpdateOptions) (*appsv1beta2.Scale, error) { - panic("NYI") -} - -func (w *wrapAppsV1beta2StatefulSetImpl) ApplyScale(ctx context.Context, name string, in *v1beta2.ScaleApplyConfiguration, opts metav1.ApplyOptions) (*appsv1beta2.Scale, error) { - panic("NYI") -} - -// AuthenticationV1 retrieves the AuthenticationV1Client -func (w *wrapClient) AuthenticationV1() typedauthenticationv1.AuthenticationV1Interface { - return &wrapAuthenticationV1{ - dyn: w.dyn, - } -} - -type wrapAuthenticationV1 struct { - dyn dynamic.Interface -} - -func (w *wrapAuthenticationV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapAuthenticationV1) TokenReviews() typedauthenticationv1.TokenReviewInterface { - return &wrapAuthenticationV1TokenReviewImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "authentication.k8s.io", - Version: "v1", - Resource: "tokenreviews", - }), - } -} - -type wrapAuthenticationV1TokenReviewImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedauthenticationv1.TokenReviewInterface = (*wrapAuthenticationV1TokenReviewImpl)(nil) - -func (w *wrapAuthenticationV1TokenReviewImpl) Create(ctx context.Context, in *authenticationv1.TokenReview, opts metav1.CreateOptions) (*authenticationv1.TokenReview, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "authentication.k8s.io", - Version: "v1", - Kind: "TokenReview", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &authenticationv1.TokenReview{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -// AuthenticationV1beta1 retrieves the AuthenticationV1beta1Client -func (w *wrapClient) AuthenticationV1beta1() typedauthenticationv1beta1.AuthenticationV1beta1Interface { - return &wrapAuthenticationV1beta1{ - dyn: w.dyn, - } -} - -type wrapAuthenticationV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapAuthenticationV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapAuthenticationV1beta1) TokenReviews() typedauthenticationv1beta1.TokenReviewInterface { - return &wrapAuthenticationV1beta1TokenReviewImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "authentication.k8s.io", - Version: "v1beta1", - Resource: "tokenreviews", - }), - } -} - -type wrapAuthenticationV1beta1TokenReviewImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedauthenticationv1beta1.TokenReviewInterface = (*wrapAuthenticationV1beta1TokenReviewImpl)(nil) - -func (w *wrapAuthenticationV1beta1TokenReviewImpl) Create(ctx context.Context, in *authenticationv1beta1.TokenReview, opts metav1.CreateOptions) (*authenticationv1beta1.TokenReview, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "authentication.k8s.io", - Version: "v1beta1", - Kind: "TokenReview", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &authenticationv1beta1.TokenReview{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -// AuthorizationV1 retrieves the AuthorizationV1Client -func (w *wrapClient) AuthorizationV1() typedauthorizationv1.AuthorizationV1Interface { - return &wrapAuthorizationV1{ - dyn: w.dyn, - } -} - -type wrapAuthorizationV1 struct { - dyn dynamic.Interface -} - -func (w *wrapAuthorizationV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapAuthorizationV1) LocalSubjectAccessReviews(namespace string) typedauthorizationv1.LocalSubjectAccessReviewInterface { - return &wrapAuthorizationV1LocalSubjectAccessReviewImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "authorization.k8s.io", - Version: "v1", - Resource: "localsubjectaccessreviews", - }), - - namespace: namespace, - } -} - -type wrapAuthorizationV1LocalSubjectAccessReviewImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedauthorizationv1.LocalSubjectAccessReviewInterface = (*wrapAuthorizationV1LocalSubjectAccessReviewImpl)(nil) - -func (w *wrapAuthorizationV1LocalSubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1.LocalSubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1.LocalSubjectAccessReview, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "authorization.k8s.io", - Version: "v1", - Kind: "LocalSubjectAccessReview", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &authorizationv1.LocalSubjectAccessReview{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAuthorizationV1) SelfSubjectAccessReviews() typedauthorizationv1.SelfSubjectAccessReviewInterface { - return &wrapAuthorizationV1SelfSubjectAccessReviewImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "authorization.k8s.io", - Version: "v1", - Resource: "selfsubjectaccessreviews", - }), - } -} - -type wrapAuthorizationV1SelfSubjectAccessReviewImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedauthorizationv1.SelfSubjectAccessReviewInterface = (*wrapAuthorizationV1SelfSubjectAccessReviewImpl)(nil) - -func (w *wrapAuthorizationV1SelfSubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1.SelfSubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1.SelfSubjectAccessReview, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "authorization.k8s.io", - Version: "v1", - Kind: "SelfSubjectAccessReview", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &authorizationv1.SelfSubjectAccessReview{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAuthorizationV1) SelfSubjectRulesReviews() typedauthorizationv1.SelfSubjectRulesReviewInterface { - return &wrapAuthorizationV1SelfSubjectRulesReviewImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "authorization.k8s.io", - Version: "v1", - Resource: "selfsubjectrulesreviews", - }), - } -} - -type wrapAuthorizationV1SelfSubjectRulesReviewImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedauthorizationv1.SelfSubjectRulesReviewInterface = (*wrapAuthorizationV1SelfSubjectRulesReviewImpl)(nil) - -func (w *wrapAuthorizationV1SelfSubjectRulesReviewImpl) Create(ctx context.Context, in *authorizationv1.SelfSubjectRulesReview, opts metav1.CreateOptions) (*authorizationv1.SelfSubjectRulesReview, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "authorization.k8s.io", - Version: "v1", - Kind: "SelfSubjectRulesReview", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &authorizationv1.SelfSubjectRulesReview{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAuthorizationV1) SubjectAccessReviews() typedauthorizationv1.SubjectAccessReviewInterface { - return &wrapAuthorizationV1SubjectAccessReviewImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "authorization.k8s.io", - Version: "v1", - Resource: "subjectaccessreviews", - }), - } -} - -type wrapAuthorizationV1SubjectAccessReviewImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedauthorizationv1.SubjectAccessReviewInterface = (*wrapAuthorizationV1SubjectAccessReviewImpl)(nil) - -func (w *wrapAuthorizationV1SubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1.SubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1.SubjectAccessReview, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "authorization.k8s.io", - Version: "v1", - Kind: "SubjectAccessReview", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &authorizationv1.SubjectAccessReview{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -// AuthorizationV1beta1 retrieves the AuthorizationV1beta1Client -func (w *wrapClient) AuthorizationV1beta1() typedauthorizationv1beta1.AuthorizationV1beta1Interface { - return &wrapAuthorizationV1beta1{ - dyn: w.dyn, - } -} - -type wrapAuthorizationV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapAuthorizationV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapAuthorizationV1beta1) LocalSubjectAccessReviews(namespace string) typedauthorizationv1beta1.LocalSubjectAccessReviewInterface { - return &wrapAuthorizationV1beta1LocalSubjectAccessReviewImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "authorization.k8s.io", - Version: "v1beta1", - Resource: "localsubjectaccessreviews", - }), - - namespace: namespace, - } -} - -type wrapAuthorizationV1beta1LocalSubjectAccessReviewImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedauthorizationv1beta1.LocalSubjectAccessReviewInterface = (*wrapAuthorizationV1beta1LocalSubjectAccessReviewImpl)(nil) - -func (w *wrapAuthorizationV1beta1LocalSubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1beta1.LocalSubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1beta1.LocalSubjectAccessReview, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "authorization.k8s.io", - Version: "v1beta1", - Kind: "LocalSubjectAccessReview", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &authorizationv1beta1.LocalSubjectAccessReview{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAuthorizationV1beta1) SelfSubjectAccessReviews() typedauthorizationv1beta1.SelfSubjectAccessReviewInterface { - return &wrapAuthorizationV1beta1SelfSubjectAccessReviewImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "authorization.k8s.io", - Version: "v1beta1", - Resource: "selfsubjectaccessreviews", - }), - } -} - -type wrapAuthorizationV1beta1SelfSubjectAccessReviewImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedauthorizationv1beta1.SelfSubjectAccessReviewInterface = (*wrapAuthorizationV1beta1SelfSubjectAccessReviewImpl)(nil) - -func (w *wrapAuthorizationV1beta1SelfSubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1beta1.SelfSubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1beta1.SelfSubjectAccessReview, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "authorization.k8s.io", - Version: "v1beta1", - Kind: "SelfSubjectAccessReview", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &authorizationv1beta1.SelfSubjectAccessReview{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAuthorizationV1beta1) SelfSubjectRulesReviews() typedauthorizationv1beta1.SelfSubjectRulesReviewInterface { - return &wrapAuthorizationV1beta1SelfSubjectRulesReviewImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "authorization.k8s.io", - Version: "v1beta1", - Resource: "selfsubjectrulesreviews", - }), - } -} - -type wrapAuthorizationV1beta1SelfSubjectRulesReviewImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedauthorizationv1beta1.SelfSubjectRulesReviewInterface = (*wrapAuthorizationV1beta1SelfSubjectRulesReviewImpl)(nil) - -func (w *wrapAuthorizationV1beta1SelfSubjectRulesReviewImpl) Create(ctx context.Context, in *authorizationv1beta1.SelfSubjectRulesReview, opts metav1.CreateOptions) (*authorizationv1beta1.SelfSubjectRulesReview, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "authorization.k8s.io", - Version: "v1beta1", - Kind: "SelfSubjectRulesReview", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &authorizationv1beta1.SelfSubjectRulesReview{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAuthorizationV1beta1) SubjectAccessReviews() typedauthorizationv1beta1.SubjectAccessReviewInterface { - return &wrapAuthorizationV1beta1SubjectAccessReviewImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "authorization.k8s.io", - Version: "v1beta1", - Resource: "subjectaccessreviews", - }), - } -} - -type wrapAuthorizationV1beta1SubjectAccessReviewImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedauthorizationv1beta1.SubjectAccessReviewInterface = (*wrapAuthorizationV1beta1SubjectAccessReviewImpl)(nil) - -func (w *wrapAuthorizationV1beta1SubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1beta1.SubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1beta1.SubjectAccessReview, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "authorization.k8s.io", - Version: "v1beta1", - Kind: "SubjectAccessReview", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &authorizationv1beta1.SubjectAccessReview{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -// AutoscalingV1 retrieves the AutoscalingV1Client -func (w *wrapClient) AutoscalingV1() typedautoscalingv1.AutoscalingV1Interface { - return &wrapAutoscalingV1{ - dyn: w.dyn, - } -} - -type wrapAutoscalingV1 struct { - dyn dynamic.Interface -} - -func (w *wrapAutoscalingV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapAutoscalingV1) HorizontalPodAutoscalers(namespace string) typedautoscalingv1.HorizontalPodAutoscalerInterface { - return &wrapAutoscalingV1HorizontalPodAutoscalerImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "autoscaling", - Version: "v1", - Resource: "horizontalpodautoscalers", - }), - - namespace: namespace, - } -} - -type wrapAutoscalingV1HorizontalPodAutoscalerImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedautoscalingv1.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV1HorizontalPodAutoscalerImpl)(nil) - -func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Apply(ctx context.Context, in *applyconfigurationsautoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.HorizontalPodAutoscaler, err error) { - in.Kind = ptr.String("HorizontalPodAutoscaler") - - in.APIVersion = ptr.String("autoscaling/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) ApplyStatus(ctx context.Context, in *applyconfigurationsautoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.HorizontalPodAutoscaler, err error) { - in.Kind = ptr.String("HorizontalPodAutoscaler") - - in.APIVersion = ptr.String("autoscaling/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *autoscalingv1.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*autoscalingv1.HorizontalPodAutoscaler, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "autoscaling", - Version: "v1", - Kind: "HorizontalPodAutoscaler", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.HorizontalPodAutoscaler, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &autoscalingv1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) List(ctx context.Context, opts metav1.ListOptions) (*autoscalingv1.HorizontalPodAutoscalerList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &autoscalingv1.HorizontalPodAutoscalerList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *autoscalingv1.HorizontalPodAutoscaler, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &autoscalingv1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Update(ctx context.Context, in *autoscalingv1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv1.HorizontalPodAutoscaler, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "autoscaling", - Version: "v1", - Kind: "HorizontalPodAutoscaler", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) UpdateStatus(ctx context.Context, in *autoscalingv1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv1.HorizontalPodAutoscaler, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "autoscaling", - Version: "v1", - Kind: "HorizontalPodAutoscaler", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// AutoscalingV2 retrieves the AutoscalingV2Client -func (w *wrapClient) AutoscalingV2() typedautoscalingv2.AutoscalingV2Interface { - return &wrapAutoscalingV2{ - dyn: w.dyn, - } -} - -type wrapAutoscalingV2 struct { - dyn dynamic.Interface -} - -func (w *wrapAutoscalingV2) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapAutoscalingV2) HorizontalPodAutoscalers(namespace string) typedautoscalingv2.HorizontalPodAutoscalerInterface { - return &wrapAutoscalingV2HorizontalPodAutoscalerImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "autoscaling", - Version: "v2", - Resource: "horizontalpodautoscalers", - }), - - namespace: namespace, - } -} - -type wrapAutoscalingV2HorizontalPodAutoscalerImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedautoscalingv2.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV2HorizontalPodAutoscalerImpl)(nil) - -func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) Apply(ctx context.Context, in *v2.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2.HorizontalPodAutoscaler, err error) { - in.Kind = ptr.String("HorizontalPodAutoscaler") - - in.APIVersion = ptr.String("autoscaling/v2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) ApplyStatus(ctx context.Context, in *v2.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2.HorizontalPodAutoscaler, err error) { - in.Kind = ptr.String("HorizontalPodAutoscaler") - - in.APIVersion = ptr.String("autoscaling/v2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *autoscalingv2.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*autoscalingv2.HorizontalPodAutoscaler, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "autoscaling", - Version: "v2", - Kind: "HorizontalPodAutoscaler", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv2.HorizontalPodAutoscaler, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) List(ctx context.Context, opts metav1.ListOptions) (*autoscalingv2.HorizontalPodAutoscalerList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2.HorizontalPodAutoscalerList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *autoscalingv2.HorizontalPodAutoscaler, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) Update(ctx context.Context, in *autoscalingv2.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv2.HorizontalPodAutoscaler, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "autoscaling", - Version: "v2", - Kind: "HorizontalPodAutoscaler", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) UpdateStatus(ctx context.Context, in *autoscalingv2.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv2.HorizontalPodAutoscaler, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "autoscaling", - Version: "v2", - Kind: "HorizontalPodAutoscaler", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// AutoscalingV2beta1 retrieves the AutoscalingV2beta1Client -func (w *wrapClient) AutoscalingV2beta1() typedautoscalingv2beta1.AutoscalingV2beta1Interface { - return &wrapAutoscalingV2beta1{ - dyn: w.dyn, - } -} - -type wrapAutoscalingV2beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapAutoscalingV2beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapAutoscalingV2beta1) HorizontalPodAutoscalers(namespace string) typedautoscalingv2beta1.HorizontalPodAutoscalerInterface { - return &wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "autoscaling", - Version: "v2beta1", - Resource: "horizontalpodautoscalers", - }), - - namespace: namespace, - } -} - -type wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedautoscalingv2beta1.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl)(nil) - -func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Apply(ctx context.Context, in *v2beta1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2beta1.HorizontalPodAutoscaler, err error) { - in.Kind = ptr.String("HorizontalPodAutoscaler") - - in.APIVersion = ptr.String("autoscaling/v2beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) ApplyStatus(ctx context.Context, in *v2beta1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2beta1.HorizontalPodAutoscaler, err error) { - in.Kind = ptr.String("HorizontalPodAutoscaler") - - in.APIVersion = ptr.String("autoscaling/v2beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *autoscalingv2beta1.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "autoscaling", - Version: "v2beta1", - Kind: "HorizontalPodAutoscaler", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) List(ctx context.Context, opts metav1.ListOptions) (*autoscalingv2beta1.HorizontalPodAutoscalerList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta1.HorizontalPodAutoscalerList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *autoscalingv2beta1.HorizontalPodAutoscaler, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Update(ctx context.Context, in *autoscalingv2beta1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "autoscaling", - Version: "v2beta1", - Kind: "HorizontalPodAutoscaler", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) UpdateStatus(ctx context.Context, in *autoscalingv2beta1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "autoscaling", - Version: "v2beta1", - Kind: "HorizontalPodAutoscaler", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta1.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// AutoscalingV2beta2 retrieves the AutoscalingV2beta2Client -func (w *wrapClient) AutoscalingV2beta2() typedautoscalingv2beta2.AutoscalingV2beta2Interface { - return &wrapAutoscalingV2beta2{ - dyn: w.dyn, - } -} - -type wrapAutoscalingV2beta2 struct { - dyn dynamic.Interface -} - -func (w *wrapAutoscalingV2beta2) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapAutoscalingV2beta2) HorizontalPodAutoscalers(namespace string) typedautoscalingv2beta2.HorizontalPodAutoscalerInterface { - return &wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "autoscaling", - Version: "v2beta2", - Resource: "horizontalpodautoscalers", - }), - - namespace: namespace, - } -} - -type wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedautoscalingv2beta2.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl)(nil) - -func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Apply(ctx context.Context, in *v2beta2.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2beta2.HorizontalPodAutoscaler, err error) { - in.Kind = ptr.String("HorizontalPodAutoscaler") - - in.APIVersion = ptr.String("autoscaling/v2beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) ApplyStatus(ctx context.Context, in *v2beta2.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2beta2.HorizontalPodAutoscaler, err error) { - in.Kind = ptr.String("HorizontalPodAutoscaler") - - in.APIVersion = ptr.String("autoscaling/v2beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *autoscalingv2beta2.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "autoscaling", - Version: "v2beta2", - Kind: "HorizontalPodAutoscaler", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) List(ctx context.Context, opts metav1.ListOptions) (*autoscalingv2beta2.HorizontalPodAutoscalerList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta2.HorizontalPodAutoscalerList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *autoscalingv2beta2.HorizontalPodAutoscaler, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Update(ctx context.Context, in *autoscalingv2beta2.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "autoscaling", - Version: "v2beta2", - Kind: "HorizontalPodAutoscaler", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) UpdateStatus(ctx context.Context, in *autoscalingv2beta2.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "autoscaling", - Version: "v2beta2", - Kind: "HorizontalPodAutoscaler", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &autoscalingv2beta2.HorizontalPodAutoscaler{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// BatchV1 retrieves the BatchV1Client -func (w *wrapClient) BatchV1() typedbatchv1.BatchV1Interface { - return &wrapBatchV1{ - dyn: w.dyn, - } -} - -type wrapBatchV1 struct { - dyn dynamic.Interface -} - -func (w *wrapBatchV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapBatchV1) CronJobs(namespace string) typedbatchv1.CronJobInterface { - return &wrapBatchV1CronJobImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "batch", - Version: "v1", - Resource: "cronjobs", - }), - - namespace: namespace, - } -} - -type wrapBatchV1CronJobImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedbatchv1.CronJobInterface = (*wrapBatchV1CronJobImpl)(nil) - -func (w *wrapBatchV1CronJobImpl) Apply(ctx context.Context, in *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1.CronJob, err error) { - in.Kind = ptr.String("CronJob") - - in.APIVersion = ptr.String("batch/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1CronJobImpl) ApplyStatus(ctx context.Context, in *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1.CronJob, err error) { - in.Kind = ptr.String("CronJob") - - in.APIVersion = ptr.String("batch/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1CronJobImpl) Create(ctx context.Context, in *apibatchv1.CronJob, opts metav1.CreateOptions) (*apibatchv1.CronJob, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "batch", - Version: "v1", - Kind: "CronJob", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1CronJobImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapBatchV1CronJobImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapBatchV1CronJobImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apibatchv1.CronJob, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1CronJobImpl) List(ctx context.Context, opts metav1.ListOptions) (*apibatchv1.CronJobList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.CronJobList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1CronJobImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apibatchv1.CronJob, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1CronJobImpl) Update(ctx context.Context, in *apibatchv1.CronJob, opts metav1.UpdateOptions) (*apibatchv1.CronJob, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "batch", - Version: "v1", - Kind: "CronJob", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1CronJobImpl) UpdateStatus(ctx context.Context, in *apibatchv1.CronJob, opts metav1.UpdateOptions) (*apibatchv1.CronJob, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "batch", - Version: "v1", - Kind: "CronJob", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1CronJobImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapBatchV1) Jobs(namespace string) typedbatchv1.JobInterface { - return &wrapBatchV1JobImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "batch", - Version: "v1", - Resource: "jobs", - }), - - namespace: namespace, - } -} - -type wrapBatchV1JobImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedbatchv1.JobInterface = (*wrapBatchV1JobImpl)(nil) - -func (w *wrapBatchV1JobImpl) Apply(ctx context.Context, in *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1.Job, err error) { - in.Kind = ptr.String("Job") - - in.APIVersion = ptr.String("batch/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.Job{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1JobImpl) ApplyStatus(ctx context.Context, in *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1.Job, err error) { - in.Kind = ptr.String("Job") - - in.APIVersion = ptr.String("batch/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.Job{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1JobImpl) Create(ctx context.Context, in *apibatchv1.Job, opts metav1.CreateOptions) (*apibatchv1.Job, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "batch", - Version: "v1", - Kind: "Job", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.Job{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1JobImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapBatchV1JobImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapBatchV1JobImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apibatchv1.Job, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.Job{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1JobImpl) List(ctx context.Context, opts metav1.ListOptions) (*apibatchv1.JobList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.JobList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1JobImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apibatchv1.Job, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.Job{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1JobImpl) Update(ctx context.Context, in *apibatchv1.Job, opts metav1.UpdateOptions) (*apibatchv1.Job, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "batch", - Version: "v1", - Kind: "Job", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.Job{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1JobImpl) UpdateStatus(ctx context.Context, in *apibatchv1.Job, opts metav1.UpdateOptions) (*apibatchv1.Job, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "batch", - Version: "v1", - Kind: "Job", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1.Job{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1JobImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// BatchV1beta1 retrieves the BatchV1beta1Client -func (w *wrapClient) BatchV1beta1() typedbatchv1beta1.BatchV1beta1Interface { - return &wrapBatchV1beta1{ - dyn: w.dyn, - } -} - -type wrapBatchV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapBatchV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapBatchV1beta1) CronJobs(namespace string) typedbatchv1beta1.CronJobInterface { - return &wrapBatchV1beta1CronJobImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "batch", - Version: "v1beta1", - Resource: "cronjobs", - }), - - namespace: namespace, - } -} - -type wrapBatchV1beta1CronJobImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedbatchv1beta1.CronJobInterface = (*wrapBatchV1beta1CronJobImpl)(nil) - -func (w *wrapBatchV1beta1CronJobImpl) Apply(ctx context.Context, in *batchv1beta1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1beta1.CronJob, err error) { - in.Kind = ptr.String("CronJob") - - in.APIVersion = ptr.String("batch/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1beta1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1beta1CronJobImpl) ApplyStatus(ctx context.Context, in *batchv1beta1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1beta1.CronJob, err error) { - in.Kind = ptr.String("CronJob") - - in.APIVersion = ptr.String("batch/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1beta1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1beta1CronJobImpl) Create(ctx context.Context, in *apibatchv1beta1.CronJob, opts metav1.CreateOptions) (*apibatchv1beta1.CronJob, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "batch", - Version: "v1beta1", - Kind: "CronJob", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1beta1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1beta1CronJobImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapBatchV1beta1CronJobImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapBatchV1beta1CronJobImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apibatchv1beta1.CronJob, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apibatchv1beta1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1beta1CronJobImpl) List(ctx context.Context, opts metav1.ListOptions) (*apibatchv1beta1.CronJobList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apibatchv1beta1.CronJobList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1beta1CronJobImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apibatchv1beta1.CronJob, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apibatchv1beta1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1beta1CronJobImpl) Update(ctx context.Context, in *apibatchv1beta1.CronJob, opts metav1.UpdateOptions) (*apibatchv1beta1.CronJob, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "batch", - Version: "v1beta1", - Kind: "CronJob", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1beta1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1beta1CronJobImpl) UpdateStatus(ctx context.Context, in *apibatchv1beta1.CronJob, opts metav1.UpdateOptions) (*apibatchv1beta1.CronJob, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "batch", - Version: "v1beta1", - Kind: "CronJob", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apibatchv1beta1.CronJob{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapBatchV1beta1CronJobImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// CertificatesV1 retrieves the CertificatesV1Client -func (w *wrapClient) CertificatesV1() typedcertificatesv1.CertificatesV1Interface { - return &wrapCertificatesV1{ - dyn: w.dyn, - } -} - -type wrapCertificatesV1 struct { - dyn dynamic.Interface -} - -func (w *wrapCertificatesV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapCertificatesV1) CertificateSigningRequests() typedcertificatesv1.CertificateSigningRequestInterface { - return &wrapCertificatesV1CertificateSigningRequestImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "certificates.k8s.io", - Version: "v1", - Resource: "certificatesigningrequests", - }), - } -} - -type wrapCertificatesV1CertificateSigningRequestImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedcertificatesv1.CertificateSigningRequestInterface = (*wrapCertificatesV1CertificateSigningRequestImpl)(nil) - -func (w *wrapCertificatesV1CertificateSigningRequestImpl) Apply(ctx context.Context, in *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *apicertificatesv1.CertificateSigningRequest, err error) { - in.Kind = ptr.String("CertificateSigningRequest") - - in.APIVersion = ptr.String("certificates.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1CertificateSigningRequestImpl) ApplyStatus(ctx context.Context, in *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *apicertificatesv1.CertificateSigningRequest, err error) { - in.Kind = ptr.String("CertificateSigningRequest") - - in.APIVersion = ptr.String("certificates.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1CertificateSigningRequestImpl) Create(ctx context.Context, in *apicertificatesv1.CertificateSigningRequest, opts metav1.CreateOptions) (*apicertificatesv1.CertificateSigningRequest, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "certificates.k8s.io", - Version: "v1", - Kind: "CertificateSigningRequest", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1CertificateSigningRequestImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapCertificatesV1CertificateSigningRequestImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCertificatesV1CertificateSigningRequestImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicertificatesv1.CertificateSigningRequest, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1CertificateSigningRequestImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicertificatesv1.CertificateSigningRequestList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1.CertificateSigningRequestList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1CertificateSigningRequestImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicertificatesv1.CertificateSigningRequest, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1CertificateSigningRequestImpl) Update(ctx context.Context, in *apicertificatesv1.CertificateSigningRequest, opts metav1.UpdateOptions) (*apicertificatesv1.CertificateSigningRequest, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "certificates.k8s.io", - Version: "v1", - Kind: "CertificateSigningRequest", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1CertificateSigningRequestImpl) UpdateStatus(ctx context.Context, in *apicertificatesv1.CertificateSigningRequest, opts metav1.UpdateOptions) (*apicertificatesv1.CertificateSigningRequest, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "certificates.k8s.io", - Version: "v1", - Kind: "CertificateSigningRequest", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1CertificateSigningRequestImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCertificatesV1CertificateSigningRequestImpl) UpdateApproval(ctx context.Context, _ string, in *apicertificatesv1.CertificateSigningRequest, opts metav1.UpdateOptions) (*apicertificatesv1.CertificateSigningRequest, error) { - panic("NYI") -} - -// CertificatesV1beta1 retrieves the CertificatesV1beta1Client -func (w *wrapClient) CertificatesV1beta1() typedcertificatesv1beta1.CertificatesV1beta1Interface { - return &wrapCertificatesV1beta1{ - dyn: w.dyn, - } -} - -type wrapCertificatesV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapCertificatesV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapCertificatesV1beta1) CertificateSigningRequests() typedcertificatesv1beta1.CertificateSigningRequestInterface { - return &wrapCertificatesV1beta1CertificateSigningRequestImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "certificates.k8s.io", - Version: "v1beta1", - Resource: "certificatesigningrequests", - }), - } -} - -type wrapCertificatesV1beta1CertificateSigningRequestImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedcertificatesv1beta1.CertificateSigningRequestInterface = (*wrapCertificatesV1beta1CertificateSigningRequestImpl)(nil) - -func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Apply(ctx context.Context, in *certificatesv1beta1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *apicertificatesv1beta1.CertificateSigningRequest, err error) { - in.Kind = ptr.String("CertificateSigningRequest") - - in.APIVersion = ptr.String("certificates.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1beta1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) ApplyStatus(ctx context.Context, in *certificatesv1beta1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *apicertificatesv1beta1.CertificateSigningRequest, err error) { - in.Kind = ptr.String("CertificateSigningRequest") - - in.APIVersion = ptr.String("certificates.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1beta1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Create(ctx context.Context, in *apicertificatesv1beta1.CertificateSigningRequest, opts metav1.CreateOptions) (*apicertificatesv1beta1.CertificateSigningRequest, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "certificates.k8s.io", - Version: "v1beta1", - Kind: "CertificateSigningRequest", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1beta1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicertificatesv1beta1.CertificateSigningRequest, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1beta1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicertificatesv1beta1.CertificateSigningRequestList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1beta1.CertificateSigningRequestList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicertificatesv1beta1.CertificateSigningRequest, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1beta1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Update(ctx context.Context, in *apicertificatesv1beta1.CertificateSigningRequest, opts metav1.UpdateOptions) (*apicertificatesv1beta1.CertificateSigningRequest, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "certificates.k8s.io", - Version: "v1beta1", - Kind: "CertificateSigningRequest", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1beta1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) UpdateStatus(ctx context.Context, in *apicertificatesv1beta1.CertificateSigningRequest, opts metav1.UpdateOptions) (*apicertificatesv1beta1.CertificateSigningRequest, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "certificates.k8s.io", - Version: "v1beta1", - Kind: "CertificateSigningRequest", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicertificatesv1beta1.CertificateSigningRequest{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// CoordinationV1 retrieves the CoordinationV1Client -func (w *wrapClient) CoordinationV1() typedcoordinationv1.CoordinationV1Interface { - return &wrapCoordinationV1{ - dyn: w.dyn, - } -} - -type wrapCoordinationV1 struct { - dyn dynamic.Interface -} - -func (w *wrapCoordinationV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapCoordinationV1) Leases(namespace string) typedcoordinationv1.LeaseInterface { - return &wrapCoordinationV1LeaseImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "coordination.k8s.io", - Version: "v1", - Resource: "leases", - }), - - namespace: namespace, - } -} - -type wrapCoordinationV1LeaseImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcoordinationv1.LeaseInterface = (*wrapCoordinationV1LeaseImpl)(nil) - -func (w *wrapCoordinationV1LeaseImpl) Apply(ctx context.Context, in *coordinationv1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *apicoordinationv1.Lease, err error) { - in.Kind = ptr.String("Lease") - - in.APIVersion = ptr.String("coordination.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1LeaseImpl) ApplyStatus(ctx context.Context, in *coordinationv1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *apicoordinationv1.Lease, err error) { - in.Kind = ptr.String("Lease") - - in.APIVersion = ptr.String("coordination.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1LeaseImpl) Create(ctx context.Context, in *apicoordinationv1.Lease, opts metav1.CreateOptions) (*apicoordinationv1.Lease, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "coordination.k8s.io", - Version: "v1", - Kind: "Lease", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1LeaseImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoordinationV1LeaseImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoordinationV1LeaseImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicoordinationv1.Lease, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1LeaseImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicoordinationv1.LeaseList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1.LeaseList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1LeaseImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicoordinationv1.Lease, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1LeaseImpl) Update(ctx context.Context, in *apicoordinationv1.Lease, opts metav1.UpdateOptions) (*apicoordinationv1.Lease, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "coordination.k8s.io", - Version: "v1", - Kind: "Lease", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1LeaseImpl) UpdateStatus(ctx context.Context, in *apicoordinationv1.Lease, opts metav1.UpdateOptions) (*apicoordinationv1.Lease, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "coordination.k8s.io", - Version: "v1", - Kind: "Lease", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1LeaseImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// CoordinationV1beta1 retrieves the CoordinationV1beta1Client -func (w *wrapClient) CoordinationV1beta1() typedcoordinationv1beta1.CoordinationV1beta1Interface { - return &wrapCoordinationV1beta1{ - dyn: w.dyn, - } -} - -type wrapCoordinationV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapCoordinationV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapCoordinationV1beta1) Leases(namespace string) typedcoordinationv1beta1.LeaseInterface { - return &wrapCoordinationV1beta1LeaseImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "coordination.k8s.io", - Version: "v1beta1", - Resource: "leases", - }), - - namespace: namespace, - } -} - -type wrapCoordinationV1beta1LeaseImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcoordinationv1beta1.LeaseInterface = (*wrapCoordinationV1beta1LeaseImpl)(nil) - -func (w *wrapCoordinationV1beta1LeaseImpl) Apply(ctx context.Context, in *coordinationv1beta1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *apicoordinationv1beta1.Lease, err error) { - in.Kind = ptr.String("Lease") - - in.APIVersion = ptr.String("coordination.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1beta1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1beta1LeaseImpl) ApplyStatus(ctx context.Context, in *coordinationv1beta1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *apicoordinationv1beta1.Lease, err error) { - in.Kind = ptr.String("Lease") - - in.APIVersion = ptr.String("coordination.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1beta1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1beta1LeaseImpl) Create(ctx context.Context, in *apicoordinationv1beta1.Lease, opts metav1.CreateOptions) (*apicoordinationv1beta1.Lease, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "coordination.k8s.io", - Version: "v1beta1", - Kind: "Lease", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1beta1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1beta1LeaseImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoordinationV1beta1LeaseImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoordinationV1beta1LeaseImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicoordinationv1beta1.Lease, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1beta1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1beta1LeaseImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicoordinationv1beta1.LeaseList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1beta1.LeaseList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1beta1LeaseImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicoordinationv1beta1.Lease, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1beta1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1beta1LeaseImpl) Update(ctx context.Context, in *apicoordinationv1beta1.Lease, opts metav1.UpdateOptions) (*apicoordinationv1beta1.Lease, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "coordination.k8s.io", - Version: "v1beta1", - Kind: "Lease", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1beta1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1beta1LeaseImpl) UpdateStatus(ctx context.Context, in *apicoordinationv1beta1.Lease, opts metav1.UpdateOptions) (*apicoordinationv1beta1.Lease, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "coordination.k8s.io", - Version: "v1beta1", - Kind: "Lease", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicoordinationv1beta1.Lease{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoordinationV1beta1LeaseImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// CoreV1 retrieves the CoreV1Client -func (w *wrapClient) CoreV1() typedcorev1.CoreV1Interface { - return &wrapCoreV1{ - dyn: w.dyn, - } -} - -type wrapCoreV1 struct { - dyn dynamic.Interface -} - -func (w *wrapCoreV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapCoreV1) ComponentStatuses() typedcorev1.ComponentStatusInterface { - return &wrapCoreV1ComponentStatusImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "componentstatuses", - }), - } -} - -type wrapCoreV1ComponentStatusImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedcorev1.ComponentStatusInterface = (*wrapCoreV1ComponentStatusImpl)(nil) - -func (w *wrapCoreV1ComponentStatusImpl) Apply(ctx context.Context, in *corev1.ComponentStatusApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ComponentStatus, err error) { - in.Kind = ptr.String("ComponentStatus") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ComponentStatus{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ComponentStatusImpl) ApplyStatus(ctx context.Context, in *corev1.ComponentStatusApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ComponentStatus, err error) { - in.Kind = ptr.String("ComponentStatus") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ComponentStatus{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ComponentStatusImpl) Create(ctx context.Context, in *apicorev1.ComponentStatus, opts metav1.CreateOptions) (*apicorev1.ComponentStatus, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ComponentStatus", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ComponentStatus{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ComponentStatusImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapCoreV1ComponentStatusImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1ComponentStatusImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.ComponentStatus, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ComponentStatus{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ComponentStatusImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.ComponentStatusList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ComponentStatusList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ComponentStatusImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.ComponentStatus, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ComponentStatus{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ComponentStatusImpl) Update(ctx context.Context, in *apicorev1.ComponentStatus, opts metav1.UpdateOptions) (*apicorev1.ComponentStatus, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ComponentStatus", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ComponentStatus{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ComponentStatusImpl) UpdateStatus(ctx context.Context, in *apicorev1.ComponentStatus, opts metav1.UpdateOptions) (*apicorev1.ComponentStatus, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ComponentStatus", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ComponentStatus{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ComponentStatusImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1) ConfigMaps(namespace string) typedcorev1.ConfigMapInterface { - return &wrapCoreV1ConfigMapImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "configmaps", - }), - - namespace: namespace, - } -} - -type wrapCoreV1ConfigMapImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcorev1.ConfigMapInterface = (*wrapCoreV1ConfigMapImpl)(nil) - -func (w *wrapCoreV1ConfigMapImpl) Apply(ctx context.Context, in *corev1.ConfigMapApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ConfigMap, err error) { - in.Kind = ptr.String("ConfigMap") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ConfigMap{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ConfigMapImpl) ApplyStatus(ctx context.Context, in *corev1.ConfigMapApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ConfigMap, err error) { - in.Kind = ptr.String("ConfigMap") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ConfigMap{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ConfigMapImpl) Create(ctx context.Context, in *apicorev1.ConfigMap, opts metav1.CreateOptions) (*apicorev1.ConfigMap, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ConfigMap", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ConfigMap{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ConfigMapImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoreV1ConfigMapImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1ConfigMapImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.ConfigMap, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ConfigMap{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ConfigMapImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.ConfigMapList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ConfigMapList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ConfigMapImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.ConfigMap, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ConfigMap{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ConfigMapImpl) Update(ctx context.Context, in *apicorev1.ConfigMap, opts metav1.UpdateOptions) (*apicorev1.ConfigMap, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ConfigMap", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ConfigMap{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ConfigMapImpl) UpdateStatus(ctx context.Context, in *apicorev1.ConfigMap, opts metav1.UpdateOptions) (*apicorev1.ConfigMap, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ConfigMap", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ConfigMap{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ConfigMapImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1) Endpoints(namespace string) typedcorev1.EndpointsInterface { - return &wrapCoreV1EndpointsImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "endpoints", - }), - - namespace: namespace, - } -} - -type wrapCoreV1EndpointsImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcorev1.EndpointsInterface = (*wrapCoreV1EndpointsImpl)(nil) - -func (w *wrapCoreV1EndpointsImpl) Apply(ctx context.Context, in *corev1.EndpointsApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Endpoints, err error) { - in.Kind = ptr.String("Endpoints") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Endpoints{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EndpointsImpl) ApplyStatus(ctx context.Context, in *corev1.EndpointsApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Endpoints, err error) { - in.Kind = ptr.String("Endpoints") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Endpoints{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EndpointsImpl) Create(ctx context.Context, in *apicorev1.Endpoints, opts metav1.CreateOptions) (*apicorev1.Endpoints, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Endpoints", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Endpoints{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EndpointsImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoreV1EndpointsImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1EndpointsImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Endpoints, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Endpoints{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EndpointsImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.EndpointsList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.EndpointsList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EndpointsImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Endpoints, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Endpoints{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EndpointsImpl) Update(ctx context.Context, in *apicorev1.Endpoints, opts metav1.UpdateOptions) (*apicorev1.Endpoints, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Endpoints", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Endpoints{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EndpointsImpl) UpdateStatus(ctx context.Context, in *apicorev1.Endpoints, opts metav1.UpdateOptions) (*apicorev1.Endpoints, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Endpoints", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Endpoints{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EndpointsImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1) Events(namespace string) typedcorev1.EventInterface { - return &wrapCoreV1EventImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "events", - }), - - namespace: namespace, - } -} - -type wrapCoreV1EventImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcorev1.EventInterface = (*wrapCoreV1EventImpl)(nil) - -func (w *wrapCoreV1EventImpl) Apply(ctx context.Context, in *corev1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Event, err error) { - in.Kind = ptr.String("Event") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EventImpl) ApplyStatus(ctx context.Context, in *corev1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Event, err error) { - in.Kind = ptr.String("Event") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EventImpl) Create(ctx context.Context, in *apicorev1.Event, opts metav1.CreateOptions) (*apicorev1.Event, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Event", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EventImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoreV1EventImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1EventImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Event, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EventImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.EventList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.EventList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EventImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Event, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EventImpl) Update(ctx context.Context, in *apicorev1.Event, opts metav1.UpdateOptions) (*apicorev1.Event, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Event", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EventImpl) UpdateStatus(ctx context.Context, in *apicorev1.Event, opts metav1.UpdateOptions) (*apicorev1.Event, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Event", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1EventImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1) LimitRanges(namespace string) typedcorev1.LimitRangeInterface { - return &wrapCoreV1LimitRangeImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "limitranges", - }), - - namespace: namespace, - } -} - -type wrapCoreV1LimitRangeImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcorev1.LimitRangeInterface = (*wrapCoreV1LimitRangeImpl)(nil) - -func (w *wrapCoreV1LimitRangeImpl) Apply(ctx context.Context, in *corev1.LimitRangeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.LimitRange, err error) { - in.Kind = ptr.String("LimitRange") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.LimitRange{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1LimitRangeImpl) ApplyStatus(ctx context.Context, in *corev1.LimitRangeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.LimitRange, err error) { - in.Kind = ptr.String("LimitRange") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.LimitRange{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1LimitRangeImpl) Create(ctx context.Context, in *apicorev1.LimitRange, opts metav1.CreateOptions) (*apicorev1.LimitRange, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "LimitRange", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.LimitRange{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1LimitRangeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoreV1LimitRangeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1LimitRangeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.LimitRange, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.LimitRange{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1LimitRangeImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.LimitRangeList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.LimitRangeList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1LimitRangeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.LimitRange, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.LimitRange{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1LimitRangeImpl) Update(ctx context.Context, in *apicorev1.LimitRange, opts metav1.UpdateOptions) (*apicorev1.LimitRange, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "LimitRange", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.LimitRange{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1LimitRangeImpl) UpdateStatus(ctx context.Context, in *apicorev1.LimitRange, opts metav1.UpdateOptions) (*apicorev1.LimitRange, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "LimitRange", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.LimitRange{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1LimitRangeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1) Namespaces() typedcorev1.NamespaceInterface { - return &wrapCoreV1NamespaceImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "namespaces", - }), - } -} - -type wrapCoreV1NamespaceImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedcorev1.NamespaceInterface = (*wrapCoreV1NamespaceImpl)(nil) - -func (w *wrapCoreV1NamespaceImpl) Apply(ctx context.Context, in *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Namespace, err error) { - in.Kind = ptr.String("Namespace") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Namespace{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NamespaceImpl) ApplyStatus(ctx context.Context, in *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Namespace, err error) { - in.Kind = ptr.String("Namespace") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Namespace{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NamespaceImpl) Create(ctx context.Context, in *apicorev1.Namespace, opts metav1.CreateOptions) (*apicorev1.Namespace, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Namespace", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Namespace{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NamespaceImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapCoreV1NamespaceImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Namespace, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Namespace{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NamespaceImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.NamespaceList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.NamespaceList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NamespaceImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Namespace, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Namespace{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NamespaceImpl) Update(ctx context.Context, in *apicorev1.Namespace, opts metav1.UpdateOptions) (*apicorev1.Namespace, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Namespace", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Namespace{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NamespaceImpl) UpdateStatus(ctx context.Context, in *apicorev1.Namespace, opts metav1.UpdateOptions) (*apicorev1.Namespace, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Namespace", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Namespace{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NamespaceImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1) Nodes() typedcorev1.NodeInterface { - return &wrapCoreV1NodeImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "nodes", - }), - } -} - -type wrapCoreV1NodeImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedcorev1.NodeInterface = (*wrapCoreV1NodeImpl)(nil) - -func (w *wrapCoreV1NodeImpl) Apply(ctx context.Context, in *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Node, err error) { - in.Kind = ptr.String("Node") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Node{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NodeImpl) ApplyStatus(ctx context.Context, in *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Node, err error) { - in.Kind = ptr.String("Node") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Node{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NodeImpl) Create(ctx context.Context, in *apicorev1.Node, opts metav1.CreateOptions) (*apicorev1.Node, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Node", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Node{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NodeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapCoreV1NodeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1NodeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Node, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Node{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NodeImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.NodeList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.NodeList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NodeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Node, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Node{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NodeImpl) Update(ctx context.Context, in *apicorev1.Node, opts metav1.UpdateOptions) (*apicorev1.Node, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Node", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Node{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NodeImpl) UpdateStatus(ctx context.Context, in *apicorev1.Node, opts metav1.UpdateOptions) (*apicorev1.Node, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Node", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Node{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1NodeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1) PersistentVolumes() typedcorev1.PersistentVolumeInterface { - return &wrapCoreV1PersistentVolumeImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "persistentvolumes", - }), - } -} - -type wrapCoreV1PersistentVolumeImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedcorev1.PersistentVolumeInterface = (*wrapCoreV1PersistentVolumeImpl)(nil) - -func (w *wrapCoreV1PersistentVolumeImpl) Apply(ctx context.Context, in *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PersistentVolume, err error) { - in.Kind = ptr.String("PersistentVolume") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolume{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeImpl) ApplyStatus(ctx context.Context, in *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PersistentVolume, err error) { - in.Kind = ptr.String("PersistentVolume") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolume{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeImpl) Create(ctx context.Context, in *apicorev1.PersistentVolume, opts metav1.CreateOptions) (*apicorev1.PersistentVolume, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "PersistentVolume", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolume{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapCoreV1PersistentVolumeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1PersistentVolumeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.PersistentVolume, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolume{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.PersistentVolumeList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolumeList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.PersistentVolume, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolume{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeImpl) Update(ctx context.Context, in *apicorev1.PersistentVolume, opts metav1.UpdateOptions) (*apicorev1.PersistentVolume, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "PersistentVolume", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolume{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeImpl) UpdateStatus(ctx context.Context, in *apicorev1.PersistentVolume, opts metav1.UpdateOptions) (*apicorev1.PersistentVolume, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "PersistentVolume", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolume{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1) PersistentVolumeClaims(namespace string) typedcorev1.PersistentVolumeClaimInterface { - return &wrapCoreV1PersistentVolumeClaimImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "persistentvolumeclaims", - }), - - namespace: namespace, - } -} - -type wrapCoreV1PersistentVolumeClaimImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcorev1.PersistentVolumeClaimInterface = (*wrapCoreV1PersistentVolumeClaimImpl)(nil) - -func (w *wrapCoreV1PersistentVolumeClaimImpl) Apply(ctx context.Context, in *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PersistentVolumeClaim, err error) { - in.Kind = ptr.String("PersistentVolumeClaim") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolumeClaim{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeClaimImpl) ApplyStatus(ctx context.Context, in *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PersistentVolumeClaim, err error) { - in.Kind = ptr.String("PersistentVolumeClaim") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolumeClaim{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeClaimImpl) Create(ctx context.Context, in *apicorev1.PersistentVolumeClaim, opts metav1.CreateOptions) (*apicorev1.PersistentVolumeClaim, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "PersistentVolumeClaim", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolumeClaim{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeClaimImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoreV1PersistentVolumeClaimImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1PersistentVolumeClaimImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.PersistentVolumeClaim, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolumeClaim{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeClaimImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.PersistentVolumeClaimList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolumeClaimList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeClaimImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.PersistentVolumeClaim, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolumeClaim{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeClaimImpl) Update(ctx context.Context, in *apicorev1.PersistentVolumeClaim, opts metav1.UpdateOptions) (*apicorev1.PersistentVolumeClaim, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "PersistentVolumeClaim", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolumeClaim{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeClaimImpl) UpdateStatus(ctx context.Context, in *apicorev1.PersistentVolumeClaim, opts metav1.UpdateOptions) (*apicorev1.PersistentVolumeClaim, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "PersistentVolumeClaim", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PersistentVolumeClaim{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PersistentVolumeClaimImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1) Pods(namespace string) typedcorev1.PodInterface { - return &wrapCoreV1PodImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "pods", - }), - - namespace: namespace, - } -} - -type wrapCoreV1PodImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcorev1.PodInterface = (*wrapCoreV1PodImpl)(nil) - -func (w *wrapCoreV1PodImpl) Apply(ctx context.Context, in *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Pod, err error) { - in.Kind = ptr.String("Pod") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Pod{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodImpl) ApplyStatus(ctx context.Context, in *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Pod, err error) { - in.Kind = ptr.String("Pod") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Pod{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodImpl) Create(ctx context.Context, in *apicorev1.Pod, opts metav1.CreateOptions) (*apicorev1.Pod, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Pod", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Pod{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoreV1PodImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1PodImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Pod, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Pod{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.PodList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PodList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Pod, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Pod{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodImpl) Update(ctx context.Context, in *apicorev1.Pod, opts metav1.UpdateOptions) (*apicorev1.Pod, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Pod", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Pod{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodImpl) UpdateStatus(ctx context.Context, in *apicorev1.Pod, opts metav1.UpdateOptions) (*apicorev1.Pod, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Pod", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Pod{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1PodImpl) UpdateEphemeralContainers(ctx context.Context, _ string, in *apicorev1.Pod, opts metav1.UpdateOptions) (*apicorev1.Pod, error) { - panic("NYI") -} - -func (w *wrapCoreV1) PodTemplates(namespace string) typedcorev1.PodTemplateInterface { - return &wrapCoreV1PodTemplateImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "podtemplates", - }), - - namespace: namespace, - } -} - -type wrapCoreV1PodTemplateImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcorev1.PodTemplateInterface = (*wrapCoreV1PodTemplateImpl)(nil) - -func (w *wrapCoreV1PodTemplateImpl) Apply(ctx context.Context, in *corev1.PodTemplateApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PodTemplate, err error) { - in.Kind = ptr.String("PodTemplate") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PodTemplate{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodTemplateImpl) ApplyStatus(ctx context.Context, in *corev1.PodTemplateApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PodTemplate, err error) { - in.Kind = ptr.String("PodTemplate") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PodTemplate{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodTemplateImpl) Create(ctx context.Context, in *apicorev1.PodTemplate, opts metav1.CreateOptions) (*apicorev1.PodTemplate, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "PodTemplate", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PodTemplate{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodTemplateImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoreV1PodTemplateImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1PodTemplateImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.PodTemplate, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PodTemplate{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodTemplateImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.PodTemplateList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PodTemplateList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodTemplateImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.PodTemplate, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PodTemplate{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodTemplateImpl) Update(ctx context.Context, in *apicorev1.PodTemplate, opts metav1.UpdateOptions) (*apicorev1.PodTemplate, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "PodTemplate", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PodTemplate{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodTemplateImpl) UpdateStatus(ctx context.Context, in *apicorev1.PodTemplate, opts metav1.UpdateOptions) (*apicorev1.PodTemplate, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "PodTemplate", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.PodTemplate{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1PodTemplateImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1) ReplicationControllers(namespace string) typedcorev1.ReplicationControllerInterface { - return &wrapCoreV1ReplicationControllerImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "replicationcontrollers", - }), - - namespace: namespace, - } -} - -type wrapCoreV1ReplicationControllerImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcorev1.ReplicationControllerInterface = (*wrapCoreV1ReplicationControllerImpl)(nil) - -func (w *wrapCoreV1ReplicationControllerImpl) Apply(ctx context.Context, in *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ReplicationController, err error) { - in.Kind = ptr.String("ReplicationController") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ReplicationController{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ReplicationControllerImpl) ApplyStatus(ctx context.Context, in *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ReplicationController, err error) { - in.Kind = ptr.String("ReplicationController") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ReplicationController{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ReplicationControllerImpl) Create(ctx context.Context, in *apicorev1.ReplicationController, opts metav1.CreateOptions) (*apicorev1.ReplicationController, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ReplicationController", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ReplicationController{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ReplicationControllerImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoreV1ReplicationControllerImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1ReplicationControllerImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.ReplicationController, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ReplicationController{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ReplicationControllerImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.ReplicationControllerList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ReplicationControllerList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ReplicationControllerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.ReplicationController, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ReplicationController{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ReplicationControllerImpl) Update(ctx context.Context, in *apicorev1.ReplicationController, opts metav1.UpdateOptions) (*apicorev1.ReplicationController, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ReplicationController", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ReplicationController{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ReplicationControllerImpl) UpdateStatus(ctx context.Context, in *apicorev1.ReplicationController, opts metav1.UpdateOptions) (*apicorev1.ReplicationController, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ReplicationController", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ReplicationController{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ReplicationControllerImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1ReplicationControllerImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.Scale, error) { - panic("NYI") -} - -func (w *wrapCoreV1ReplicationControllerImpl) UpdateScale(ctx context.Context, _ string, in *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) { - panic("NYI") -} - -func (w *wrapCoreV1) ResourceQuotas(namespace string) typedcorev1.ResourceQuotaInterface { - return &wrapCoreV1ResourceQuotaImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "resourcequotas", - }), - - namespace: namespace, - } -} - -type wrapCoreV1ResourceQuotaImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcorev1.ResourceQuotaInterface = (*wrapCoreV1ResourceQuotaImpl)(nil) - -func (w *wrapCoreV1ResourceQuotaImpl) Apply(ctx context.Context, in *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ResourceQuota, err error) { - in.Kind = ptr.String("ResourceQuota") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ResourceQuota{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ResourceQuotaImpl) ApplyStatus(ctx context.Context, in *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ResourceQuota, err error) { - in.Kind = ptr.String("ResourceQuota") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ResourceQuota{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ResourceQuotaImpl) Create(ctx context.Context, in *apicorev1.ResourceQuota, opts metav1.CreateOptions) (*apicorev1.ResourceQuota, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ResourceQuota", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ResourceQuota{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ResourceQuotaImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoreV1ResourceQuotaImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1ResourceQuotaImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.ResourceQuota, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ResourceQuota{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ResourceQuotaImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.ResourceQuotaList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ResourceQuotaList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ResourceQuotaImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.ResourceQuota, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ResourceQuota{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ResourceQuotaImpl) Update(ctx context.Context, in *apicorev1.ResourceQuota, opts metav1.UpdateOptions) (*apicorev1.ResourceQuota, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ResourceQuota", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ResourceQuota{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ResourceQuotaImpl) UpdateStatus(ctx context.Context, in *apicorev1.ResourceQuota, opts metav1.UpdateOptions) (*apicorev1.ResourceQuota, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ResourceQuota", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ResourceQuota{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ResourceQuotaImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1) Secrets(namespace string) typedcorev1.SecretInterface { - return &wrapCoreV1SecretImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "secrets", - }), - - namespace: namespace, - } -} - -type wrapCoreV1SecretImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcorev1.SecretInterface = (*wrapCoreV1SecretImpl)(nil) - -func (w *wrapCoreV1SecretImpl) Apply(ctx context.Context, in *corev1.SecretApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Secret, err error) { - in.Kind = ptr.String("Secret") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Secret{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1SecretImpl) ApplyStatus(ctx context.Context, in *corev1.SecretApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Secret, err error) { - in.Kind = ptr.String("Secret") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Secret{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1SecretImpl) Create(ctx context.Context, in *apicorev1.Secret, opts metav1.CreateOptions) (*apicorev1.Secret, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Secret", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Secret{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1SecretImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoreV1SecretImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1SecretImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Secret, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Secret{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1SecretImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.SecretList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.SecretList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1SecretImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Secret, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Secret{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1SecretImpl) Update(ctx context.Context, in *apicorev1.Secret, opts metav1.UpdateOptions) (*apicorev1.Secret, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Secret", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Secret{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1SecretImpl) UpdateStatus(ctx context.Context, in *apicorev1.Secret, opts metav1.UpdateOptions) (*apicorev1.Secret, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Secret", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Secret{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1SecretImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1) Services(namespace string) typedcorev1.ServiceInterface { - return &wrapCoreV1ServiceImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "services", - }), - - namespace: namespace, - } -} - -type wrapCoreV1ServiceImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcorev1.ServiceInterface = (*wrapCoreV1ServiceImpl)(nil) - -func (w *wrapCoreV1ServiceImpl) Apply(ctx context.Context, in *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Service, err error) { - in.Kind = ptr.String("Service") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Service{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceImpl) ApplyStatus(ctx context.Context, in *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Service, err error) { - in.Kind = ptr.String("Service") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Service{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceImpl) Create(ctx context.Context, in *apicorev1.Service, opts metav1.CreateOptions) (*apicorev1.Service, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Service", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Service{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoreV1ServiceImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Service, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Service{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.ServiceList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ServiceList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Service, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Service{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceImpl) Update(ctx context.Context, in *apicorev1.Service, opts metav1.UpdateOptions) (*apicorev1.Service, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Service", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Service{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceImpl) UpdateStatus(ctx context.Context, in *apicorev1.Service, opts metav1.UpdateOptions) (*apicorev1.Service, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "Service", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.Service{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1) ServiceAccounts(namespace string) typedcorev1.ServiceAccountInterface { - return &wrapCoreV1ServiceAccountImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "", - Version: "v1", - Resource: "serviceaccounts", - }), - - namespace: namespace, - } -} - -type wrapCoreV1ServiceAccountImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedcorev1.ServiceAccountInterface = (*wrapCoreV1ServiceAccountImpl)(nil) - -func (w *wrapCoreV1ServiceAccountImpl) Apply(ctx context.Context, in *corev1.ServiceAccountApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ServiceAccount, err error) { - in.Kind = ptr.String("ServiceAccount") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ServiceAccount{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceAccountImpl) ApplyStatus(ctx context.Context, in *corev1.ServiceAccountApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ServiceAccount, err error) { - in.Kind = ptr.String("ServiceAccount") - - in.APIVersion = ptr.String("v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ServiceAccount{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceAccountImpl) Create(ctx context.Context, in *apicorev1.ServiceAccount, opts metav1.CreateOptions) (*apicorev1.ServiceAccount, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ServiceAccount", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ServiceAccount{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceAccountImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapCoreV1ServiceAccountImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapCoreV1ServiceAccountImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.ServiceAccount, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ServiceAccount{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceAccountImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.ServiceAccountList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ServiceAccountList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceAccountImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.ServiceAccount, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ServiceAccount{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceAccountImpl) Update(ctx context.Context, in *apicorev1.ServiceAccount, opts metav1.UpdateOptions) (*apicorev1.ServiceAccount, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ServiceAccount", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ServiceAccount{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceAccountImpl) UpdateStatus(ctx context.Context, in *apicorev1.ServiceAccount, opts metav1.UpdateOptions) (*apicorev1.ServiceAccount, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "", - Version: "v1", - Kind: "ServiceAccount", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apicorev1.ServiceAccount{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapCoreV1ServiceAccountImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapCoreV1ServiceAccountImpl) CreateToken(ctx context.Context, _ string, in *authenticationv1.TokenRequest, opts metav1.CreateOptions) (*authenticationv1.TokenRequest, error) { - panic("NYI") -} - -// DiscoveryV1 retrieves the DiscoveryV1Client -func (w *wrapClient) DiscoveryV1() typeddiscoveryv1.DiscoveryV1Interface { - return &wrapDiscoveryV1{ - dyn: w.dyn, - } -} - -type wrapDiscoveryV1 struct { - dyn dynamic.Interface -} - -func (w *wrapDiscoveryV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapDiscoveryV1) EndpointSlices(namespace string) typeddiscoveryv1.EndpointSliceInterface { - return &wrapDiscoveryV1EndpointSliceImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "discovery.k8s.io", - Version: "v1", - Resource: "endpointslices", - }), - - namespace: namespace, - } -} - -type wrapDiscoveryV1EndpointSliceImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typeddiscoveryv1.EndpointSliceInterface = (*wrapDiscoveryV1EndpointSliceImpl)(nil) - -func (w *wrapDiscoveryV1EndpointSliceImpl) Apply(ctx context.Context, in *discoveryv1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *apidiscoveryv1.EndpointSlice, err error) { - in.Kind = ptr.String("EndpointSlice") - - in.APIVersion = ptr.String("discovery.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1EndpointSliceImpl) ApplyStatus(ctx context.Context, in *discoveryv1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *apidiscoveryv1.EndpointSlice, err error) { - in.Kind = ptr.String("EndpointSlice") - - in.APIVersion = ptr.String("discovery.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1EndpointSliceImpl) Create(ctx context.Context, in *apidiscoveryv1.EndpointSlice, opts metav1.CreateOptions) (*apidiscoveryv1.EndpointSlice, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "discovery.k8s.io", - Version: "v1", - Kind: "EndpointSlice", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1EndpointSliceImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapDiscoveryV1EndpointSliceImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapDiscoveryV1EndpointSliceImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apidiscoveryv1.EndpointSlice, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1EndpointSliceImpl) List(ctx context.Context, opts metav1.ListOptions) (*apidiscoveryv1.EndpointSliceList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1.EndpointSliceList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1EndpointSliceImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apidiscoveryv1.EndpointSlice, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1EndpointSliceImpl) Update(ctx context.Context, in *apidiscoveryv1.EndpointSlice, opts metav1.UpdateOptions) (*apidiscoveryv1.EndpointSlice, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "discovery.k8s.io", - Version: "v1", - Kind: "EndpointSlice", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1EndpointSliceImpl) UpdateStatus(ctx context.Context, in *apidiscoveryv1.EndpointSlice, opts metav1.UpdateOptions) (*apidiscoveryv1.EndpointSlice, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "discovery.k8s.io", - Version: "v1", - Kind: "EndpointSlice", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1EndpointSliceImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// DiscoveryV1beta1 retrieves the DiscoveryV1beta1Client -func (w *wrapClient) DiscoveryV1beta1() typeddiscoveryv1beta1.DiscoveryV1beta1Interface { - return &wrapDiscoveryV1beta1{ - dyn: w.dyn, - } -} - -type wrapDiscoveryV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapDiscoveryV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapDiscoveryV1beta1) EndpointSlices(namespace string) typeddiscoveryv1beta1.EndpointSliceInterface { - return &wrapDiscoveryV1beta1EndpointSliceImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "discovery.k8s.io", - Version: "v1beta1", - Resource: "endpointslices", - }), - - namespace: namespace, - } -} - -type wrapDiscoveryV1beta1EndpointSliceImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typeddiscoveryv1beta1.EndpointSliceInterface = (*wrapDiscoveryV1beta1EndpointSliceImpl)(nil) - -func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Apply(ctx context.Context, in *discoveryv1beta1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *apidiscoveryv1beta1.EndpointSlice, err error) { - in.Kind = ptr.String("EndpointSlice") - - in.APIVersion = ptr.String("discovery.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1beta1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1beta1EndpointSliceImpl) ApplyStatus(ctx context.Context, in *discoveryv1beta1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *apidiscoveryv1beta1.EndpointSlice, err error) { - in.Kind = ptr.String("EndpointSlice") - - in.APIVersion = ptr.String("discovery.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1beta1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Create(ctx context.Context, in *apidiscoveryv1beta1.EndpointSlice, opts metav1.CreateOptions) (*apidiscoveryv1beta1.EndpointSlice, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "discovery.k8s.io", - Version: "v1beta1", - Kind: "EndpointSlice", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1beta1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapDiscoveryV1beta1EndpointSliceImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apidiscoveryv1beta1.EndpointSlice, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1beta1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1beta1EndpointSliceImpl) List(ctx context.Context, opts metav1.ListOptions) (*apidiscoveryv1beta1.EndpointSliceList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1beta1.EndpointSliceList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apidiscoveryv1beta1.EndpointSlice, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1beta1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Update(ctx context.Context, in *apidiscoveryv1beta1.EndpointSlice, opts metav1.UpdateOptions) (*apidiscoveryv1beta1.EndpointSlice, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "discovery.k8s.io", - Version: "v1beta1", - Kind: "EndpointSlice", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1beta1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1beta1EndpointSliceImpl) UpdateStatus(ctx context.Context, in *apidiscoveryv1beta1.EndpointSlice, opts metav1.UpdateOptions) (*apidiscoveryv1beta1.EndpointSlice, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "discovery.k8s.io", - Version: "v1beta1", - Kind: "EndpointSlice", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apidiscoveryv1beta1.EndpointSlice{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// EventsV1 retrieves the EventsV1Client -func (w *wrapClient) EventsV1() typedeventsv1.EventsV1Interface { - return &wrapEventsV1{ - dyn: w.dyn, - } -} - -type wrapEventsV1 struct { - dyn dynamic.Interface -} - -func (w *wrapEventsV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapEventsV1) Events(namespace string) typedeventsv1.EventInterface { - return &wrapEventsV1EventImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "events.k8s.io", - Version: "v1", - Resource: "events", - }), - - namespace: namespace, - } -} - -type wrapEventsV1EventImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedeventsv1.EventInterface = (*wrapEventsV1EventImpl)(nil) - -func (w *wrapEventsV1EventImpl) Apply(ctx context.Context, in *eventsv1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apieventsv1.Event, err error) { - in.Kind = ptr.String("Event") - - in.APIVersion = ptr.String("events.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apieventsv1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1EventImpl) ApplyStatus(ctx context.Context, in *eventsv1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apieventsv1.Event, err error) { - in.Kind = ptr.String("Event") - - in.APIVersion = ptr.String("events.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apieventsv1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1EventImpl) Create(ctx context.Context, in *apieventsv1.Event, opts metav1.CreateOptions) (*apieventsv1.Event, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "events.k8s.io", - Version: "v1", - Kind: "Event", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apieventsv1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1EventImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapEventsV1EventImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapEventsV1EventImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apieventsv1.Event, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apieventsv1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1EventImpl) List(ctx context.Context, opts metav1.ListOptions) (*apieventsv1.EventList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apieventsv1.EventList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1EventImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apieventsv1.Event, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apieventsv1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1EventImpl) Update(ctx context.Context, in *apieventsv1.Event, opts metav1.UpdateOptions) (*apieventsv1.Event, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "events.k8s.io", - Version: "v1", - Kind: "Event", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apieventsv1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1EventImpl) UpdateStatus(ctx context.Context, in *apieventsv1.Event, opts metav1.UpdateOptions) (*apieventsv1.Event, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "events.k8s.io", - Version: "v1", - Kind: "Event", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apieventsv1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1EventImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// EventsV1beta1 retrieves the EventsV1beta1Client -func (w *wrapClient) EventsV1beta1() typedeventsv1beta1.EventsV1beta1Interface { - return &wrapEventsV1beta1{ - dyn: w.dyn, - } -} - -type wrapEventsV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapEventsV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapEventsV1beta1) Events(namespace string) typedeventsv1beta1.EventInterface { - return &wrapEventsV1beta1EventImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "events.k8s.io", - Version: "v1beta1", - Resource: "events", - }), - - namespace: namespace, - } -} - -type wrapEventsV1beta1EventImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedeventsv1beta1.EventInterface = (*wrapEventsV1beta1EventImpl)(nil) - -func (w *wrapEventsV1beta1EventImpl) Apply(ctx context.Context, in *eventsv1beta1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apieventsv1beta1.Event, err error) { - in.Kind = ptr.String("Event") - - in.APIVersion = ptr.String("events.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apieventsv1beta1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1beta1EventImpl) ApplyStatus(ctx context.Context, in *eventsv1beta1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apieventsv1beta1.Event, err error) { - in.Kind = ptr.String("Event") - - in.APIVersion = ptr.String("events.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apieventsv1beta1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1beta1EventImpl) Create(ctx context.Context, in *apieventsv1beta1.Event, opts metav1.CreateOptions) (*apieventsv1beta1.Event, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "events.k8s.io", - Version: "v1beta1", - Kind: "Event", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apieventsv1beta1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1beta1EventImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapEventsV1beta1EventImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapEventsV1beta1EventImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apieventsv1beta1.Event, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apieventsv1beta1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1beta1EventImpl) List(ctx context.Context, opts metav1.ListOptions) (*apieventsv1beta1.EventList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apieventsv1beta1.EventList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1beta1EventImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apieventsv1beta1.Event, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apieventsv1beta1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1beta1EventImpl) Update(ctx context.Context, in *apieventsv1beta1.Event, opts metav1.UpdateOptions) (*apieventsv1beta1.Event, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "events.k8s.io", - Version: "v1beta1", - Kind: "Event", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apieventsv1beta1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1beta1EventImpl) UpdateStatus(ctx context.Context, in *apieventsv1beta1.Event, opts metav1.UpdateOptions) (*apieventsv1beta1.Event, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "events.k8s.io", - Version: "v1beta1", - Kind: "Event", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apieventsv1beta1.Event{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapEventsV1beta1EventImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// ExtensionsV1beta1 retrieves the ExtensionsV1beta1Client -func (w *wrapClient) ExtensionsV1beta1() typedextensionsv1beta1.ExtensionsV1beta1Interface { - return &wrapExtensionsV1beta1{ - dyn: w.dyn, - } -} - -type wrapExtensionsV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapExtensionsV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapExtensionsV1beta1) DaemonSets(namespace string) typedextensionsv1beta1.DaemonSetInterface { - return &wrapExtensionsV1beta1DaemonSetImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "extensions", - Version: "v1beta1", - Resource: "daemonsets", - }), - - namespace: namespace, - } -} - -type wrapExtensionsV1beta1DaemonSetImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedextensionsv1beta1.DaemonSetInterface = (*wrapExtensionsV1beta1DaemonSetImpl)(nil) - -func (w *wrapExtensionsV1beta1DaemonSetImpl) Apply(ctx context.Context, in *extensionsv1beta1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.DaemonSet, err error) { - in.Kind = ptr.String("DaemonSet") - - in.APIVersion = ptr.String("extensions/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DaemonSetImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.DaemonSet, err error) { - in.Kind = ptr.String("DaemonSet") - - in.APIVersion = ptr.String("extensions/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DaemonSetImpl) Create(ctx context.Context, in *apiextensionsv1beta1.DaemonSet, opts metav1.CreateOptions) (*apiextensionsv1beta1.DaemonSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "DaemonSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DaemonSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapExtensionsV1beta1DaemonSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapExtensionsV1beta1DaemonSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.DaemonSet, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DaemonSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiextensionsv1beta1.DaemonSetList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.DaemonSetList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DaemonSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1beta1.DaemonSet, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DaemonSetImpl) Update(ctx context.Context, in *apiextensionsv1beta1.DaemonSet, opts metav1.UpdateOptions) (*apiextensionsv1beta1.DaemonSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "DaemonSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DaemonSetImpl) UpdateStatus(ctx context.Context, in *apiextensionsv1beta1.DaemonSet, opts metav1.UpdateOptions) (*apiextensionsv1beta1.DaemonSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "DaemonSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.DaemonSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DaemonSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapExtensionsV1beta1) Deployments(namespace string) typedextensionsv1beta1.DeploymentInterface { - return &wrapExtensionsV1beta1DeploymentImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "extensions", - Version: "v1beta1", - Resource: "deployments", - }), - - namespace: namespace, - } -} - -type wrapExtensionsV1beta1DeploymentImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedextensionsv1beta1.DeploymentInterface = (*wrapExtensionsV1beta1DeploymentImpl)(nil) - -func (w *wrapExtensionsV1beta1DeploymentImpl) Apply(ctx context.Context, in *extensionsv1beta1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.Deployment, err error) { - in.Kind = ptr.String("Deployment") - - in.APIVersion = ptr.String("extensions/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DeploymentImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.Deployment, err error) { - in.Kind = ptr.String("Deployment") - - in.APIVersion = ptr.String("extensions/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DeploymentImpl) Create(ctx context.Context, in *apiextensionsv1beta1.Deployment, opts metav1.CreateOptions) (*apiextensionsv1beta1.Deployment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "Deployment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DeploymentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapExtensionsV1beta1DeploymentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapExtensionsV1beta1DeploymentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.Deployment, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DeploymentImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiextensionsv1beta1.DeploymentList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.DeploymentList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DeploymentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1beta1.Deployment, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DeploymentImpl) Update(ctx context.Context, in *apiextensionsv1beta1.Deployment, opts metav1.UpdateOptions) (*apiextensionsv1beta1.Deployment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "Deployment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DeploymentImpl) UpdateStatus(ctx context.Context, in *apiextensionsv1beta1.Deployment, opts metav1.UpdateOptions) (*apiextensionsv1beta1.Deployment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "Deployment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Deployment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1DeploymentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapExtensionsV1beta1DeploymentImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.Scale, error) { - panic("NYI") -} - -func (w *wrapExtensionsV1beta1DeploymentImpl) UpdateScale(ctx context.Context, _ string, in *apiextensionsv1beta1.Scale, opts metav1.UpdateOptions) (*apiextensionsv1beta1.Scale, error) { - panic("NYI") -} - -func (w *wrapExtensionsV1beta1DeploymentImpl) ApplyScale(ctx context.Context, name string, in *extensionsv1beta1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (*apiextensionsv1beta1.Scale, error) { - panic("NYI") -} - -func (w *wrapExtensionsV1beta1) Ingresses(namespace string) typedextensionsv1beta1.IngressInterface { - return &wrapExtensionsV1beta1IngressImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "extensions", - Version: "v1beta1", - Resource: "ingresses", - }), - - namespace: namespace, - } -} - -type wrapExtensionsV1beta1IngressImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedextensionsv1beta1.IngressInterface = (*wrapExtensionsV1beta1IngressImpl)(nil) - -func (w *wrapExtensionsV1beta1IngressImpl) Apply(ctx context.Context, in *extensionsv1beta1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.Ingress, err error) { - in.Kind = ptr.String("Ingress") - - in.APIVersion = ptr.String("extensions/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1IngressImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.Ingress, err error) { - in.Kind = ptr.String("Ingress") - - in.APIVersion = ptr.String("extensions/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1IngressImpl) Create(ctx context.Context, in *apiextensionsv1beta1.Ingress, opts metav1.CreateOptions) (*apiextensionsv1beta1.Ingress, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "Ingress", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1IngressImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapExtensionsV1beta1IngressImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapExtensionsV1beta1IngressImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.Ingress, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1IngressImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiextensionsv1beta1.IngressList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.IngressList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1IngressImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1beta1.Ingress, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1IngressImpl) Update(ctx context.Context, in *apiextensionsv1beta1.Ingress, opts metav1.UpdateOptions) (*apiextensionsv1beta1.Ingress, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "Ingress", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1IngressImpl) UpdateStatus(ctx context.Context, in *apiextensionsv1beta1.Ingress, opts metav1.UpdateOptions) (*apiextensionsv1beta1.Ingress, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "Ingress", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1IngressImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapExtensionsV1beta1) NetworkPolicies(namespace string) typedextensionsv1beta1.NetworkPolicyInterface { - return &wrapExtensionsV1beta1NetworkPolicyImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "extensions", - Version: "v1beta1", - Resource: "networkpolicies", - }), - - namespace: namespace, - } -} - -type wrapExtensionsV1beta1NetworkPolicyImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedextensionsv1beta1.NetworkPolicyInterface = (*wrapExtensionsV1beta1NetworkPolicyImpl)(nil) - -func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Apply(ctx context.Context, in *extensionsv1beta1.NetworkPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.NetworkPolicy, err error) { - in.Kind = ptr.String("NetworkPolicy") - - in.APIVersion = ptr.String("extensions/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1NetworkPolicyImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.NetworkPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.NetworkPolicy, err error) { - in.Kind = ptr.String("NetworkPolicy") - - in.APIVersion = ptr.String("extensions/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Create(ctx context.Context, in *apiextensionsv1beta1.NetworkPolicy, opts metav1.CreateOptions) (*apiextensionsv1beta1.NetworkPolicy, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "NetworkPolicy", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapExtensionsV1beta1NetworkPolicyImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.NetworkPolicy, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1NetworkPolicyImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiextensionsv1beta1.NetworkPolicyList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.NetworkPolicyList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1beta1.NetworkPolicy, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Update(ctx context.Context, in *apiextensionsv1beta1.NetworkPolicy, opts metav1.UpdateOptions) (*apiextensionsv1beta1.NetworkPolicy, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "NetworkPolicy", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1NetworkPolicyImpl) UpdateStatus(ctx context.Context, in *apiextensionsv1beta1.NetworkPolicy, opts metav1.UpdateOptions) (*apiextensionsv1beta1.NetworkPolicy, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "NetworkPolicy", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapExtensionsV1beta1) PodSecurityPolicies() typedextensionsv1beta1.PodSecurityPolicyInterface { - return &wrapExtensionsV1beta1PodSecurityPolicyImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "extensions", - Version: "v1beta1", - Resource: "podsecuritypolicies", - }), - } -} - -type wrapExtensionsV1beta1PodSecurityPolicyImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedextensionsv1beta1.PodSecurityPolicyInterface = (*wrapExtensionsV1beta1PodSecurityPolicyImpl)(nil) - -func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Apply(ctx context.Context, in *extensionsv1beta1.PodSecurityPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.PodSecurityPolicy, err error) { - in.Kind = ptr.String("PodSecurityPolicy") - - in.APIVersion = ptr.String("extensions/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.PodSecurityPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.PodSecurityPolicy, err error) { - in.Kind = ptr.String("PodSecurityPolicy") - - in.APIVersion = ptr.String("extensions/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Create(ctx context.Context, in *apiextensionsv1beta1.PodSecurityPolicy, opts metav1.CreateOptions) (*apiextensionsv1beta1.PodSecurityPolicy, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "PodSecurityPolicy", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.PodSecurityPolicy, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiextensionsv1beta1.PodSecurityPolicyList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.PodSecurityPolicyList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1beta1.PodSecurityPolicy, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Update(ctx context.Context, in *apiextensionsv1beta1.PodSecurityPolicy, opts metav1.UpdateOptions) (*apiextensionsv1beta1.PodSecurityPolicy, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "PodSecurityPolicy", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) UpdateStatus(ctx context.Context, in *apiextensionsv1beta1.PodSecurityPolicy, opts metav1.UpdateOptions) (*apiextensionsv1beta1.PodSecurityPolicy, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "PodSecurityPolicy", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapExtensionsV1beta1) ReplicaSets(namespace string) typedextensionsv1beta1.ReplicaSetInterface { - return &wrapExtensionsV1beta1ReplicaSetImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "extensions", - Version: "v1beta1", - Resource: "replicasets", - }), - - namespace: namespace, - } -} - -type wrapExtensionsV1beta1ReplicaSetImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedextensionsv1beta1.ReplicaSetInterface = (*wrapExtensionsV1beta1ReplicaSetImpl)(nil) - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) Apply(ctx context.Context, in *extensionsv1beta1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.ReplicaSet, err error) { - in.Kind = ptr.String("ReplicaSet") - - in.APIVersion = ptr.String("extensions/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.ReplicaSet, err error) { - in.Kind = ptr.String("ReplicaSet") - - in.APIVersion = ptr.String("extensions/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) Create(ctx context.Context, in *apiextensionsv1beta1.ReplicaSet, opts metav1.CreateOptions) (*apiextensionsv1beta1.ReplicaSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "ReplicaSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.ReplicaSet, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiextensionsv1beta1.ReplicaSetList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.ReplicaSetList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1beta1.ReplicaSet, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) Update(ctx context.Context, in *apiextensionsv1beta1.ReplicaSet, opts metav1.UpdateOptions) (*apiextensionsv1beta1.ReplicaSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "ReplicaSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) UpdateStatus(ctx context.Context, in *apiextensionsv1beta1.ReplicaSet, opts metav1.UpdateOptions) (*apiextensionsv1beta1.ReplicaSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "extensions", - Version: "v1beta1", - Kind: "ReplicaSet", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiextensionsv1beta1.ReplicaSet{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.Scale, error) { - panic("NYI") -} - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) UpdateScale(ctx context.Context, _ string, in *apiextensionsv1beta1.Scale, opts metav1.UpdateOptions) (*apiextensionsv1beta1.Scale, error) { - panic("NYI") -} - -func (w *wrapExtensionsV1beta1ReplicaSetImpl) ApplyScale(ctx context.Context, name string, in *extensionsv1beta1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (*apiextensionsv1beta1.Scale, error) { - panic("NYI") -} - -// FlowcontrolV1alpha1 retrieves the FlowcontrolV1alpha1Client -func (w *wrapClient) FlowcontrolV1alpha1() typedflowcontrolv1alpha1.FlowcontrolV1alpha1Interface { - return &wrapFlowcontrolV1alpha1{ - dyn: w.dyn, - } -} - -type wrapFlowcontrolV1alpha1 struct { - dyn dynamic.Interface -} - -func (w *wrapFlowcontrolV1alpha1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapFlowcontrolV1alpha1) FlowSchemas() typedflowcontrolv1alpha1.FlowSchemaInterface { - return &wrapFlowcontrolV1alpha1FlowSchemaImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1alpha1", - Resource: "flowschemas", - }), - } -} - -type wrapFlowcontrolV1alpha1FlowSchemaImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedflowcontrolv1alpha1.FlowSchemaInterface = (*wrapFlowcontrolV1alpha1FlowSchemaImpl)(nil) - -func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Apply(ctx context.Context, in *flowcontrolv1alpha1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1alpha1.FlowSchema, err error) { - in.Kind = ptr.String("FlowSchema") - - in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1alpha1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1alpha1.FlowSchema, err error) { - in.Kind = ptr.String("FlowSchema") - - in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Create(ctx context.Context, in *apiflowcontrolv1alpha1.FlowSchema, opts metav1.CreateOptions) (*apiflowcontrolv1alpha1.FlowSchema, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1alpha1", - Kind: "FlowSchema", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiflowcontrolv1alpha1.FlowSchema, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiflowcontrolv1alpha1.FlowSchemaList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.FlowSchemaList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiflowcontrolv1alpha1.FlowSchema, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Update(ctx context.Context, in *apiflowcontrolv1alpha1.FlowSchema, opts metav1.UpdateOptions) (*apiflowcontrolv1alpha1.FlowSchema, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1alpha1", - Kind: "FlowSchema", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) UpdateStatus(ctx context.Context, in *apiflowcontrolv1alpha1.FlowSchema, opts metav1.UpdateOptions) (*apiflowcontrolv1alpha1.FlowSchema, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1alpha1", - Kind: "FlowSchema", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapFlowcontrolV1alpha1) PriorityLevelConfigurations() typedflowcontrolv1alpha1.PriorityLevelConfigurationInterface { - return &wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1alpha1", - Resource: "prioritylevelconfigurations", - }), - } -} - -type wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedflowcontrolv1alpha1.PriorityLevelConfigurationInterface = (*wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl)(nil) - -func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Apply(ctx context.Context, in *flowcontrolv1alpha1.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1alpha1.PriorityLevelConfiguration, err error) { - in.Kind = ptr.String("PriorityLevelConfiguration") - - in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1alpha1.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1alpha1.PriorityLevelConfiguration, err error) { - in.Kind = ptr.String("PriorityLevelConfiguration") - - in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Create(ctx context.Context, in *apiflowcontrolv1alpha1.PriorityLevelConfiguration, opts metav1.CreateOptions) (*apiflowcontrolv1alpha1.PriorityLevelConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1alpha1", - Kind: "PriorityLevelConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiflowcontrolv1alpha1.PriorityLevelConfiguration, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiflowcontrolv1alpha1.PriorityLevelConfigurationList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.PriorityLevelConfigurationList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiflowcontrolv1alpha1.PriorityLevelConfiguration, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Update(ctx context.Context, in *apiflowcontrolv1alpha1.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*apiflowcontrolv1alpha1.PriorityLevelConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1alpha1", - Kind: "PriorityLevelConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) UpdateStatus(ctx context.Context, in *apiflowcontrolv1alpha1.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*apiflowcontrolv1alpha1.PriorityLevelConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1alpha1", - Kind: "PriorityLevelConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// FlowcontrolV1beta1 retrieves the FlowcontrolV1beta1Client -func (w *wrapClient) FlowcontrolV1beta1() typedflowcontrolv1beta1.FlowcontrolV1beta1Interface { - return &wrapFlowcontrolV1beta1{ - dyn: w.dyn, - } -} - -type wrapFlowcontrolV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapFlowcontrolV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapFlowcontrolV1beta1) FlowSchemas() typedflowcontrolv1beta1.FlowSchemaInterface { - return &wrapFlowcontrolV1beta1FlowSchemaImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta1", - Resource: "flowschemas", - }), - } -} - -type wrapFlowcontrolV1beta1FlowSchemaImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedflowcontrolv1beta1.FlowSchemaInterface = (*wrapFlowcontrolV1beta1FlowSchemaImpl)(nil) - -func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Apply(ctx context.Context, in *flowcontrolv1beta1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.FlowSchema, err error) { - in.Kind = ptr.String("FlowSchema") - - in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1beta1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.FlowSchema, err error) { - in.Kind = ptr.String("FlowSchema") - - in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Create(ctx context.Context, in *apiflowcontrolv1beta1.FlowSchema, opts metav1.CreateOptions) (*apiflowcontrolv1beta1.FlowSchema, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta1", - Kind: "FlowSchema", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiflowcontrolv1beta1.FlowSchema, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiflowcontrolv1beta1.FlowSchemaList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.FlowSchemaList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiflowcontrolv1beta1.FlowSchema, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Update(ctx context.Context, in *apiflowcontrolv1beta1.FlowSchema, opts metav1.UpdateOptions) (*apiflowcontrolv1beta1.FlowSchema, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta1", - Kind: "FlowSchema", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) UpdateStatus(ctx context.Context, in *apiflowcontrolv1beta1.FlowSchema, opts metav1.UpdateOptions) (*apiflowcontrolv1beta1.FlowSchema, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta1", - Kind: "FlowSchema", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapFlowcontrolV1beta1) PriorityLevelConfigurations() typedflowcontrolv1beta1.PriorityLevelConfigurationInterface { - return &wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta1", - Resource: "prioritylevelconfigurations", - }), - } -} - -type wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedflowcontrolv1beta1.PriorityLevelConfigurationInterface = (*wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl)(nil) - -func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Apply(ctx context.Context, in *flowcontrolv1beta1.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.PriorityLevelConfiguration, err error) { - in.Kind = ptr.String("PriorityLevelConfiguration") - - in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1beta1.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.PriorityLevelConfiguration, err error) { - in.Kind = ptr.String("PriorityLevelConfiguration") - - in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Create(ctx context.Context, in *apiflowcontrolv1beta1.PriorityLevelConfiguration, opts metav1.CreateOptions) (*apiflowcontrolv1beta1.PriorityLevelConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta1", - Kind: "PriorityLevelConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiflowcontrolv1beta1.PriorityLevelConfiguration, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiflowcontrolv1beta1.PriorityLevelConfigurationList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.PriorityLevelConfigurationList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiflowcontrolv1beta1.PriorityLevelConfiguration, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Update(ctx context.Context, in *apiflowcontrolv1beta1.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*apiflowcontrolv1beta1.PriorityLevelConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta1", - Kind: "PriorityLevelConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) UpdateStatus(ctx context.Context, in *apiflowcontrolv1beta1.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*apiflowcontrolv1beta1.PriorityLevelConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta1", - Kind: "PriorityLevelConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// FlowcontrolV1beta2 retrieves the FlowcontrolV1beta2Client -func (w *wrapClient) FlowcontrolV1beta2() typedflowcontrolv1beta2.FlowcontrolV1beta2Interface { - return &wrapFlowcontrolV1beta2{ - dyn: w.dyn, - } -} - -type wrapFlowcontrolV1beta2 struct { - dyn dynamic.Interface -} - -func (w *wrapFlowcontrolV1beta2) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapFlowcontrolV1beta2) FlowSchemas() typedflowcontrolv1beta2.FlowSchemaInterface { - return &wrapFlowcontrolV1beta2FlowSchemaImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta2", - Resource: "flowschemas", - }), - } -} - -type wrapFlowcontrolV1beta2FlowSchemaImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedflowcontrolv1beta2.FlowSchemaInterface = (*wrapFlowcontrolV1beta2FlowSchemaImpl)(nil) - -func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) Apply(ctx context.Context, in *flowcontrolv1beta2.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta2.FlowSchema, err error) { - in.Kind = ptr.String("FlowSchema") - - in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1beta2.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta2.FlowSchema, err error) { - in.Kind = ptr.String("FlowSchema") - - in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) Create(ctx context.Context, in *apiflowcontrolv1beta2.FlowSchema, opts metav1.CreateOptions) (*apiflowcontrolv1beta2.FlowSchema, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta2", - Kind: "FlowSchema", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiflowcontrolv1beta2.FlowSchema, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiflowcontrolv1beta2.FlowSchemaList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.FlowSchemaList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiflowcontrolv1beta2.FlowSchema, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) Update(ctx context.Context, in *apiflowcontrolv1beta2.FlowSchema, opts metav1.UpdateOptions) (*apiflowcontrolv1beta2.FlowSchema, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta2", - Kind: "FlowSchema", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) UpdateStatus(ctx context.Context, in *apiflowcontrolv1beta2.FlowSchema, opts metav1.UpdateOptions) (*apiflowcontrolv1beta2.FlowSchema, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta2", - Kind: "FlowSchema", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.FlowSchema{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapFlowcontrolV1beta2) PriorityLevelConfigurations() typedflowcontrolv1beta2.PriorityLevelConfigurationInterface { - return &wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta2", - Resource: "prioritylevelconfigurations", - }), - } -} - -type wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedflowcontrolv1beta2.PriorityLevelConfigurationInterface = (*wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl)(nil) - -func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) Apply(ctx context.Context, in *flowcontrolv1beta2.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta2.PriorityLevelConfiguration, err error) { - in.Kind = ptr.String("PriorityLevelConfiguration") - - in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1beta2.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta2.PriorityLevelConfiguration, err error) { - in.Kind = ptr.String("PriorityLevelConfiguration") - - in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta2") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) Create(ctx context.Context, in *apiflowcontrolv1beta2.PriorityLevelConfiguration, opts metav1.CreateOptions) (*apiflowcontrolv1beta2.PriorityLevelConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta2", - Kind: "PriorityLevelConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiflowcontrolv1beta2.PriorityLevelConfiguration, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiflowcontrolv1beta2.PriorityLevelConfigurationList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.PriorityLevelConfigurationList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiflowcontrolv1beta2.PriorityLevelConfiguration, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) Update(ctx context.Context, in *apiflowcontrolv1beta2.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*apiflowcontrolv1beta2.PriorityLevelConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta2", - Kind: "PriorityLevelConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) UpdateStatus(ctx context.Context, in *apiflowcontrolv1beta2.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*apiflowcontrolv1beta2.PriorityLevelConfiguration, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "flowcontrol.apiserver.k8s.io", - Version: "v1beta2", - Kind: "PriorityLevelConfiguration", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apiflowcontrolv1beta2.PriorityLevelConfiguration{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// NetworkingV1 retrieves the NetworkingV1Client -func (w *wrapClient) NetworkingV1() typednetworkingv1.NetworkingV1Interface { - return &wrapNetworkingV1{ - dyn: w.dyn, - } -} - -type wrapNetworkingV1 struct { - dyn dynamic.Interface -} - -func (w *wrapNetworkingV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapNetworkingV1) Ingresses(namespace string) typednetworkingv1.IngressInterface { - return &wrapNetworkingV1IngressImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "networking.k8s.io", - Version: "v1", - Resource: "ingresses", - }), - - namespace: namespace, - } -} - -type wrapNetworkingV1IngressImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typednetworkingv1.IngressInterface = (*wrapNetworkingV1IngressImpl)(nil) - -func (w *wrapNetworkingV1IngressImpl) Apply(ctx context.Context, in *networkingv1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.Ingress, err error) { - in.Kind = ptr.String("Ingress") - - in.APIVersion = ptr.String("networking.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressImpl) ApplyStatus(ctx context.Context, in *networkingv1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.Ingress, err error) { - in.Kind = ptr.String("Ingress") - - in.APIVersion = ptr.String("networking.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressImpl) Create(ctx context.Context, in *apinetworkingv1.Ingress, opts metav1.CreateOptions) (*apinetworkingv1.Ingress, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1", - Kind: "Ingress", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapNetworkingV1IngressImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapNetworkingV1IngressImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinetworkingv1.Ingress, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinetworkingv1.IngressList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.IngressList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinetworkingv1.Ingress, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressImpl) Update(ctx context.Context, in *apinetworkingv1.Ingress, opts metav1.UpdateOptions) (*apinetworkingv1.Ingress, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1", - Kind: "Ingress", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressImpl) UpdateStatus(ctx context.Context, in *apinetworkingv1.Ingress, opts metav1.UpdateOptions) (*apinetworkingv1.Ingress, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1", - Kind: "Ingress", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapNetworkingV1) IngressClasses() typednetworkingv1.IngressClassInterface { - return &wrapNetworkingV1IngressClassImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "networking.k8s.io", - Version: "v1", - Resource: "ingressclasses", - }), - } -} - -type wrapNetworkingV1IngressClassImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typednetworkingv1.IngressClassInterface = (*wrapNetworkingV1IngressClassImpl)(nil) - -func (w *wrapNetworkingV1IngressClassImpl) Apply(ctx context.Context, in *networkingv1.IngressClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.IngressClass, err error) { - in.Kind = ptr.String("IngressClass") - - in.APIVersion = ptr.String("networking.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressClassImpl) ApplyStatus(ctx context.Context, in *networkingv1.IngressClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.IngressClass, err error) { - in.Kind = ptr.String("IngressClass") - - in.APIVersion = ptr.String("networking.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressClassImpl) Create(ctx context.Context, in *apinetworkingv1.IngressClass, opts metav1.CreateOptions) (*apinetworkingv1.IngressClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1", - Kind: "IngressClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapNetworkingV1IngressClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapNetworkingV1IngressClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinetworkingv1.IngressClass, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinetworkingv1.IngressClassList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.IngressClassList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinetworkingv1.IngressClass, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressClassImpl) Update(ctx context.Context, in *apinetworkingv1.IngressClass, opts metav1.UpdateOptions) (*apinetworkingv1.IngressClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1", - Kind: "IngressClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressClassImpl) UpdateStatus(ctx context.Context, in *apinetworkingv1.IngressClass, opts metav1.UpdateOptions) (*apinetworkingv1.IngressClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1", - Kind: "IngressClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1IngressClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapNetworkingV1) NetworkPolicies(namespace string) typednetworkingv1.NetworkPolicyInterface { - return &wrapNetworkingV1NetworkPolicyImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "networking.k8s.io", - Version: "v1", - Resource: "networkpolicies", - }), - - namespace: namespace, - } -} - -type wrapNetworkingV1NetworkPolicyImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typednetworkingv1.NetworkPolicyInterface = (*wrapNetworkingV1NetworkPolicyImpl)(nil) - -func (w *wrapNetworkingV1NetworkPolicyImpl) Apply(ctx context.Context, in *networkingv1.NetworkPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.NetworkPolicy, err error) { - in.Kind = ptr.String("NetworkPolicy") - - in.APIVersion = ptr.String("networking.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1NetworkPolicyImpl) ApplyStatus(ctx context.Context, in *networkingv1.NetworkPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.NetworkPolicy, err error) { - in.Kind = ptr.String("NetworkPolicy") - - in.APIVersion = ptr.String("networking.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1NetworkPolicyImpl) Create(ctx context.Context, in *apinetworkingv1.NetworkPolicy, opts metav1.CreateOptions) (*apinetworkingv1.NetworkPolicy, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1", - Kind: "NetworkPolicy", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1NetworkPolicyImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapNetworkingV1NetworkPolicyImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapNetworkingV1NetworkPolicyImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinetworkingv1.NetworkPolicy, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1NetworkPolicyImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinetworkingv1.NetworkPolicyList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.NetworkPolicyList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1NetworkPolicyImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinetworkingv1.NetworkPolicy, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1NetworkPolicyImpl) Update(ctx context.Context, in *apinetworkingv1.NetworkPolicy, opts metav1.UpdateOptions) (*apinetworkingv1.NetworkPolicy, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1", - Kind: "NetworkPolicy", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1NetworkPolicyImpl) UpdateStatus(ctx context.Context, in *apinetworkingv1.NetworkPolicy, opts metav1.UpdateOptions) (*apinetworkingv1.NetworkPolicy, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1", - Kind: "NetworkPolicy", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1.NetworkPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1NetworkPolicyImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// NetworkingV1alpha1 retrieves the NetworkingV1alpha1Client -func (w *wrapClient) NetworkingV1alpha1() typednetworkingv1alpha1.NetworkingV1alpha1Interface { - return &wrapNetworkingV1alpha1{ - dyn: w.dyn, - } -} - -type wrapNetworkingV1alpha1 struct { - dyn dynamic.Interface -} - -func (w *wrapNetworkingV1alpha1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapNetworkingV1alpha1) ClusterCIDRs() typednetworkingv1alpha1.ClusterCIDRInterface { - return &wrapNetworkingV1alpha1ClusterCIDRImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "networking.k8s.io", - Version: "v1alpha1", - Resource: "clustercidrs", - }), - } -} - -type wrapNetworkingV1alpha1ClusterCIDRImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typednetworkingv1alpha1.ClusterCIDRInterface = (*wrapNetworkingV1alpha1ClusterCIDRImpl)(nil) - -func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) Apply(ctx context.Context, in *networkingv1alpha1.ClusterCIDRApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1alpha1.ClusterCIDR, err error) { - in.Kind = ptr.String("ClusterCIDR") - - in.APIVersion = ptr.String("networking.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1alpha1.ClusterCIDR{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) ApplyStatus(ctx context.Context, in *networkingv1alpha1.ClusterCIDRApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1alpha1.ClusterCIDR, err error) { - in.Kind = ptr.String("ClusterCIDR") - - in.APIVersion = ptr.String("networking.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1alpha1.ClusterCIDR{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) Create(ctx context.Context, in *apinetworkingv1alpha1.ClusterCIDR, opts metav1.CreateOptions) (*apinetworkingv1alpha1.ClusterCIDR, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1alpha1", - Kind: "ClusterCIDR", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1alpha1.ClusterCIDR{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinetworkingv1alpha1.ClusterCIDR, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1alpha1.ClusterCIDR{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinetworkingv1alpha1.ClusterCIDRList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1alpha1.ClusterCIDRList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinetworkingv1alpha1.ClusterCIDR, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1alpha1.ClusterCIDR{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) Update(ctx context.Context, in *apinetworkingv1alpha1.ClusterCIDR, opts metav1.UpdateOptions) (*apinetworkingv1alpha1.ClusterCIDR, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1alpha1", - Kind: "ClusterCIDR", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1alpha1.ClusterCIDR{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) UpdateStatus(ctx context.Context, in *apinetworkingv1alpha1.ClusterCIDR, opts metav1.UpdateOptions) (*apinetworkingv1alpha1.ClusterCIDR, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1alpha1", - Kind: "ClusterCIDR", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1alpha1.ClusterCIDR{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// NetworkingV1beta1 retrieves the NetworkingV1beta1Client -func (w *wrapClient) NetworkingV1beta1() typednetworkingv1beta1.NetworkingV1beta1Interface { - return &wrapNetworkingV1beta1{ - dyn: w.dyn, - } -} - -type wrapNetworkingV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapNetworkingV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapNetworkingV1beta1) Ingresses(namespace string) typednetworkingv1beta1.IngressInterface { - return &wrapNetworkingV1beta1IngressImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "networking.k8s.io", - Version: "v1beta1", - Resource: "ingresses", - }), - - namespace: namespace, - } -} - -type wrapNetworkingV1beta1IngressImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typednetworkingv1beta1.IngressInterface = (*wrapNetworkingV1beta1IngressImpl)(nil) - -func (w *wrapNetworkingV1beta1IngressImpl) Apply(ctx context.Context, in *networkingv1beta1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1beta1.Ingress, err error) { - in.Kind = ptr.String("Ingress") - - in.APIVersion = ptr.String("networking.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressImpl) ApplyStatus(ctx context.Context, in *networkingv1beta1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1beta1.Ingress, err error) { - in.Kind = ptr.String("Ingress") - - in.APIVersion = ptr.String("networking.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressImpl) Create(ctx context.Context, in *apinetworkingv1beta1.Ingress, opts metav1.CreateOptions) (*apinetworkingv1beta1.Ingress, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1beta1", - Kind: "Ingress", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapNetworkingV1beta1IngressImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapNetworkingV1beta1IngressImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinetworkingv1beta1.Ingress, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinetworkingv1beta1.IngressList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.IngressList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinetworkingv1beta1.Ingress, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressImpl) Update(ctx context.Context, in *apinetworkingv1beta1.Ingress, opts metav1.UpdateOptions) (*apinetworkingv1beta1.Ingress, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1beta1", - Kind: "Ingress", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressImpl) UpdateStatus(ctx context.Context, in *apinetworkingv1beta1.Ingress, opts metav1.UpdateOptions) (*apinetworkingv1beta1.Ingress, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1beta1", - Kind: "Ingress", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.Ingress{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapNetworkingV1beta1) IngressClasses() typednetworkingv1beta1.IngressClassInterface { - return &wrapNetworkingV1beta1IngressClassImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "networking.k8s.io", - Version: "v1beta1", - Resource: "ingressclasses", - }), - } -} - -type wrapNetworkingV1beta1IngressClassImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typednetworkingv1beta1.IngressClassInterface = (*wrapNetworkingV1beta1IngressClassImpl)(nil) - -func (w *wrapNetworkingV1beta1IngressClassImpl) Apply(ctx context.Context, in *networkingv1beta1.IngressClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1beta1.IngressClass, err error) { - in.Kind = ptr.String("IngressClass") - - in.APIVersion = ptr.String("networking.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressClassImpl) ApplyStatus(ctx context.Context, in *networkingv1beta1.IngressClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1beta1.IngressClass, err error) { - in.Kind = ptr.String("IngressClass") - - in.APIVersion = ptr.String("networking.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressClassImpl) Create(ctx context.Context, in *apinetworkingv1beta1.IngressClass, opts metav1.CreateOptions) (*apinetworkingv1beta1.IngressClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1beta1", - Kind: "IngressClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapNetworkingV1beta1IngressClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapNetworkingV1beta1IngressClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinetworkingv1beta1.IngressClass, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinetworkingv1beta1.IngressClassList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.IngressClassList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinetworkingv1beta1.IngressClass, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressClassImpl) Update(ctx context.Context, in *apinetworkingv1beta1.IngressClass, opts metav1.UpdateOptions) (*apinetworkingv1beta1.IngressClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1beta1", - Kind: "IngressClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressClassImpl) UpdateStatus(ctx context.Context, in *apinetworkingv1beta1.IngressClass, opts metav1.UpdateOptions) (*apinetworkingv1beta1.IngressClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "networking.k8s.io", - Version: "v1beta1", - Kind: "IngressClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinetworkingv1beta1.IngressClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNetworkingV1beta1IngressClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// NodeV1 retrieves the NodeV1Client -func (w *wrapClient) NodeV1() typednodev1.NodeV1Interface { - return &wrapNodeV1{ - dyn: w.dyn, - } -} - -type wrapNodeV1 struct { - dyn dynamic.Interface -} - -func (w *wrapNodeV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapNodeV1) RuntimeClasses() typednodev1.RuntimeClassInterface { - return &wrapNodeV1RuntimeClassImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "node.k8s.io", - Version: "v1", - Resource: "runtimeclasses", - }), - } -} - -type wrapNodeV1RuntimeClassImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typednodev1.RuntimeClassInterface = (*wrapNodeV1RuntimeClassImpl)(nil) - -func (w *wrapNodeV1RuntimeClassImpl) Apply(ctx context.Context, in *nodev1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1.RuntimeClass, err error) { - in.Kind = ptr.String("RuntimeClass") - - in.APIVersion = ptr.String("node.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1RuntimeClassImpl) ApplyStatus(ctx context.Context, in *nodev1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1.RuntimeClass, err error) { - in.Kind = ptr.String("RuntimeClass") - - in.APIVersion = ptr.String("node.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1RuntimeClassImpl) Create(ctx context.Context, in *apinodev1.RuntimeClass, opts metav1.CreateOptions) (*apinodev1.RuntimeClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "node.k8s.io", - Version: "v1", - Kind: "RuntimeClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1RuntimeClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapNodeV1RuntimeClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapNodeV1RuntimeClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinodev1.RuntimeClass, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apinodev1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1RuntimeClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinodev1.RuntimeClassList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apinodev1.RuntimeClassList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1RuntimeClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinodev1.RuntimeClass, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apinodev1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1RuntimeClassImpl) Update(ctx context.Context, in *apinodev1.RuntimeClass, opts metav1.UpdateOptions) (*apinodev1.RuntimeClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "node.k8s.io", - Version: "v1", - Kind: "RuntimeClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1RuntimeClassImpl) UpdateStatus(ctx context.Context, in *apinodev1.RuntimeClass, opts metav1.UpdateOptions) (*apinodev1.RuntimeClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "node.k8s.io", - Version: "v1", - Kind: "RuntimeClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1RuntimeClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// NodeV1alpha1 retrieves the NodeV1alpha1Client -func (w *wrapClient) NodeV1alpha1() typednodev1alpha1.NodeV1alpha1Interface { - return &wrapNodeV1alpha1{ - dyn: w.dyn, - } -} - -type wrapNodeV1alpha1 struct { - dyn dynamic.Interface -} - -func (w *wrapNodeV1alpha1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapNodeV1alpha1) RuntimeClasses() typednodev1alpha1.RuntimeClassInterface { - return &wrapNodeV1alpha1RuntimeClassImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "node.k8s.io", - Version: "v1alpha1", - Resource: "runtimeclasses", - }), - } -} - -type wrapNodeV1alpha1RuntimeClassImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typednodev1alpha1.RuntimeClassInterface = (*wrapNodeV1alpha1RuntimeClassImpl)(nil) - -func (w *wrapNodeV1alpha1RuntimeClassImpl) Apply(ctx context.Context, in *nodev1alpha1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1alpha1.RuntimeClass, err error) { - in.Kind = ptr.String("RuntimeClass") - - in.APIVersion = ptr.String("node.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1alpha1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1alpha1RuntimeClassImpl) ApplyStatus(ctx context.Context, in *nodev1alpha1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1alpha1.RuntimeClass, err error) { - in.Kind = ptr.String("RuntimeClass") - - in.APIVersion = ptr.String("node.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1alpha1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1alpha1RuntimeClassImpl) Create(ctx context.Context, in *apinodev1alpha1.RuntimeClass, opts metav1.CreateOptions) (*apinodev1alpha1.RuntimeClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "node.k8s.io", - Version: "v1alpha1", - Kind: "RuntimeClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1alpha1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1alpha1RuntimeClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapNodeV1alpha1RuntimeClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapNodeV1alpha1RuntimeClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinodev1alpha1.RuntimeClass, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apinodev1alpha1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1alpha1RuntimeClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinodev1alpha1.RuntimeClassList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apinodev1alpha1.RuntimeClassList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1alpha1RuntimeClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinodev1alpha1.RuntimeClass, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apinodev1alpha1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1alpha1RuntimeClassImpl) Update(ctx context.Context, in *apinodev1alpha1.RuntimeClass, opts metav1.UpdateOptions) (*apinodev1alpha1.RuntimeClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "node.k8s.io", - Version: "v1alpha1", - Kind: "RuntimeClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1alpha1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1alpha1RuntimeClassImpl) UpdateStatus(ctx context.Context, in *apinodev1alpha1.RuntimeClass, opts metav1.UpdateOptions) (*apinodev1alpha1.RuntimeClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "node.k8s.io", - Version: "v1alpha1", - Kind: "RuntimeClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1alpha1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1alpha1RuntimeClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// NodeV1beta1 retrieves the NodeV1beta1Client -func (w *wrapClient) NodeV1beta1() typednodev1beta1.NodeV1beta1Interface { - return &wrapNodeV1beta1{ - dyn: w.dyn, - } -} - -type wrapNodeV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapNodeV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapNodeV1beta1) RuntimeClasses() typednodev1beta1.RuntimeClassInterface { - return &wrapNodeV1beta1RuntimeClassImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "node.k8s.io", - Version: "v1beta1", - Resource: "runtimeclasses", - }), - } -} - -type wrapNodeV1beta1RuntimeClassImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typednodev1beta1.RuntimeClassInterface = (*wrapNodeV1beta1RuntimeClassImpl)(nil) - -func (w *wrapNodeV1beta1RuntimeClassImpl) Apply(ctx context.Context, in *nodev1beta1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1beta1.RuntimeClass, err error) { - in.Kind = ptr.String("RuntimeClass") - - in.APIVersion = ptr.String("node.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1beta1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1beta1RuntimeClassImpl) ApplyStatus(ctx context.Context, in *nodev1beta1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1beta1.RuntimeClass, err error) { - in.Kind = ptr.String("RuntimeClass") - - in.APIVersion = ptr.String("node.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1beta1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1beta1RuntimeClassImpl) Create(ctx context.Context, in *apinodev1beta1.RuntimeClass, opts metav1.CreateOptions) (*apinodev1beta1.RuntimeClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "node.k8s.io", - Version: "v1beta1", - Kind: "RuntimeClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1beta1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1beta1RuntimeClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapNodeV1beta1RuntimeClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapNodeV1beta1RuntimeClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinodev1beta1.RuntimeClass, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apinodev1beta1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1beta1RuntimeClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinodev1beta1.RuntimeClassList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apinodev1beta1.RuntimeClassList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1beta1RuntimeClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinodev1beta1.RuntimeClass, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apinodev1beta1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1beta1RuntimeClassImpl) Update(ctx context.Context, in *apinodev1beta1.RuntimeClass, opts metav1.UpdateOptions) (*apinodev1beta1.RuntimeClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "node.k8s.io", - Version: "v1beta1", - Kind: "RuntimeClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1beta1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1beta1RuntimeClassImpl) UpdateStatus(ctx context.Context, in *apinodev1beta1.RuntimeClass, opts metav1.UpdateOptions) (*apinodev1beta1.RuntimeClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "node.k8s.io", - Version: "v1beta1", - Kind: "RuntimeClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apinodev1beta1.RuntimeClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapNodeV1beta1RuntimeClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// PolicyV1 retrieves the PolicyV1Client -func (w *wrapClient) PolicyV1() typedpolicyv1.PolicyV1Interface { - return &wrapPolicyV1{ - dyn: w.dyn, - } -} - -type wrapPolicyV1 struct { - dyn dynamic.Interface -} - -func (w *wrapPolicyV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapPolicyV1) Evictions(namespace string) typedpolicyv1.EvictionInterface { - return &wrapPolicyV1EvictionImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "policy", - Version: "v1", - Resource: "evictions", - }), - - namespace: namespace, - } -} - -type wrapPolicyV1EvictionImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedpolicyv1.EvictionInterface = (*wrapPolicyV1EvictionImpl)(nil) - -func (w *wrapPolicyV1) PodDisruptionBudgets(namespace string) typedpolicyv1.PodDisruptionBudgetInterface { - return &wrapPolicyV1PodDisruptionBudgetImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "policy", - Version: "v1", - Resource: "poddisruptionbudgets", - }), - - namespace: namespace, - } -} - -type wrapPolicyV1PodDisruptionBudgetImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedpolicyv1.PodDisruptionBudgetInterface = (*wrapPolicyV1PodDisruptionBudgetImpl)(nil) - -func (w *wrapPolicyV1PodDisruptionBudgetImpl) Apply(ctx context.Context, in *policyv1.PodDisruptionBudgetApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1.PodDisruptionBudget, err error) { - in.Kind = ptr.String("PodDisruptionBudget") - - in.APIVersion = ptr.String("policy/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1PodDisruptionBudgetImpl) ApplyStatus(ctx context.Context, in *policyv1.PodDisruptionBudgetApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1.PodDisruptionBudget, err error) { - in.Kind = ptr.String("PodDisruptionBudget") - - in.APIVersion = ptr.String("policy/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1PodDisruptionBudgetImpl) Create(ctx context.Context, in *apipolicyv1.PodDisruptionBudget, opts metav1.CreateOptions) (*apipolicyv1.PodDisruptionBudget, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "policy", - Version: "v1", - Kind: "PodDisruptionBudget", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1PodDisruptionBudgetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapPolicyV1PodDisruptionBudgetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapPolicyV1PodDisruptionBudgetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apipolicyv1.PodDisruptionBudget, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1PodDisruptionBudgetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apipolicyv1.PodDisruptionBudgetList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1.PodDisruptionBudgetList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1PodDisruptionBudgetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apipolicyv1.PodDisruptionBudget, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1PodDisruptionBudgetImpl) Update(ctx context.Context, in *apipolicyv1.PodDisruptionBudget, opts metav1.UpdateOptions) (*apipolicyv1.PodDisruptionBudget, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "policy", - Version: "v1", - Kind: "PodDisruptionBudget", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1PodDisruptionBudgetImpl) UpdateStatus(ctx context.Context, in *apipolicyv1.PodDisruptionBudget, opts metav1.UpdateOptions) (*apipolicyv1.PodDisruptionBudget, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "policy", - Version: "v1", - Kind: "PodDisruptionBudget", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1PodDisruptionBudgetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// PolicyV1beta1 retrieves the PolicyV1beta1Client -func (w *wrapClient) PolicyV1beta1() typedpolicyv1beta1.PolicyV1beta1Interface { - return &wrapPolicyV1beta1{ - dyn: w.dyn, - } -} - -type wrapPolicyV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapPolicyV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapPolicyV1beta1) Evictions(namespace string) typedpolicyv1beta1.EvictionInterface { - return &wrapPolicyV1beta1EvictionImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "policy", - Version: "v1beta1", - Resource: "evictions", - }), - - namespace: namespace, - } -} - -type wrapPolicyV1beta1EvictionImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedpolicyv1beta1.EvictionInterface = (*wrapPolicyV1beta1EvictionImpl)(nil) - -func (w *wrapPolicyV1beta1) PodDisruptionBudgets(namespace string) typedpolicyv1beta1.PodDisruptionBudgetInterface { - return &wrapPolicyV1beta1PodDisruptionBudgetImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "policy", - Version: "v1beta1", - Resource: "poddisruptionbudgets", - }), - - namespace: namespace, - } -} - -type wrapPolicyV1beta1PodDisruptionBudgetImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedpolicyv1beta1.PodDisruptionBudgetInterface = (*wrapPolicyV1beta1PodDisruptionBudgetImpl)(nil) - -func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Apply(ctx context.Context, in *policyv1beta1.PodDisruptionBudgetApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1beta1.PodDisruptionBudget, err error) { - in.Kind = ptr.String("PodDisruptionBudget") - - in.APIVersion = ptr.String("policy/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) ApplyStatus(ctx context.Context, in *policyv1beta1.PodDisruptionBudgetApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1beta1.PodDisruptionBudget, err error) { - in.Kind = ptr.String("PodDisruptionBudget") - - in.APIVersion = ptr.String("policy/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Create(ctx context.Context, in *apipolicyv1beta1.PodDisruptionBudget, opts metav1.CreateOptions) (*apipolicyv1beta1.PodDisruptionBudget, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "policy", - Version: "v1beta1", - Kind: "PodDisruptionBudget", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apipolicyv1beta1.PodDisruptionBudget, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apipolicyv1beta1.PodDisruptionBudgetList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodDisruptionBudgetList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apipolicyv1beta1.PodDisruptionBudget, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Update(ctx context.Context, in *apipolicyv1beta1.PodDisruptionBudget, opts metav1.UpdateOptions) (*apipolicyv1beta1.PodDisruptionBudget, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "policy", - Version: "v1beta1", - Kind: "PodDisruptionBudget", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) UpdateStatus(ctx context.Context, in *apipolicyv1beta1.PodDisruptionBudget, opts metav1.UpdateOptions) (*apipolicyv1beta1.PodDisruptionBudget, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "policy", - Version: "v1beta1", - Kind: "PodDisruptionBudget", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodDisruptionBudget{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapPolicyV1beta1) PodSecurityPolicies() typedpolicyv1beta1.PodSecurityPolicyInterface { - return &wrapPolicyV1beta1PodSecurityPolicyImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "policy", - Version: "v1beta1", - Resource: "podsecuritypolicies", - }), - } -} - -type wrapPolicyV1beta1PodSecurityPolicyImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedpolicyv1beta1.PodSecurityPolicyInterface = (*wrapPolicyV1beta1PodSecurityPolicyImpl)(nil) - -func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Apply(ctx context.Context, in *policyv1beta1.PodSecurityPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1beta1.PodSecurityPolicy, err error) { - in.Kind = ptr.String("PodSecurityPolicy") - - in.APIVersion = ptr.String("policy/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) ApplyStatus(ctx context.Context, in *policyv1beta1.PodSecurityPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1beta1.PodSecurityPolicy, err error) { - in.Kind = ptr.String("PodSecurityPolicy") - - in.APIVersion = ptr.String("policy/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Create(ctx context.Context, in *apipolicyv1beta1.PodSecurityPolicy, opts metav1.CreateOptions) (*apipolicyv1beta1.PodSecurityPolicy, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "policy", - Version: "v1beta1", - Kind: "PodSecurityPolicy", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apipolicyv1beta1.PodSecurityPolicy, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) List(ctx context.Context, opts metav1.ListOptions) (*apipolicyv1beta1.PodSecurityPolicyList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodSecurityPolicyList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apipolicyv1beta1.PodSecurityPolicy, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Update(ctx context.Context, in *apipolicyv1beta1.PodSecurityPolicy, opts metav1.UpdateOptions) (*apipolicyv1beta1.PodSecurityPolicy, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "policy", - Version: "v1beta1", - Kind: "PodSecurityPolicy", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) UpdateStatus(ctx context.Context, in *apipolicyv1beta1.PodSecurityPolicy, opts metav1.UpdateOptions) (*apipolicyv1beta1.PodSecurityPolicy, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "policy", - Version: "v1beta1", - Kind: "PodSecurityPolicy", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apipolicyv1beta1.PodSecurityPolicy{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// RbacV1 retrieves the RbacV1Client -func (w *wrapClient) RbacV1() typedrbacv1.RbacV1Interface { - return &wrapRbacV1{ - dyn: w.dyn, - } -} - -type wrapRbacV1 struct { - dyn dynamic.Interface -} - -func (w *wrapRbacV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapRbacV1) ClusterRoles() typedrbacv1.ClusterRoleInterface { - return &wrapRbacV1ClusterRoleImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Resource: "clusterroles", - }), - } -} - -type wrapRbacV1ClusterRoleImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedrbacv1.ClusterRoleInterface = (*wrapRbacV1ClusterRoleImpl)(nil) - -func (w *wrapRbacV1ClusterRoleImpl) Apply(ctx context.Context, in *rbacv1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.ClusterRole, err error) { - in.Kind = ptr.String("ClusterRole") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleImpl) ApplyStatus(ctx context.Context, in *rbacv1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.ClusterRole, err error) { - in.Kind = ptr.String("ClusterRole") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleImpl) Create(ctx context.Context, in *apirbacv1.ClusterRole, opts metav1.CreateOptions) (*apirbacv1.ClusterRole, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Kind: "ClusterRole", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapRbacV1ClusterRoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapRbacV1ClusterRoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1.ClusterRole, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1.ClusterRoleList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRoleList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1.ClusterRole, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleImpl) Update(ctx context.Context, in *apirbacv1.ClusterRole, opts metav1.UpdateOptions) (*apirbacv1.ClusterRole, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Kind: "ClusterRole", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleImpl) UpdateStatus(ctx context.Context, in *apirbacv1.ClusterRole, opts metav1.UpdateOptions) (*apirbacv1.ClusterRole, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Kind: "ClusterRole", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapRbacV1) ClusterRoleBindings() typedrbacv1.ClusterRoleBindingInterface { - return &wrapRbacV1ClusterRoleBindingImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Resource: "clusterrolebindings", - }), - } -} - -type wrapRbacV1ClusterRoleBindingImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedrbacv1.ClusterRoleBindingInterface = (*wrapRbacV1ClusterRoleBindingImpl)(nil) - -func (w *wrapRbacV1ClusterRoleBindingImpl) Apply(ctx context.Context, in *rbacv1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.ClusterRoleBinding, err error) { - in.Kind = ptr.String("ClusterRoleBinding") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.ClusterRoleBinding, err error) { - in.Kind = ptr.String("ClusterRoleBinding") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleBindingImpl) Create(ctx context.Context, in *apirbacv1.ClusterRoleBinding, opts metav1.CreateOptions) (*apirbacv1.ClusterRoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Kind: "ClusterRoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapRbacV1ClusterRoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapRbacV1ClusterRoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1.ClusterRoleBinding, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1.ClusterRoleBindingList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRoleBindingList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1.ClusterRoleBinding, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleBindingImpl) Update(ctx context.Context, in *apirbacv1.ClusterRoleBinding, opts metav1.UpdateOptions) (*apirbacv1.ClusterRoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Kind: "ClusterRoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleBindingImpl) UpdateStatus(ctx context.Context, in *apirbacv1.ClusterRoleBinding, opts metav1.UpdateOptions) (*apirbacv1.ClusterRoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Kind: "ClusterRoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1ClusterRoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapRbacV1) Roles(namespace string) typedrbacv1.RoleInterface { - return &wrapRbacV1RoleImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Resource: "roles", - }), - - namespace: namespace, - } -} - -type wrapRbacV1RoleImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedrbacv1.RoleInterface = (*wrapRbacV1RoleImpl)(nil) - -func (w *wrapRbacV1RoleImpl) Apply(ctx context.Context, in *rbacv1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.Role, err error) { - in.Kind = ptr.String("Role") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleImpl) ApplyStatus(ctx context.Context, in *rbacv1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.Role, err error) { - in.Kind = ptr.String("Role") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleImpl) Create(ctx context.Context, in *apirbacv1.Role, opts metav1.CreateOptions) (*apirbacv1.Role, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Kind: "Role", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapRbacV1RoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapRbacV1RoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1.Role, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1.RoleList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.RoleList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1.Role, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleImpl) Update(ctx context.Context, in *apirbacv1.Role, opts metav1.UpdateOptions) (*apirbacv1.Role, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Kind: "Role", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleImpl) UpdateStatus(ctx context.Context, in *apirbacv1.Role, opts metav1.UpdateOptions) (*apirbacv1.Role, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Kind: "Role", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapRbacV1) RoleBindings(namespace string) typedrbacv1.RoleBindingInterface { - return &wrapRbacV1RoleBindingImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Resource: "rolebindings", - }), - - namespace: namespace, - } -} - -type wrapRbacV1RoleBindingImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedrbacv1.RoleBindingInterface = (*wrapRbacV1RoleBindingImpl)(nil) - -func (w *wrapRbacV1RoleBindingImpl) Apply(ctx context.Context, in *rbacv1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.RoleBinding, err error) { - in.Kind = ptr.String("RoleBinding") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.RoleBinding, err error) { - in.Kind = ptr.String("RoleBinding") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleBindingImpl) Create(ctx context.Context, in *apirbacv1.RoleBinding, opts metav1.CreateOptions) (*apirbacv1.RoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Kind: "RoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapRbacV1RoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapRbacV1RoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1.RoleBinding, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1.RoleBindingList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.RoleBindingList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1.RoleBinding, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleBindingImpl) Update(ctx context.Context, in *apirbacv1.RoleBinding, opts metav1.UpdateOptions) (*apirbacv1.RoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Kind: "RoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleBindingImpl) UpdateStatus(ctx context.Context, in *apirbacv1.RoleBinding, opts metav1.UpdateOptions) (*apirbacv1.RoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1", - Kind: "RoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1RoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// RbacV1alpha1 retrieves the RbacV1alpha1Client -func (w *wrapClient) RbacV1alpha1() typedrbacv1alpha1.RbacV1alpha1Interface { - return &wrapRbacV1alpha1{ - dyn: w.dyn, - } -} - -type wrapRbacV1alpha1 struct { - dyn dynamic.Interface -} - -func (w *wrapRbacV1alpha1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapRbacV1alpha1) ClusterRoles() typedrbacv1alpha1.ClusterRoleInterface { - return &wrapRbacV1alpha1ClusterRoleImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Resource: "clusterroles", - }), - } -} - -type wrapRbacV1alpha1ClusterRoleImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedrbacv1alpha1.ClusterRoleInterface = (*wrapRbacV1alpha1ClusterRoleImpl)(nil) - -func (w *wrapRbacV1alpha1ClusterRoleImpl) Apply(ctx context.Context, in *rbacv1alpha1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.ClusterRole, err error) { - in.Kind = ptr.String("ClusterRole") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleImpl) ApplyStatus(ctx context.Context, in *rbacv1alpha1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.ClusterRole, err error) { - in.Kind = ptr.String("ClusterRole") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleImpl) Create(ctx context.Context, in *apirbacv1alpha1.ClusterRole, opts metav1.CreateOptions) (*apirbacv1alpha1.ClusterRole, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Kind: "ClusterRole", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapRbacV1alpha1ClusterRoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapRbacV1alpha1ClusterRoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1alpha1.ClusterRole, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1alpha1.ClusterRoleList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRoleList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1alpha1.ClusterRole, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleImpl) Update(ctx context.Context, in *apirbacv1alpha1.ClusterRole, opts metav1.UpdateOptions) (*apirbacv1alpha1.ClusterRole, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Kind: "ClusterRole", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleImpl) UpdateStatus(ctx context.Context, in *apirbacv1alpha1.ClusterRole, opts metav1.UpdateOptions) (*apirbacv1alpha1.ClusterRole, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Kind: "ClusterRole", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapRbacV1alpha1) ClusterRoleBindings() typedrbacv1alpha1.ClusterRoleBindingInterface { - return &wrapRbacV1alpha1ClusterRoleBindingImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Resource: "clusterrolebindings", - }), - } -} - -type wrapRbacV1alpha1ClusterRoleBindingImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedrbacv1alpha1.ClusterRoleBindingInterface = (*wrapRbacV1alpha1ClusterRoleBindingImpl)(nil) - -func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Apply(ctx context.Context, in *rbacv1alpha1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.ClusterRoleBinding, err error) { - in.Kind = ptr.String("ClusterRoleBinding") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1alpha1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.ClusterRoleBinding, err error) { - in.Kind = ptr.String("ClusterRoleBinding") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Create(ctx context.Context, in *apirbacv1alpha1.ClusterRoleBinding, opts metav1.CreateOptions) (*apirbacv1alpha1.ClusterRoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Kind: "ClusterRoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1alpha1.ClusterRoleBinding, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1alpha1.ClusterRoleBindingList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRoleBindingList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1alpha1.ClusterRoleBinding, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Update(ctx context.Context, in *apirbacv1alpha1.ClusterRoleBinding, opts metav1.UpdateOptions) (*apirbacv1alpha1.ClusterRoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Kind: "ClusterRoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) UpdateStatus(ctx context.Context, in *apirbacv1alpha1.ClusterRoleBinding, opts metav1.UpdateOptions) (*apirbacv1alpha1.ClusterRoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Kind: "ClusterRoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapRbacV1alpha1) Roles(namespace string) typedrbacv1alpha1.RoleInterface { - return &wrapRbacV1alpha1RoleImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Resource: "roles", - }), - - namespace: namespace, - } -} - -type wrapRbacV1alpha1RoleImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedrbacv1alpha1.RoleInterface = (*wrapRbacV1alpha1RoleImpl)(nil) - -func (w *wrapRbacV1alpha1RoleImpl) Apply(ctx context.Context, in *rbacv1alpha1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.Role, err error) { - in.Kind = ptr.String("Role") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleImpl) ApplyStatus(ctx context.Context, in *rbacv1alpha1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.Role, err error) { - in.Kind = ptr.String("Role") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleImpl) Create(ctx context.Context, in *apirbacv1alpha1.Role, opts metav1.CreateOptions) (*apirbacv1alpha1.Role, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Kind: "Role", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapRbacV1alpha1RoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapRbacV1alpha1RoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1alpha1.Role, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1alpha1.RoleList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.RoleList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1alpha1.Role, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleImpl) Update(ctx context.Context, in *apirbacv1alpha1.Role, opts metav1.UpdateOptions) (*apirbacv1alpha1.Role, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Kind: "Role", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleImpl) UpdateStatus(ctx context.Context, in *apirbacv1alpha1.Role, opts metav1.UpdateOptions) (*apirbacv1alpha1.Role, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Kind: "Role", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapRbacV1alpha1) RoleBindings(namespace string) typedrbacv1alpha1.RoleBindingInterface { - return &wrapRbacV1alpha1RoleBindingImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Resource: "rolebindings", - }), - - namespace: namespace, - } -} - -type wrapRbacV1alpha1RoleBindingImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedrbacv1alpha1.RoleBindingInterface = (*wrapRbacV1alpha1RoleBindingImpl)(nil) - -func (w *wrapRbacV1alpha1RoleBindingImpl) Apply(ctx context.Context, in *rbacv1alpha1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.RoleBinding, err error) { - in.Kind = ptr.String("RoleBinding") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1alpha1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.RoleBinding, err error) { - in.Kind = ptr.String("RoleBinding") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleBindingImpl) Create(ctx context.Context, in *apirbacv1alpha1.RoleBinding, opts metav1.CreateOptions) (*apirbacv1alpha1.RoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Kind: "RoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapRbacV1alpha1RoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapRbacV1alpha1RoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1alpha1.RoleBinding, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1alpha1.RoleBindingList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.RoleBindingList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1alpha1.RoleBinding, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleBindingImpl) Update(ctx context.Context, in *apirbacv1alpha1.RoleBinding, opts metav1.UpdateOptions) (*apirbacv1alpha1.RoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Kind: "RoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleBindingImpl) UpdateStatus(ctx context.Context, in *apirbacv1alpha1.RoleBinding, opts metav1.UpdateOptions) (*apirbacv1alpha1.RoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1alpha1", - Kind: "RoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1alpha1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1alpha1RoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// RbacV1beta1 retrieves the RbacV1beta1Client -func (w *wrapClient) RbacV1beta1() typedrbacv1beta1.RbacV1beta1Interface { - return &wrapRbacV1beta1{ - dyn: w.dyn, - } -} - -type wrapRbacV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapRbacV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapRbacV1beta1) ClusterRoles() typedrbacv1beta1.ClusterRoleInterface { - return &wrapRbacV1beta1ClusterRoleImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Resource: "clusterroles", - }), - } -} - -type wrapRbacV1beta1ClusterRoleImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedrbacv1beta1.ClusterRoleInterface = (*wrapRbacV1beta1ClusterRoleImpl)(nil) - -func (w *wrapRbacV1beta1ClusterRoleImpl) Apply(ctx context.Context, in *rbacv1beta1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.ClusterRole, err error) { - in.Kind = ptr.String("ClusterRole") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleImpl) ApplyStatus(ctx context.Context, in *rbacv1beta1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.ClusterRole, err error) { - in.Kind = ptr.String("ClusterRole") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleImpl) Create(ctx context.Context, in *apirbacv1beta1.ClusterRole, opts metav1.CreateOptions) (*apirbacv1beta1.ClusterRole, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Kind: "ClusterRole", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapRbacV1beta1ClusterRoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapRbacV1beta1ClusterRoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1beta1.ClusterRole, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1beta1.ClusterRoleList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRoleList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1beta1.ClusterRole, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleImpl) Update(ctx context.Context, in *apirbacv1beta1.ClusterRole, opts metav1.UpdateOptions) (*apirbacv1beta1.ClusterRole, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Kind: "ClusterRole", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleImpl) UpdateStatus(ctx context.Context, in *apirbacv1beta1.ClusterRole, opts metav1.UpdateOptions) (*apirbacv1beta1.ClusterRole, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Kind: "ClusterRole", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRole{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapRbacV1beta1) ClusterRoleBindings() typedrbacv1beta1.ClusterRoleBindingInterface { - return &wrapRbacV1beta1ClusterRoleBindingImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Resource: "clusterrolebindings", - }), - } -} - -type wrapRbacV1beta1ClusterRoleBindingImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedrbacv1beta1.ClusterRoleBindingInterface = (*wrapRbacV1beta1ClusterRoleBindingImpl)(nil) - -func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Apply(ctx context.Context, in *rbacv1beta1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.ClusterRoleBinding, err error) { - in.Kind = ptr.String("ClusterRoleBinding") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1beta1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.ClusterRoleBinding, err error) { - in.Kind = ptr.String("ClusterRoleBinding") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Create(ctx context.Context, in *apirbacv1beta1.ClusterRoleBinding, opts metav1.CreateOptions) (*apirbacv1beta1.ClusterRoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Kind: "ClusterRoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapRbacV1beta1ClusterRoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1beta1.ClusterRoleBinding, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1beta1.ClusterRoleBindingList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRoleBindingList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1beta1.ClusterRoleBinding, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Update(ctx context.Context, in *apirbacv1beta1.ClusterRoleBinding, opts metav1.UpdateOptions) (*apirbacv1beta1.ClusterRoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Kind: "ClusterRoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleBindingImpl) UpdateStatus(ctx context.Context, in *apirbacv1beta1.ClusterRoleBinding, opts metav1.UpdateOptions) (*apirbacv1beta1.ClusterRoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Kind: "ClusterRoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.ClusterRoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapRbacV1beta1) Roles(namespace string) typedrbacv1beta1.RoleInterface { - return &wrapRbacV1beta1RoleImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Resource: "roles", - }), - - namespace: namespace, - } -} - -type wrapRbacV1beta1RoleImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedrbacv1beta1.RoleInterface = (*wrapRbacV1beta1RoleImpl)(nil) - -func (w *wrapRbacV1beta1RoleImpl) Apply(ctx context.Context, in *rbacv1beta1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.Role, err error) { - in.Kind = ptr.String("Role") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleImpl) ApplyStatus(ctx context.Context, in *rbacv1beta1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.Role, err error) { - in.Kind = ptr.String("Role") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleImpl) Create(ctx context.Context, in *apirbacv1beta1.Role, opts metav1.CreateOptions) (*apirbacv1beta1.Role, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Kind: "Role", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapRbacV1beta1RoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapRbacV1beta1RoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1beta1.Role, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1beta1.RoleList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.RoleList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1beta1.Role, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleImpl) Update(ctx context.Context, in *apirbacv1beta1.Role, opts metav1.UpdateOptions) (*apirbacv1beta1.Role, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Kind: "Role", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleImpl) UpdateStatus(ctx context.Context, in *apirbacv1beta1.Role, opts metav1.UpdateOptions) (*apirbacv1beta1.Role, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Kind: "Role", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.Role{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapRbacV1beta1) RoleBindings(namespace string) typedrbacv1beta1.RoleBindingInterface { - return &wrapRbacV1beta1RoleBindingImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Resource: "rolebindings", - }), - - namespace: namespace, - } -} - -type wrapRbacV1beta1RoleBindingImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedrbacv1beta1.RoleBindingInterface = (*wrapRbacV1beta1RoleBindingImpl)(nil) - -func (w *wrapRbacV1beta1RoleBindingImpl) Apply(ctx context.Context, in *rbacv1beta1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.RoleBinding, err error) { - in.Kind = ptr.String("RoleBinding") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1beta1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.RoleBinding, err error) { - in.Kind = ptr.String("RoleBinding") - - in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleBindingImpl) Create(ctx context.Context, in *apirbacv1beta1.RoleBinding, opts metav1.CreateOptions) (*apirbacv1beta1.RoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Kind: "RoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapRbacV1beta1RoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapRbacV1beta1RoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1beta1.RoleBinding, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1beta1.RoleBindingList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.RoleBindingList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1beta1.RoleBinding, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleBindingImpl) Update(ctx context.Context, in *apirbacv1beta1.RoleBinding, opts metav1.UpdateOptions) (*apirbacv1beta1.RoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Kind: "RoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleBindingImpl) UpdateStatus(ctx context.Context, in *apirbacv1beta1.RoleBinding, opts metav1.UpdateOptions) (*apirbacv1beta1.RoleBinding, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "rbac.authorization.k8s.io", - Version: "v1beta1", - Kind: "RoleBinding", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apirbacv1beta1.RoleBinding{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapRbacV1beta1RoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// SchedulingV1 retrieves the SchedulingV1Client -func (w *wrapClient) SchedulingV1() typedschedulingv1.SchedulingV1Interface { - return &wrapSchedulingV1{ - dyn: w.dyn, - } -} - -type wrapSchedulingV1 struct { - dyn dynamic.Interface -} - -func (w *wrapSchedulingV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapSchedulingV1) PriorityClasses() typedschedulingv1.PriorityClassInterface { - return &wrapSchedulingV1PriorityClassImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "scheduling.k8s.io", - Version: "v1", - Resource: "priorityclasses", - }), - } -} - -type wrapSchedulingV1PriorityClassImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedschedulingv1.PriorityClassInterface = (*wrapSchedulingV1PriorityClassImpl)(nil) - -func (w *wrapSchedulingV1PriorityClassImpl) Apply(ctx context.Context, in *schedulingv1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1.PriorityClass, err error) { - in.Kind = ptr.String("PriorityClass") - - in.APIVersion = ptr.String("scheduling.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1PriorityClassImpl) ApplyStatus(ctx context.Context, in *schedulingv1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1.PriorityClass, err error) { - in.Kind = ptr.String("PriorityClass") - - in.APIVersion = ptr.String("scheduling.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1PriorityClassImpl) Create(ctx context.Context, in *apischedulingv1.PriorityClass, opts metav1.CreateOptions) (*apischedulingv1.PriorityClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "scheduling.k8s.io", - Version: "v1", - Kind: "PriorityClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1PriorityClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapSchedulingV1PriorityClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapSchedulingV1PriorityClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apischedulingv1.PriorityClass, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1PriorityClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apischedulingv1.PriorityClassList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1.PriorityClassList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1PriorityClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apischedulingv1.PriorityClass, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1PriorityClassImpl) Update(ctx context.Context, in *apischedulingv1.PriorityClass, opts metav1.UpdateOptions) (*apischedulingv1.PriorityClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "scheduling.k8s.io", - Version: "v1", - Kind: "PriorityClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1PriorityClassImpl) UpdateStatus(ctx context.Context, in *apischedulingv1.PriorityClass, opts metav1.UpdateOptions) (*apischedulingv1.PriorityClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "scheduling.k8s.io", - Version: "v1", - Kind: "PriorityClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1PriorityClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// SchedulingV1alpha1 retrieves the SchedulingV1alpha1Client -func (w *wrapClient) SchedulingV1alpha1() typedschedulingv1alpha1.SchedulingV1alpha1Interface { - return &wrapSchedulingV1alpha1{ - dyn: w.dyn, - } -} - -type wrapSchedulingV1alpha1 struct { - dyn dynamic.Interface -} - -func (w *wrapSchedulingV1alpha1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapSchedulingV1alpha1) PriorityClasses() typedschedulingv1alpha1.PriorityClassInterface { - return &wrapSchedulingV1alpha1PriorityClassImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "scheduling.k8s.io", - Version: "v1alpha1", - Resource: "priorityclasses", - }), - } -} - -type wrapSchedulingV1alpha1PriorityClassImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedschedulingv1alpha1.PriorityClassInterface = (*wrapSchedulingV1alpha1PriorityClassImpl)(nil) - -func (w *wrapSchedulingV1alpha1PriorityClassImpl) Apply(ctx context.Context, in *schedulingv1alpha1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1alpha1.PriorityClass, err error) { - in.Kind = ptr.String("PriorityClass") - - in.APIVersion = ptr.String("scheduling.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1alpha1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1alpha1PriorityClassImpl) ApplyStatus(ctx context.Context, in *schedulingv1alpha1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1alpha1.PriorityClass, err error) { - in.Kind = ptr.String("PriorityClass") - - in.APIVersion = ptr.String("scheduling.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1alpha1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1alpha1PriorityClassImpl) Create(ctx context.Context, in *apischedulingv1alpha1.PriorityClass, opts metav1.CreateOptions) (*apischedulingv1alpha1.PriorityClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "scheduling.k8s.io", - Version: "v1alpha1", - Kind: "PriorityClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1alpha1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1alpha1PriorityClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapSchedulingV1alpha1PriorityClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapSchedulingV1alpha1PriorityClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apischedulingv1alpha1.PriorityClass, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1alpha1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1alpha1PriorityClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apischedulingv1alpha1.PriorityClassList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1alpha1.PriorityClassList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1alpha1PriorityClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apischedulingv1alpha1.PriorityClass, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1alpha1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1alpha1PriorityClassImpl) Update(ctx context.Context, in *apischedulingv1alpha1.PriorityClass, opts metav1.UpdateOptions) (*apischedulingv1alpha1.PriorityClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "scheduling.k8s.io", - Version: "v1alpha1", - Kind: "PriorityClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1alpha1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1alpha1PriorityClassImpl) UpdateStatus(ctx context.Context, in *apischedulingv1alpha1.PriorityClass, opts metav1.UpdateOptions) (*apischedulingv1alpha1.PriorityClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "scheduling.k8s.io", - Version: "v1alpha1", - Kind: "PriorityClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1alpha1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1alpha1PriorityClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// SchedulingV1beta1 retrieves the SchedulingV1beta1Client -func (w *wrapClient) SchedulingV1beta1() typedschedulingv1beta1.SchedulingV1beta1Interface { - return &wrapSchedulingV1beta1{ - dyn: w.dyn, - } -} - -type wrapSchedulingV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapSchedulingV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapSchedulingV1beta1) PriorityClasses() typedschedulingv1beta1.PriorityClassInterface { - return &wrapSchedulingV1beta1PriorityClassImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "scheduling.k8s.io", - Version: "v1beta1", - Resource: "priorityclasses", - }), - } -} - -type wrapSchedulingV1beta1PriorityClassImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedschedulingv1beta1.PriorityClassInterface = (*wrapSchedulingV1beta1PriorityClassImpl)(nil) - -func (w *wrapSchedulingV1beta1PriorityClassImpl) Apply(ctx context.Context, in *schedulingv1beta1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1beta1.PriorityClass, err error) { - in.Kind = ptr.String("PriorityClass") - - in.APIVersion = ptr.String("scheduling.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1beta1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1beta1PriorityClassImpl) ApplyStatus(ctx context.Context, in *schedulingv1beta1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1beta1.PriorityClass, err error) { - in.Kind = ptr.String("PriorityClass") - - in.APIVersion = ptr.String("scheduling.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1beta1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1beta1PriorityClassImpl) Create(ctx context.Context, in *apischedulingv1beta1.PriorityClass, opts metav1.CreateOptions) (*apischedulingv1beta1.PriorityClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "scheduling.k8s.io", - Version: "v1beta1", - Kind: "PriorityClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1beta1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1beta1PriorityClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapSchedulingV1beta1PriorityClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapSchedulingV1beta1PriorityClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apischedulingv1beta1.PriorityClass, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1beta1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1beta1PriorityClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apischedulingv1beta1.PriorityClassList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1beta1.PriorityClassList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1beta1PriorityClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apischedulingv1beta1.PriorityClass, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1beta1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1beta1PriorityClassImpl) Update(ctx context.Context, in *apischedulingv1beta1.PriorityClass, opts metav1.UpdateOptions) (*apischedulingv1beta1.PriorityClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "scheduling.k8s.io", - Version: "v1beta1", - Kind: "PriorityClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1beta1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1beta1PriorityClassImpl) UpdateStatus(ctx context.Context, in *apischedulingv1beta1.PriorityClass, opts metav1.UpdateOptions) (*apischedulingv1beta1.PriorityClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "scheduling.k8s.io", - Version: "v1beta1", - Kind: "PriorityClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apischedulingv1beta1.PriorityClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapSchedulingV1beta1PriorityClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// StorageV1 retrieves the StorageV1Client -func (w *wrapClient) StorageV1() typedstoragev1.StorageV1Interface { - return &wrapStorageV1{ - dyn: w.dyn, - } -} - -type wrapStorageV1 struct { - dyn dynamic.Interface -} - -func (w *wrapStorageV1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapStorageV1) CSIDrivers() typedstoragev1.CSIDriverInterface { - return &wrapStorageV1CSIDriverImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "storage.k8s.io", - Version: "v1", - Resource: "csidrivers", - }), - } -} - -type wrapStorageV1CSIDriverImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedstoragev1.CSIDriverInterface = (*wrapStorageV1CSIDriverImpl)(nil) - -func (w *wrapStorageV1CSIDriverImpl) Apply(ctx context.Context, in *storagev1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSIDriver, err error) { - in.Kind = ptr.String("CSIDriver") - - in.APIVersion = ptr.String("storage.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIDriverImpl) ApplyStatus(ctx context.Context, in *storagev1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSIDriver, err error) { - in.Kind = ptr.String("CSIDriver") - - in.APIVersion = ptr.String("storage.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIDriverImpl) Create(ctx context.Context, in *apistoragev1.CSIDriver, opts metav1.CreateOptions) (*apistoragev1.CSIDriver, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "CSIDriver", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIDriverImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapStorageV1CSIDriverImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapStorageV1CSIDriverImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1.CSIDriver, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIDriverImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1.CSIDriverList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIDriverList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIDriverImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1.CSIDriver, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIDriverImpl) Update(ctx context.Context, in *apistoragev1.CSIDriver, opts metav1.UpdateOptions) (*apistoragev1.CSIDriver, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "CSIDriver", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIDriverImpl) UpdateStatus(ctx context.Context, in *apistoragev1.CSIDriver, opts metav1.UpdateOptions) (*apistoragev1.CSIDriver, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "CSIDriver", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIDriverImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapStorageV1) CSINodes() typedstoragev1.CSINodeInterface { - return &wrapStorageV1CSINodeImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "storage.k8s.io", - Version: "v1", - Resource: "csinodes", - }), - } -} - -type wrapStorageV1CSINodeImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedstoragev1.CSINodeInterface = (*wrapStorageV1CSINodeImpl)(nil) - -func (w *wrapStorageV1CSINodeImpl) Apply(ctx context.Context, in *storagev1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSINode, err error) { - in.Kind = ptr.String("CSINode") - - in.APIVersion = ptr.String("storage.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSINodeImpl) ApplyStatus(ctx context.Context, in *storagev1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSINode, err error) { - in.Kind = ptr.String("CSINode") - - in.APIVersion = ptr.String("storage.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSINodeImpl) Create(ctx context.Context, in *apistoragev1.CSINode, opts metav1.CreateOptions) (*apistoragev1.CSINode, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "CSINode", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSINodeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapStorageV1CSINodeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapStorageV1CSINodeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1.CSINode, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSINodeImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1.CSINodeList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSINodeList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSINodeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1.CSINode, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSINodeImpl) Update(ctx context.Context, in *apistoragev1.CSINode, opts metav1.UpdateOptions) (*apistoragev1.CSINode, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "CSINode", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSINodeImpl) UpdateStatus(ctx context.Context, in *apistoragev1.CSINode, opts metav1.UpdateOptions) (*apistoragev1.CSINode, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "CSINode", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSINodeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapStorageV1) CSIStorageCapacities(namespace string) typedstoragev1.CSIStorageCapacityInterface { - return &wrapStorageV1CSIStorageCapacityImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "storage.k8s.io", - Version: "v1", - Resource: "csistoragecapacities", - }), - - namespace: namespace, - } -} - -type wrapStorageV1CSIStorageCapacityImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedstoragev1.CSIStorageCapacityInterface = (*wrapStorageV1CSIStorageCapacityImpl)(nil) - -func (w *wrapStorageV1CSIStorageCapacityImpl) Apply(ctx context.Context, in *storagev1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSIStorageCapacity, err error) { - in.Kind = ptr.String("CSIStorageCapacity") - - in.APIVersion = ptr.String("storage.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIStorageCapacityImpl) ApplyStatus(ctx context.Context, in *storagev1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSIStorageCapacity, err error) { - in.Kind = ptr.String("CSIStorageCapacity") - - in.APIVersion = ptr.String("storage.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIStorageCapacityImpl) Create(ctx context.Context, in *apistoragev1.CSIStorageCapacity, opts metav1.CreateOptions) (*apistoragev1.CSIStorageCapacity, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "CSIStorageCapacity", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIStorageCapacityImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapStorageV1CSIStorageCapacityImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapStorageV1CSIStorageCapacityImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1.CSIStorageCapacity, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIStorageCapacityImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1.CSIStorageCapacityList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIStorageCapacityList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIStorageCapacityImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1.CSIStorageCapacity, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIStorageCapacityImpl) Update(ctx context.Context, in *apistoragev1.CSIStorageCapacity, opts metav1.UpdateOptions) (*apistoragev1.CSIStorageCapacity, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "CSIStorageCapacity", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIStorageCapacityImpl) UpdateStatus(ctx context.Context, in *apistoragev1.CSIStorageCapacity, opts metav1.UpdateOptions) (*apistoragev1.CSIStorageCapacity, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "CSIStorageCapacity", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1CSIStorageCapacityImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapStorageV1) StorageClasses() typedstoragev1.StorageClassInterface { - return &wrapStorageV1StorageClassImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "storage.k8s.io", - Version: "v1", - Resource: "storageclasses", - }), - } -} - -type wrapStorageV1StorageClassImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedstoragev1.StorageClassInterface = (*wrapStorageV1StorageClassImpl)(nil) - -func (w *wrapStorageV1StorageClassImpl) Apply(ctx context.Context, in *storagev1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.StorageClass, err error) { - in.Kind = ptr.String("StorageClass") - - in.APIVersion = ptr.String("storage.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1StorageClassImpl) ApplyStatus(ctx context.Context, in *storagev1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.StorageClass, err error) { - in.Kind = ptr.String("StorageClass") - - in.APIVersion = ptr.String("storage.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1StorageClassImpl) Create(ctx context.Context, in *apistoragev1.StorageClass, opts metav1.CreateOptions) (*apistoragev1.StorageClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "StorageClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1StorageClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapStorageV1StorageClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapStorageV1StorageClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1.StorageClass, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1StorageClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1.StorageClassList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.StorageClassList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1StorageClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1.StorageClass, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1StorageClassImpl) Update(ctx context.Context, in *apistoragev1.StorageClass, opts metav1.UpdateOptions) (*apistoragev1.StorageClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "StorageClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1StorageClassImpl) UpdateStatus(ctx context.Context, in *apistoragev1.StorageClass, opts metav1.UpdateOptions) (*apistoragev1.StorageClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "StorageClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1StorageClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapStorageV1) VolumeAttachments() typedstoragev1.VolumeAttachmentInterface { - return &wrapStorageV1VolumeAttachmentImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "storage.k8s.io", - Version: "v1", - Resource: "volumeattachments", - }), - } -} - -type wrapStorageV1VolumeAttachmentImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedstoragev1.VolumeAttachmentInterface = (*wrapStorageV1VolumeAttachmentImpl)(nil) - -func (w *wrapStorageV1VolumeAttachmentImpl) Apply(ctx context.Context, in *storagev1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.VolumeAttachment, err error) { - in.Kind = ptr.String("VolumeAttachment") - - in.APIVersion = ptr.String("storage.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1VolumeAttachmentImpl) ApplyStatus(ctx context.Context, in *storagev1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.VolumeAttachment, err error) { - in.Kind = ptr.String("VolumeAttachment") - - in.APIVersion = ptr.String("storage.k8s.io/v1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1VolumeAttachmentImpl) Create(ctx context.Context, in *apistoragev1.VolumeAttachment, opts metav1.CreateOptions) (*apistoragev1.VolumeAttachment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "VolumeAttachment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1VolumeAttachmentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapStorageV1VolumeAttachmentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapStorageV1VolumeAttachmentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1.VolumeAttachment, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1VolumeAttachmentImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1.VolumeAttachmentList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.VolumeAttachmentList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1VolumeAttachmentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1.VolumeAttachment, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1VolumeAttachmentImpl) Update(ctx context.Context, in *apistoragev1.VolumeAttachment, opts metav1.UpdateOptions) (*apistoragev1.VolumeAttachment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "VolumeAttachment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1VolumeAttachmentImpl) UpdateStatus(ctx context.Context, in *apistoragev1.VolumeAttachment, opts metav1.UpdateOptions) (*apistoragev1.VolumeAttachment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1", - Kind: "VolumeAttachment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1VolumeAttachmentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// StorageV1alpha1 retrieves the StorageV1alpha1Client -func (w *wrapClient) StorageV1alpha1() typedstoragev1alpha1.StorageV1alpha1Interface { - return &wrapStorageV1alpha1{ - dyn: w.dyn, - } -} - -type wrapStorageV1alpha1 struct { - dyn dynamic.Interface -} - -func (w *wrapStorageV1alpha1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapStorageV1alpha1) CSIStorageCapacities(namespace string) typedstoragev1alpha1.CSIStorageCapacityInterface { - return &wrapStorageV1alpha1CSIStorageCapacityImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "storage.k8s.io", - Version: "v1alpha1", - Resource: "csistoragecapacities", - }), - - namespace: namespace, - } -} - -type wrapStorageV1alpha1CSIStorageCapacityImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedstoragev1alpha1.CSIStorageCapacityInterface = (*wrapStorageV1alpha1CSIStorageCapacityImpl)(nil) - -func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Apply(ctx context.Context, in *storagev1alpha1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1alpha1.CSIStorageCapacity, err error) { - in.Kind = ptr.String("CSIStorageCapacity") - - in.APIVersion = ptr.String("storage.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) ApplyStatus(ctx context.Context, in *storagev1alpha1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1alpha1.CSIStorageCapacity, err error) { - in.Kind = ptr.String("CSIStorageCapacity") - - in.APIVersion = ptr.String("storage.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Create(ctx context.Context, in *apistoragev1alpha1.CSIStorageCapacity, opts metav1.CreateOptions) (*apistoragev1alpha1.CSIStorageCapacity, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1alpha1", - Kind: "CSIStorageCapacity", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1alpha1.CSIStorageCapacity, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1alpha1.CSIStorageCapacityList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.CSIStorageCapacityList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1alpha1.CSIStorageCapacity, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Update(ctx context.Context, in *apistoragev1alpha1.CSIStorageCapacity, opts metav1.UpdateOptions) (*apistoragev1alpha1.CSIStorageCapacity, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1alpha1", - Kind: "CSIStorageCapacity", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) UpdateStatus(ctx context.Context, in *apistoragev1alpha1.CSIStorageCapacity, opts metav1.UpdateOptions) (*apistoragev1alpha1.CSIStorageCapacity, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1alpha1", - Kind: "CSIStorageCapacity", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapStorageV1alpha1) VolumeAttachments() typedstoragev1alpha1.VolumeAttachmentInterface { - return &wrapStorageV1alpha1VolumeAttachmentImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "storage.k8s.io", - Version: "v1alpha1", - Resource: "volumeattachments", - }), - } -} - -type wrapStorageV1alpha1VolumeAttachmentImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedstoragev1alpha1.VolumeAttachmentInterface = (*wrapStorageV1alpha1VolumeAttachmentImpl)(nil) - -func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Apply(ctx context.Context, in *storagev1alpha1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1alpha1.VolumeAttachment, err error) { - in.Kind = ptr.String("VolumeAttachment") - - in.APIVersion = ptr.String("storage.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1VolumeAttachmentImpl) ApplyStatus(ctx context.Context, in *storagev1alpha1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1alpha1.VolumeAttachment, err error) { - in.Kind = ptr.String("VolumeAttachment") - - in.APIVersion = ptr.String("storage.k8s.io/v1alpha1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Create(ctx context.Context, in *apistoragev1alpha1.VolumeAttachment, opts metav1.CreateOptions) (*apistoragev1alpha1.VolumeAttachment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1alpha1", - Kind: "VolumeAttachment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapStorageV1alpha1VolumeAttachmentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1alpha1.VolumeAttachment, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1VolumeAttachmentImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1alpha1.VolumeAttachmentList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.VolumeAttachmentList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1alpha1.VolumeAttachment, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Update(ctx context.Context, in *apistoragev1alpha1.VolumeAttachment, opts metav1.UpdateOptions) (*apistoragev1alpha1.VolumeAttachment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1alpha1", - Kind: "VolumeAttachment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1VolumeAttachmentImpl) UpdateStatus(ctx context.Context, in *apistoragev1alpha1.VolumeAttachment, opts metav1.UpdateOptions) (*apistoragev1alpha1.VolumeAttachment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1alpha1", - Kind: "VolumeAttachment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1alpha1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -// StorageV1beta1 retrieves the StorageV1beta1Client -func (w *wrapClient) StorageV1beta1() typedstoragev1beta1.StorageV1beta1Interface { - return &wrapStorageV1beta1{ - dyn: w.dyn, - } -} - -type wrapStorageV1beta1 struct { - dyn dynamic.Interface -} - -func (w *wrapStorageV1beta1) RESTClient() rest.Interface { - panic("RESTClient called on dynamic client!") -} - -func (w *wrapStorageV1beta1) CSIDrivers() typedstoragev1beta1.CSIDriverInterface { - return &wrapStorageV1beta1CSIDriverImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "storage.k8s.io", - Version: "v1beta1", - Resource: "csidrivers", - }), - } -} - -type wrapStorageV1beta1CSIDriverImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedstoragev1beta1.CSIDriverInterface = (*wrapStorageV1beta1CSIDriverImpl)(nil) - -func (w *wrapStorageV1beta1CSIDriverImpl) Apply(ctx context.Context, in *storagev1beta1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSIDriver, err error) { - in.Kind = ptr.String("CSIDriver") - - in.APIVersion = ptr.String("storage.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIDriverImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSIDriver, err error) { - in.Kind = ptr.String("CSIDriver") - - in.APIVersion = ptr.String("storage.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIDriverImpl) Create(ctx context.Context, in *apistoragev1beta1.CSIDriver, opts metav1.CreateOptions) (*apistoragev1beta1.CSIDriver, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "CSIDriver", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIDriverImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapStorageV1beta1CSIDriverImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapStorageV1beta1CSIDriverImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1beta1.CSIDriver, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIDriverImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1beta1.CSIDriverList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIDriverList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIDriverImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1beta1.CSIDriver, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIDriverImpl) Update(ctx context.Context, in *apistoragev1beta1.CSIDriver, opts metav1.UpdateOptions) (*apistoragev1beta1.CSIDriver, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "CSIDriver", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIDriverImpl) UpdateStatus(ctx context.Context, in *apistoragev1beta1.CSIDriver, opts metav1.UpdateOptions) (*apistoragev1beta1.CSIDriver, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "CSIDriver", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIDriver{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIDriverImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapStorageV1beta1) CSINodes() typedstoragev1beta1.CSINodeInterface { - return &wrapStorageV1beta1CSINodeImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "storage.k8s.io", - Version: "v1beta1", - Resource: "csinodes", - }), - } -} - -type wrapStorageV1beta1CSINodeImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedstoragev1beta1.CSINodeInterface = (*wrapStorageV1beta1CSINodeImpl)(nil) - -func (w *wrapStorageV1beta1CSINodeImpl) Apply(ctx context.Context, in *storagev1beta1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSINode, err error) { - in.Kind = ptr.String("CSINode") - - in.APIVersion = ptr.String("storage.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSINodeImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSINode, err error) { - in.Kind = ptr.String("CSINode") - - in.APIVersion = ptr.String("storage.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSINodeImpl) Create(ctx context.Context, in *apistoragev1beta1.CSINode, opts metav1.CreateOptions) (*apistoragev1beta1.CSINode, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "CSINode", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSINodeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapStorageV1beta1CSINodeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapStorageV1beta1CSINodeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1beta1.CSINode, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSINodeImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1beta1.CSINodeList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSINodeList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSINodeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1beta1.CSINode, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSINodeImpl) Update(ctx context.Context, in *apistoragev1beta1.CSINode, opts metav1.UpdateOptions) (*apistoragev1beta1.CSINode, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "CSINode", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSINodeImpl) UpdateStatus(ctx context.Context, in *apistoragev1beta1.CSINode, opts metav1.UpdateOptions) (*apistoragev1beta1.CSINode, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "CSINode", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSINode{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSINodeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapStorageV1beta1) CSIStorageCapacities(namespace string) typedstoragev1beta1.CSIStorageCapacityInterface { - return &wrapStorageV1beta1CSIStorageCapacityImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "storage.k8s.io", - Version: "v1beta1", - Resource: "csistoragecapacities", - }), - - namespace: namespace, - } -} - -type wrapStorageV1beta1CSIStorageCapacityImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedstoragev1beta1.CSIStorageCapacityInterface = (*wrapStorageV1beta1CSIStorageCapacityImpl)(nil) - -func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Apply(ctx context.Context, in *storagev1beta1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSIStorageCapacity, err error) { - in.Kind = ptr.String("CSIStorageCapacity") - - in.APIVersion = ptr.String("storage.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIStorageCapacityImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSIStorageCapacity, err error) { - in.Kind = ptr.String("CSIStorageCapacity") - - in.APIVersion = ptr.String("storage.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Create(ctx context.Context, in *apistoragev1beta1.CSIStorageCapacity, opts metav1.CreateOptions) (*apistoragev1beta1.CSIStorageCapacity, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "CSIStorageCapacity", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} - -func (w *wrapStorageV1beta1CSIStorageCapacityImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1beta1.CSIStorageCapacity, error) { - uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIStorageCapacityImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1beta1.CSIStorageCapacityList, error) { - uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIStorageCapacityList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1beta1.CSIStorageCapacity, err error) { - uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Update(ctx context.Context, in *apistoragev1beta1.CSIStorageCapacity, opts metav1.UpdateOptions) (*apistoragev1beta1.CSIStorageCapacity, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "CSIStorageCapacity", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIStorageCapacityImpl) UpdateStatus(ctx context.Context, in *apistoragev1beta1.CSIStorageCapacity, opts metav1.UpdateOptions) (*apistoragev1beta1.CSIStorageCapacity, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "CSIStorageCapacity", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.CSIStorageCapacity{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapStorageV1beta1) StorageClasses() typedstoragev1beta1.StorageClassInterface { - return &wrapStorageV1beta1StorageClassImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "storage.k8s.io", - Version: "v1beta1", - Resource: "storageclasses", - }), - } -} - -type wrapStorageV1beta1StorageClassImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedstoragev1beta1.StorageClassInterface = (*wrapStorageV1beta1StorageClassImpl)(nil) - -func (w *wrapStorageV1beta1StorageClassImpl) Apply(ctx context.Context, in *storagev1beta1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.StorageClass, err error) { - in.Kind = ptr.String("StorageClass") - - in.APIVersion = ptr.String("storage.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1StorageClassImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.StorageClass, err error) { - in.Kind = ptr.String("StorageClass") - - in.APIVersion = ptr.String("storage.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1StorageClassImpl) Create(ctx context.Context, in *apistoragev1beta1.StorageClass, opts metav1.CreateOptions) (*apistoragev1beta1.StorageClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "StorageClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1StorageClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapStorageV1beta1StorageClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapStorageV1beta1StorageClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1beta1.StorageClass, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1StorageClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1beta1.StorageClassList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.StorageClassList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1StorageClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1beta1.StorageClass, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1StorageClassImpl) Update(ctx context.Context, in *apistoragev1beta1.StorageClass, opts metav1.UpdateOptions) (*apistoragev1beta1.StorageClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "StorageClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1StorageClassImpl) UpdateStatus(ctx context.Context, in *apistoragev1beta1.StorageClass, opts metav1.UpdateOptions) (*apistoragev1beta1.StorageClass, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "StorageClass", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.StorageClass{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1StorageClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} - -func (w *wrapStorageV1beta1) VolumeAttachments() typedstoragev1beta1.VolumeAttachmentInterface { - return &wrapStorageV1beta1VolumeAttachmentImpl{ - dyn: w.dyn.Resource(schema.GroupVersionResource{ - Group: "storage.k8s.io", - Version: "v1beta1", - Resource: "volumeattachments", - }), - } -} - -type wrapStorageV1beta1VolumeAttachmentImpl struct { - dyn dynamic.NamespaceableResourceInterface -} - -var _ typedstoragev1beta1.VolumeAttachmentInterface = (*wrapStorageV1beta1VolumeAttachmentImpl)(nil) - -func (w *wrapStorageV1beta1VolumeAttachmentImpl) Apply(ctx context.Context, in *storagev1beta1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.VolumeAttachment, err error) { - in.Kind = ptr.String("VolumeAttachment") - - in.APIVersion = ptr.String("storage.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1VolumeAttachmentImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.VolumeAttachment, err error) { - in.Kind = ptr.String("VolumeAttachment") - - in.APIVersion = ptr.String("storage.k8s.io/v1beta1") - - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1VolumeAttachmentImpl) Create(ctx context.Context, in *apistoragev1beta1.VolumeAttachment, opts metav1.CreateOptions) (*apistoragev1beta1.VolumeAttachment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "VolumeAttachment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1VolumeAttachmentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Delete(ctx, name, opts) -} - -func (w *wrapStorageV1beta1VolumeAttachmentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return w.dyn.DeleteCollection(ctx, opts, listOpts) -} - -func (w *wrapStorageV1beta1VolumeAttachmentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1beta1.VolumeAttachment, error) { - uo, err := w.dyn.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1VolumeAttachmentImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1beta1.VolumeAttachmentList, error) { - uo, err := w.dyn.List(ctx, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.VolumeAttachmentList{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1VolumeAttachmentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1beta1.VolumeAttachment, err error) { - uo, err := w.dyn.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1VolumeAttachmentImpl) Update(ctx context.Context, in *apistoragev1beta1.VolumeAttachment, opts metav1.UpdateOptions) (*apistoragev1beta1.VolumeAttachment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "VolumeAttachment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1VolumeAttachmentImpl) UpdateStatus(ctx context.Context, in *apistoragev1beta1.VolumeAttachment, opts metav1.UpdateOptions) (*apistoragev1beta1.VolumeAttachment, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "storage.k8s.io", - Version: "v1beta1", - Kind: "VolumeAttachment", - }) - uo := &unstructured.Unstructured{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &apistoragev1beta1.VolumeAttachment{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} - -func (w *wrapStorageV1beta1VolumeAttachmentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return nil, errors.New("NYI: Watch") -} diff --git a/vendor/knative.dev/pkg/client/injection/kube/client/client_expansion.go b/vendor/knative.dev/pkg/client/injection/kube/client/client_expansion.go deleted file mode 100644 index 56329f3965..0000000000 --- a/vendor/knative.dev/pkg/client/injection/kube/client/client_expansion.go +++ /dev/null @@ -1,160 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package client - -import ( - context "context" - fmt "fmt" - - certificatesv1beta1 "k8s.io/api/certificates/v1beta1" - corev1 "k8s.io/api/core/v1" - eventsv1beta1 "k8s.io/api/events/v1beta1" - extensionsv1beta1 "k8s.io/api/extensions/v1beta1" - policyv1 "k8s.io/api/policy/v1" - policyv1beta1 "k8s.io/api/policy/v1beta1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/types" - restclient "k8s.io/client-go/rest" -) - -func (*wrapCoreV1NamespaceImpl) Finalize(context.Context, *corev1.Namespace, metav1.UpdateOptions) (*corev1.Namespace, error) { - panic("NYI") -} - -func (*wrapCoreV1ServiceImpl) ProxyGet(string, string, string, string, map[string]string) restclient.ResponseWrapper { - panic("NYI") -} - -func (e *wrapEventsV1beta1EventImpl) CreateWithEventNamespace(event *eventsv1beta1.Event) (*eventsv1beta1.Event, error) { - if e.namespace != "" && event.Namespace != e.namespace { - return nil, fmt.Errorf("can't create an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace) - } - ne := &wrapEventsV1beta1EventImpl{ - dyn: e.dyn, - namespace: event.Namespace, - } - return ne.Create(context.TODO(), event, metav1.CreateOptions{}) -} - -func (e *wrapEventsV1beta1EventImpl) UpdateWithEventNamespace(event *eventsv1beta1.Event) (*eventsv1beta1.Event, error) { - if e.namespace != "" && event.Namespace != e.namespace { - return nil, fmt.Errorf("can't update an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace) - } - ne := &wrapEventsV1beta1EventImpl{ - dyn: e.dyn, - namespace: event.Namespace, - } - return ne.Update(context.TODO(), event, metav1.UpdateOptions{}) -} - -func (e *wrapEventsV1beta1EventImpl) PatchWithEventNamespace(event *eventsv1beta1.Event, bytes []byte) (*eventsv1beta1.Event, error) { - if e.namespace != "" && event.Namespace != e.namespace { - return nil, fmt.Errorf("can't patch an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace) - } - ne := &wrapEventsV1beta1EventImpl{ - dyn: e.dyn, - namespace: event.Namespace, - } - return ne.Patch(context.TODO(), event.Name, types.StrategicMergePatchType, bytes, metav1.PatchOptions{}) -} - -func (e *wrapCoreV1EventImpl) CreateWithEventNamespace(event *corev1.Event) (*corev1.Event, error) { - if e.namespace != "" && event.Namespace != e.namespace { - return nil, fmt.Errorf("can't create an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace) - } - ne := &wrapCoreV1EventImpl{ - dyn: e.dyn, - namespace: event.Namespace, - } - return ne.Create(context.TODO(), event, metav1.CreateOptions{}) -} - -func (e *wrapCoreV1EventImpl) UpdateWithEventNamespace(event *corev1.Event) (*corev1.Event, error) { - if e.namespace != "" && event.Namespace != e.namespace { - return nil, fmt.Errorf("can't update an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace) - } - ne := &wrapCoreV1EventImpl{ - dyn: e.dyn, - namespace: event.Namespace, - } - return ne.Update(context.TODO(), event, metav1.UpdateOptions{}) -} - -func (e *wrapCoreV1EventImpl) PatchWithEventNamespace(event *corev1.Event, bytes []byte) (*corev1.Event, error) { - if e.namespace != "" && event.Namespace != e.namespace { - return nil, fmt.Errorf("can't patch an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace) - } - ne := &wrapCoreV1EventImpl{ - dyn: e.dyn, - namespace: event.Namespace, - } - return ne.Patch(context.TODO(), event.Name, types.StrategicMergePatchType, bytes, metav1.PatchOptions{}) -} - -func (*wrapCoreV1EventImpl) Search(*runtime.Scheme, runtime.Object) (*corev1.EventList, error) { - panic("NYI") -} - -func (*wrapCoreV1EventImpl) GetFieldSelector(*string, *string, *string, *string) fields.Selector { - panic("NYI") -} - -func (*wrapCoreV1NodeImpl) PatchStatus(context.Context, string, []byte) (*corev1.Node, error) { - panic("NYI") -} - -func (*wrapCoreV1PodImpl) Bind(context.Context, *corev1.Binding, metav1.CreateOptions) error { - panic("NYI") -} - -func (*wrapCoreV1PodImpl) Evict(context.Context, *policyv1beta1.Eviction) error { - panic("NYI") -} - -func (*wrapCoreV1PodImpl) EvictV1(context.Context, *policyv1.Eviction) error { - panic("NYI") -} - -func (*wrapCoreV1PodImpl) EvictV1beta1(context.Context, *policyv1beta1.Eviction) error { - panic("NYI") -} - -func (c *wrapPolicyV1EvictionImpl) Evict(ctx context.Context, eviction *policyv1.Eviction) error { - panic("NYI") -} - -func (*wrapCoreV1PodImpl) GetLogs(string, *corev1.PodLogOptions) *restclient.Request { - panic("NYI") -} - -func (*wrapCoreV1PodImpl) ProxyGet(string, string, string, string, map[string]string) restclient.ResponseWrapper { - panic("NYI") -} - -func (*wrapExtensionsV1beta1DeploymentImpl) Rollback(context.Context, *extensionsv1beta1.DeploymentRollback, metav1.CreateOptions) error { - panic("NYI") -} - -func (*wrapPolicyV1beta1EvictionImpl) Evict(context.Context, *policyv1beta1.Eviction) error { - panic("NYI") -} - -func (*wrapCertificatesV1beta1CertificateSigningRequestImpl) UpdateApproval(context.Context, *certificatesv1beta1.CertificateSigningRequest, metav1.UpdateOptions) (*certificatesv1beta1.CertificateSigningRequest, error) { - panic("NYI") -} diff --git a/vendor/knative.dev/pkg/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/mutatingwebhookconfiguration.go b/vendor/knative.dev/pkg/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/mutatingwebhookconfiguration.go index 9c395d26e4..5efacd2979 100644 --- a/vendor/knative.dev/pkg/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/mutatingwebhookconfiguration.go +++ b/vendor/knative.dev/pkg/client/injection/kube/informers/admissionregistration/v1/mutatingwebhookconfiguration/mutatingwebhookconfiguration.go @@ -21,14 +21,7 @@ package mutatingwebhookconfiguration import ( context "context" - apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/admissionregistration/v1" - kubernetes "k8s.io/client-go/kubernetes" - admissionregistrationv1 "k8s.io/client-go/listers/admissionregistration/v1" - cache "k8s.io/client-go/tools/cache" - client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.MutatingWebhookConfigurationInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1.MutatingWebhookConfigurationInformer { } return untyped.(v1.MutatingWebhookConfigurationInformer) } - -type wrapper struct { - client kubernetes.Interface - - resourceVersion string -} - -var _ v1.MutatingWebhookConfigurationInformer = (*wrapper)(nil) -var _ admissionregistrationv1.MutatingWebhookConfigurationLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apiadmissionregistrationv1.MutatingWebhookConfiguration{}, 0, nil) -} - -func (w *wrapper) Lister() admissionregistrationv1.MutatingWebhookConfigurationLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apiadmissionregistrationv1.MutatingWebhookConfiguration, err error) { - lo, err := w.client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(context.TODO(), metav1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apiadmissionregistrationv1.MutatingWebhookConfiguration, error) { - return w.client.AdmissionregistrationV1().MutatingWebhookConfigurations().Get(context.TODO(), name, metav1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/vendor/knative.dev/pkg/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/validatingwebhookconfiguration.go b/vendor/knative.dev/pkg/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/validatingwebhookconfiguration.go index f4fee2dfd5..e8a23f7174 100644 --- a/vendor/knative.dev/pkg/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/validatingwebhookconfiguration.go +++ b/vendor/knative.dev/pkg/client/injection/kube/informers/admissionregistration/v1/validatingwebhookconfiguration/validatingwebhookconfiguration.go @@ -21,14 +21,7 @@ package validatingwebhookconfiguration import ( context "context" - apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/admissionregistration/v1" - kubernetes "k8s.io/client-go/kubernetes" - admissionregistrationv1 "k8s.io/client-go/listers/admissionregistration/v1" - cache "k8s.io/client-go/tools/cache" - client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ValidatingWebhookConfigurationInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1.ValidatingWebhookConfigurationInformer { } return untyped.(v1.ValidatingWebhookConfigurationInformer) } - -type wrapper struct { - client kubernetes.Interface - - resourceVersion string -} - -var _ v1.ValidatingWebhookConfigurationInformer = (*wrapper)(nil) -var _ admissionregistrationv1.ValidatingWebhookConfigurationLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apiadmissionregistrationv1.ValidatingWebhookConfiguration{}, 0, nil) -} - -func (w *wrapper) Lister() admissionregistrationv1.ValidatingWebhookConfigurationLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apiadmissionregistrationv1.ValidatingWebhookConfiguration, err error) { - lo, err := w.client.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(context.TODO(), metav1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apiadmissionregistrationv1.ValidatingWebhookConfiguration, error) { - return w.client.AdmissionregistrationV1().ValidatingWebhookConfigurations().Get(context.TODO(), name, metav1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/vendor/knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/deployment.go b/vendor/knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/deployment.go index b79329e9e2..9b34756a27 100644 --- a/vendor/knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/deployment.go +++ b/vendor/knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/deployment.go @@ -21,14 +21,7 @@ package deployment import ( context "context" - apiappsv1 "k8s.io/api/apps/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/apps/v1" - kubernetes "k8s.io/client-go/kubernetes" - appsv1 "k8s.io/client-go/listers/apps/v1" - cache "k8s.io/client-go/tools/cache" - client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.DeploymentInformer { untyped := ctx.Value(Key{}) @@ -63,54 +50,3 @@ func Get(ctx context.Context) v1.DeploymentInformer { } return untyped.(v1.DeploymentInformer) } - -type wrapper struct { - client kubernetes.Interface - - namespace string - - resourceVersion string -} - -var _ v1.DeploymentInformer = (*wrapper)(nil) -var _ appsv1.DeploymentLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apiappsv1.Deployment{}, 0, nil) -} - -func (w *wrapper) Lister() appsv1.DeploymentLister { - return w -} - -func (w *wrapper) Deployments(namespace string) appsv1.DeploymentNamespaceLister { - return &wrapper{client: w.client, namespace: namespace, resourceVersion: w.resourceVersion} -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apiappsv1.Deployment, err error) { - lo, err := w.client.AppsV1().Deployments(w.namespace).List(context.TODO(), metav1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apiappsv1.Deployment, error) { - return w.client.AppsV1().Deployments(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/vendor/knative.dev/pkg/client/injection/kube/informers/core/v1/namespace/namespace.go b/vendor/knative.dev/pkg/client/injection/kube/informers/core/v1/namespace/namespace.go index aa57e789f0..84a6bf6283 100644 --- a/vendor/knative.dev/pkg/client/injection/kube/informers/core/v1/namespace/namespace.go +++ b/vendor/knative.dev/pkg/client/injection/kube/informers/core/v1/namespace/namespace.go @@ -21,14 +21,7 @@ package namespace import ( context "context" - apicorev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" - kubernetes "k8s.io/client-go/kubernetes" - corev1 "k8s.io/client-go/listers/core/v1" - cache "k8s.io/client-go/tools/cache" - client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.NamespaceInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1.NamespaceInformer { } return untyped.(v1.NamespaceInformer) } - -type wrapper struct { - client kubernetes.Interface - - resourceVersion string -} - -var _ v1.NamespaceInformer = (*wrapper)(nil) -var _ corev1.NamespaceLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apicorev1.Namespace{}, 0, nil) -} - -func (w *wrapper) Lister() corev1.NamespaceLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Namespace, err error) { - lo, err := w.client.CoreV1().Namespaces().List(context.TODO(), metav1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apicorev1.Namespace, error) { - return w.client.CoreV1().Namespaces().Get(context.TODO(), name, metav1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/vendor/knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/serviceaccount.go b/vendor/knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/serviceaccount.go index 4d9bbd809c..aa6d8df928 100644 --- a/vendor/knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/serviceaccount.go +++ b/vendor/knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/serviceaccount.go @@ -21,14 +21,7 @@ package serviceaccount import ( context "context" - apicorev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" - kubernetes "k8s.io/client-go/kubernetes" - corev1 "k8s.io/client-go/listers/core/v1" - cache "k8s.io/client-go/tools/cache" - client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ServiceAccountInformer { untyped := ctx.Value(Key{}) @@ -63,54 +50,3 @@ func Get(ctx context.Context) v1.ServiceAccountInformer { } return untyped.(v1.ServiceAccountInformer) } - -type wrapper struct { - client kubernetes.Interface - - namespace string - - resourceVersion string -} - -var _ v1.ServiceAccountInformer = (*wrapper)(nil) -var _ corev1.ServiceAccountLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apicorev1.ServiceAccount{}, 0, nil) -} - -func (w *wrapper) Lister() corev1.ServiceAccountLister { - return w -} - -func (w *wrapper) ServiceAccounts(namespace string) corev1.ServiceAccountNamespaceLister { - return &wrapper{client: w.client, namespace: namespace, resourceVersion: w.resourceVersion} -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.ServiceAccount, err error) { - lo, err := w.client.CoreV1().ServiceAccounts(w.namespace).List(context.TODO(), metav1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apicorev1.ServiceAccount, error) { - return w.client.CoreV1().ServiceAccounts(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/vendor/knative.dev/pkg/client/injection/kube/informers/rbac/v1/clusterrole/clusterrole.go b/vendor/knative.dev/pkg/client/injection/kube/informers/rbac/v1/clusterrole/clusterrole.go index 5d1df697fd..6e55b4c97f 100644 --- a/vendor/knative.dev/pkg/client/injection/kube/informers/rbac/v1/clusterrole/clusterrole.go +++ b/vendor/knative.dev/pkg/client/injection/kube/informers/rbac/v1/clusterrole/clusterrole.go @@ -21,14 +21,7 @@ package clusterrole import ( context "context" - apirbacv1 "k8s.io/api/rbac/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/rbac/v1" - kubernetes "k8s.io/client-go/kubernetes" - rbacv1 "k8s.io/client-go/listers/rbac/v1" - cache "k8s.io/client-go/tools/cache" - client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ClusterRoleInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1.ClusterRoleInformer { } return untyped.(v1.ClusterRoleInformer) } - -type wrapper struct { - client kubernetes.Interface - - resourceVersion string -} - -var _ v1.ClusterRoleInformer = (*wrapper)(nil) -var _ rbacv1.ClusterRoleLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apirbacv1.ClusterRole{}, 0, nil) -} - -func (w *wrapper) Lister() rbacv1.ClusterRoleLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1.ClusterRole, err error) { - lo, err := w.client.RbacV1().ClusterRoles().List(context.TODO(), metav1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apirbacv1.ClusterRole, error) { - return w.client.RbacV1().ClusterRoles().Get(context.TODO(), name, metav1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/vendor/knative.dev/pkg/client/injection/kube/informers/rbac/v1/clusterrolebinding/clusterrolebinding.go b/vendor/knative.dev/pkg/client/injection/kube/informers/rbac/v1/clusterrolebinding/clusterrolebinding.go index 7c2081d55a..962bfd5b3e 100644 --- a/vendor/knative.dev/pkg/client/injection/kube/informers/rbac/v1/clusterrolebinding/clusterrolebinding.go +++ b/vendor/knative.dev/pkg/client/injection/kube/informers/rbac/v1/clusterrolebinding/clusterrolebinding.go @@ -21,14 +21,7 @@ package clusterrolebinding import ( context "context" - apirbacv1 "k8s.io/api/rbac/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/rbac/v1" - kubernetes "k8s.io/client-go/kubernetes" - rbacv1 "k8s.io/client-go/listers/rbac/v1" - cache "k8s.io/client-go/tools/cache" - client "knative.dev/pkg/client/injection/kube/client" factory "knative.dev/pkg/client/injection/kube/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -37,7 +30,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -49,11 +41,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.ClusterRoleBindingInformer { untyped := ctx.Value(Key{}) @@ -63,48 +50,3 @@ func Get(ctx context.Context) v1.ClusterRoleBindingInformer { } return untyped.(v1.ClusterRoleBindingInformer) } - -type wrapper struct { - client kubernetes.Interface - - resourceVersion string -} - -var _ v1.ClusterRoleBindingInformer = (*wrapper)(nil) -var _ rbacv1.ClusterRoleBindingLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apirbacv1.ClusterRoleBinding{}, 0, nil) -} - -func (w *wrapper) Lister() rbacv1.ClusterRoleBindingLister { - return w -} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apirbacv1.ClusterRoleBinding, err error) { - lo, err := w.client.RbacV1().ClusterRoleBindings().List(context.TODO(), metav1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apirbacv1.ClusterRoleBinding, error) { - return w.client.RbacV1().ClusterRoleBindings().Get(context.TODO(), name, metav1.GetOptions{ - ResourceVersion: w.resourceVersion, - }) -} diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go index b505968466..7cd8122d52 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go @@ -46,7 +46,9 @@ func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&ca.ExternalVersionsInformersPackage, "external-versions-informers-package", ca.ExternalVersionsInformersPackage, "the full package name for the external versions injection informer to use") fs.StringVar(&ca.ListersPackage, "listers-package", ca.ListersPackage, "the full package name for client listers to use") fs.StringVar(&ca.ForceKinds, "force-genreconciler-kinds", ca.ForceKinds, `force kinds will override the genreconciler tag setting for the given set of kinds, comma separated: "Foo,Bar,Baz"`) - fs.BoolVar(&ca.ListerHasPointerElem, "lister-has-pointer-elem", ca.ListerHasPointerElem, "set to true if the List types have an Item array of pointer element types") + + fs.BoolVar(&ca.ListerHasPointerElem, "lister-has-pointer-elem", false, "") + fs.MarkDeprecated("lister-has-pointer-elem", "this flag has no effect") } // Validate checks the given arguments. diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/client.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/client.go index 8338ed647c..646339a136 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/client.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/client.go @@ -17,17 +17,8 @@ limitations under the License. package generators import ( - "fmt" "io" - "path/filepath" - "sort" - "strings" - "golang.org/x/text/cases" - "golang.org/x/text/language" - "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/code-generator/cmd/client-gen/generators/util" - clientgentypes "k8s.io/code-generator/cmd/client-gen/types" "k8s.io/gengo/generator" "k8s.io/gengo/namer" "k8s.io/gengo/types" @@ -39,10 +30,6 @@ import ( type clientGenerator struct { generator.DefaultGen - groupVersions map[string]clientgentypes.GroupVersions - groupGoNames map[string]string - groupVersionTypes map[string]map[clientgentypes.Version][]*types.Type - outputPackage string imports namer.ImportTracker clientSetPackage string @@ -60,37 +47,14 @@ func (g *clientGenerator) Filter(c *generator.Context, t *types.Type) bool { return false } -var publicPluralNamer = &ExceptionNamer{ - Exceptions: map[string]string{ - // these exceptions are used to deconflict the generated code - // you can put your fully qualified package like - // to generate a name that doesn't conflict with your group. - // "k8s.io/apis/events/v1beta1.Event": "EventResource" - }, - KeyFunc: func(t *types.Type) string { - return t.Name.Package + "." + t.Name.Name - }, - Delegate: namer.NewPublicPluralNamer(map[string]string{ - "Endpoints": "Endpoints", - }), -} - func (g *clientGenerator) Namers(c *generator.Context) namer.NameSystems { return namer.NameSystems{ - "raw": namer.NewRawNamer(g.outputPackage, g.imports), - "publicPlural": publicPluralNamer, + "raw": namer.NewRawNamer(g.outputPackage, g.imports), } } func (g *clientGenerator) Imports(c *generator.Context) (imports []string) { imports = append(imports, g.imports.ImportLines()...) - for gpn, group := range g.groupVersions { - for _, version := range group.Versions { - typedClientPath := filepath.Join(g.clientSetPackage, "typed", strings.ToLower(group.PackageName), strings.ToLower(version.NonEmpty())) - imports = append(imports, fmt.Sprintf("%s \"%s\"", strings.ToLower("typed"+g.groupGoNames[gpn]+version.NonEmpty()), typedClientPath)) - } - } - imports = sets.NewString(imports...).List() return } @@ -100,10 +64,9 @@ func (g *clientGenerator) GenerateType(c *generator.Context, t *types.Type, w io klog.V(5).Info("processing type ", t) m := map[string]interface{}{ - "clientSetNewForConfigOrDie": c.Universe.Function(types.Name{Package: g.clientSetPackage, Name: "NewForConfigOrDie"}), - "clientSetInterface": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}), - "injectionRegisterClient": c.Universe.Function(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterClient"}), - "injectionRegisterDynamicClient": c.Universe.Function(types.Name{Package: "knative.dev/pkg/injection", Name: "Dynamic.RegisterDynamicClient"}), + "clientSetNewForConfigOrDie": c.Universe.Function(types.Name{Package: g.clientSetPackage, Name: "NewForConfigOrDie"}), + "clientSetInterface": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}), + "injectionRegisterClient": c.Universe.Function(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterClient"}), "injectionRegisterClientFetcher": c.Universe.Function(types.Name{ Package: "knative.dev/pkg/injection", Name: "Default.RegisterClientFetcher", @@ -117,234 +80,10 @@ func (g *clientGenerator) GenerateType(c *generator.Context, t *types.Type, w io Package: "context", Name: "Context", }), - "dynamicInterface": c.Universe.Type(types.Name{ - Package: "k8s.io/client-go/dynamic", - Name: "Interface", - }), - "dynamicclientGet": c.Universe.Function(types.Name{ - Package: "knative.dev/pkg/injection/clients/dynamicclient", - Name: "Get", - }), - "discoveryInterface": c.Universe.Type(types.Name{ - Package: "k8s.io/client-go/discovery", - Name: "DiscoveryInterface", - }), - "runtimeObject": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/runtime", - Name: "Object", - }), - "jsonMarshal": c.Universe.Function(types.Name{ - Package: "encoding/json", - Name: "Marshal", - }), - "jsonUnmarshal": c.Universe.Function(types.Name{ - Package: "encoding/json", - Name: "Unmarshal", - }), - "fmtErrorf": c.Universe.Function(types.Name{ - Package: "fmt", - Name: "Errorf", - }), } sw.Do(injectionClient, m) - gpns := make(sets.String, len(g.groupGoNames)) - for gpn := range g.groupGoNames { - gpns.Insert(gpn) - } - - for _, gpn := range gpns.List() { - ggn := g.groupGoNames[gpn] - gv := g.groupVersions[gpn] - verTypes := g.groupVersionTypes[gpn] - for _, version := range gv.Versions { - vts := verTypes[version.Version] - if len(vts) == 0 { - // Skip things with zero types. - continue - } - sw.Do(clientsetInterfaceImplTemplate, map[string]interface{}{ - "dynamicInterface": c.Universe.Type(types.Name{ - Package: "k8s.io/client-go/dynamic", - Name: "Interface", - }), - "restInterface": c.Universe.Type(types.Name{ - Package: "k8s.io/client-go/rest", - Name: "Interface", - }), - "GroupGoName": ggn, - "Version": namer.IC(version.String()), - "PackageAlias": strings.ToLower("typed" + g.groupGoNames[gpn] + version.NonEmpty()), - }) - sort.Slice(vts, func(i, j int) bool { - lhs, rhs := vts[i], vts[j] - return lhs.String() < rhs.String() - }) - for _, t := range vts { - tags, err := util.ParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)) - if err != nil { - return err - } - - // Don't use the literal group "core", these should be left blank. - group := gv.Group - if group == "core" { - group = "" - } - - sw.Do(typeImplTemplate, map[string]interface{}{ - "dynamicNamespaceableResourceInterface": c.Universe.Type(types.Name{ - Package: "k8s.io/client-go/dynamic", - Name: "NamespaceableResourceInterface", - }), - "schemaGroupVersionResource": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/runtime/schema", - Name: "GroupVersionResource", - }), - "contextContext": c.Universe.Type(types.Name{ - Package: "context", - Name: "Context", - }), - "GroupGoName": ggn, - "Version": namer.IC(version.String()), - "PackageAlias": strings.ToLower("typed" + g.groupGoNames[gpn] + version.NonEmpty()), - "Type": t, - "Namespaced": !tags.NonNamespaced, - "Group": group, - "VersionLower": version, - "Resource": strings.ToLower(publicPluralNamer.Name(t)), - }) - opts := map[string]interface{}{ - "contextContext": c.Universe.Type(types.Name{ - Package: "context", - Name: "Context", - }), - "unstructuredUnstructured": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", - Name: "Unstructured", - }), - "metav1CreateOptions": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/apis/meta/v1", - Name: "CreateOptions", - }), - "metav1UpdateOptions": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/apis/meta/v1", - Name: "UpdateOptions", - }), - "metav1GetOptions": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/apis/meta/v1", - Name: "GetOptions", - }), - "metav1ListOptions": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/apis/meta/v1", - Name: "ListOptions", - }), - "metav1DeleteOptions": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/apis/meta/v1", - Name: "DeleteOptions", - }), - "metav1PatchOptions": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/apis/meta/v1", - Name: "PatchOptions", - }), - "metav1ApplyOptions": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/apis/meta/v1", - Name: "ApplyOptions", - }), - "typesPatchType": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/types", - Name: "PatchType", - }), - "watchInterface": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/watch", - Name: "Interface", - }), - "errorsNew": c.Universe.Function(types.Name{ - Package: "errors", - Name: "New", - }), - "GroupGoName": ggn, - "Version": namer.IC(version.String()), - "Type": t, - "InputType": t, - "ResultType": t, - - // TODO: Total hacks to get this to run at all. - "ApplyType": c.Universe.Type(types.Name{ - Package: "k8s.io/client-go/applyconfigurations/" + strings.ReplaceAll(t.Name.Package, "k8s.io/api/", ""), - Name: t.Name.Name + "ApplyConfiguration", - }), - "generateApply": strings.HasPrefix(t.Name.Package, "k8s.io/api/"), - - "Namespaced": !tags.NonNamespaced, - "Subresource": "", - "schemaGroupVersionKind": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/runtime/schema", - Name: "GroupVersionKind", - }), - "Group": group, - "VersionLower": version, - "Kind": t.Name.Name, - - "ptrString": c.Universe.Function(types.Name{ - Package: "knative.dev/pkg/ptr", - Name: "String", - }), - } - - for _, v := range verbs.List() { - tmpl := verbMap[v] - if tags.NoVerbs || !tags.HasVerb(v) { - continue - } - sw.Do(tmpl, opts) - } - for _, e := range tags.Extensions { - for _, v := range extensionVerbs.List() { - tmpl := extensionVerbMap[v] - if !e.HasVerb(v) { - continue - } - inputType := *t - resultType := *t - if len(e.InputTypeOverride) > 0 { - if name, pkg := e.Input(); len(pkg) > 0 { - // _, inputGVString = util.ParsePathGroupVersion(pkg) - newType := c.Universe.Type(types.Name{Package: pkg, Name: name}) - inputType = *newType - } else { - inputType.Name.Name = e.InputTypeOverride - } - } - if len(e.ResultTypeOverride) > 0 { - if name, pkg := e.Result(); len(pkg) > 0 { - newType := c.Universe.Type(types.Name{Package: pkg, Name: name}) - resultType = *newType - } else { - resultType.Name.Name = e.ResultTypeOverride - } - } - // TODO: Total hacks to get this to run at all. - if v == "apply" { - inputType = *(c.Universe.Type(types.Name{ - Package: "k8s.io/client-go/applyconfigurations/" + strings.ReplaceAll(inputType.Name.Package, "k8s.io/api/", ""), - Name: inputType.Name.Name + "ApplyConfiguration", - })) - } - opts["InputType"] = &inputType - opts["ResultType"] = &resultType - if e.IsSubresource() { - opts["Subresource"] = e.SubResourcePath - } - caser := cases.Title(language.English) - sw.Do(strings.Replace(tmpl, " "+caser.String(e.VerbType), " "+e.VerbName, -1), opts) - } - } - } - } - } - return sw.Error() } @@ -354,7 +93,6 @@ func init() { {{.injectionRegisterClientFetcher|raw}}(func(ctx context.Context) interface{} { return Get(ctx) }) - {{.injectionRegisterDynamicClient|raw}}(withClientFromDynamic) } // Key is used as the key for associating information with a context.Context. @@ -364,10 +102,6 @@ func withClientFromConfig(ctx {{.contextContext|raw}}, cfg *{{.restConfig|raw}}) return context.WithValue(ctx, Key{}, {{.clientSetNewForConfigOrDie|raw}}(cfg)) } -func withClientFromDynamic(ctx {{.contextContext|raw}}) context.Context { - return context.WithValue(ctx, Key{}, &wrapClient{dyn: {{.dynamicclientGet|raw}}(ctx)}) -} - // Get extracts the {{.clientSetInterface|raw}} client from the context. func Get(ctx {{.contextContext|raw}}) {{.clientSetInterface|raw}} { untyped := ctx.Value(Key{}) @@ -382,313 +116,4 @@ func Get(ctx {{.contextContext|raw}}) {{.clientSetInterface|raw}} { } return untyped.({{.clientSetInterface|raw}}) } - -type wrapClient struct { - dyn {{.dynamicInterface|raw}} -} - -var _ {{.clientSetInterface|raw}} = (*wrapClient)(nil) - -func (w *wrapClient) Discovery() {{.discoveryInterface|raw}} { - panic("Discovery called on dynamic client!") -} - - -func convert(from interface{}, to {{ .runtimeObject|raw }}) error { - bs, err := {{ .jsonMarshal|raw }}(from) - if err != nil { - return {{ .fmtErrorf|raw }}("Marshal() = %w", err) - } - if err := {{ .jsonUnmarshal|raw }}(bs, to); err != nil { - return {{ .fmtErrorf|raw }}("Unmarshal() = %w", err) - } - return nil -} - ` - -var clientsetInterfaceImplTemplate = ` -// {{.GroupGoName}}{{.Version}} retrieves the {{.GroupGoName}}{{.Version}}Client -func (w *wrapClient) {{.GroupGoName}}{{.Version}}() {{.PackageAlias}}.{{.GroupGoName}}{{.Version}}Interface { - return &wrap{{.GroupGoName}}{{.Version}}{ - dyn: w.dyn, - } -} - -type wrap{{.GroupGoName}}{{.Version}} struct { - dyn {{.dynamicInterface|raw}} -} - -func (w *wrap{{.GroupGoName}}{{.Version}}) RESTClient() {{.restInterface|raw}} { - panic("RESTClient called on dynamic client!") -} - -` - -var typeImplTemplate = ` -func (w *wrap{{ .GroupGoName }}{{ .Version }}) {{ .Type|publicPlural }}({{if .Namespaced}}namespace string{{end}}) {{ .PackageAlias }}.{{ .Type.Name.Name }}Interface { - return &wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl{ - dyn: w.dyn.Resource({{ .schemaGroupVersionResource|raw }}{ - Group: "{{ .Group }}", - Version: "{{ .VersionLower }}", - Resource: "{{ .Resource }}", - }), -{{if .Namespaced}} - namespace: namespace, -{{end}} - } -} - -type wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl struct { - dyn {{.dynamicNamespaceableResourceInterface|raw}} -{{if .Namespaced}} - namespace string -{{end}}} - -var _ {{ .PackageAlias }}.{{ .Type.Name.Name }}Interface = (*wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl)(nil) - -` - -var verbs = sets.NewString( /* Populated from verbMap during init */ ) -var verbMap = map[string]string{ - "create": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Create(ctx {{ .contextContext|raw }}, {{ if .Subresource }}_ string, {{ end }}in *{{ .InputType|raw }}, opts {{ .metav1CreateOptions|raw }}) (*{{ .ResultType|raw }}, error) { - in.SetGroupVersionKind({{ .schemaGroupVersionKind|raw }}{ - Group: "{{ .Group }}", - Version: "{{ .VersionLower }}", - Kind: "{{ .Kind }}", - }) - uo := &{{ .unstructuredUnstructured|raw }}{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn{{if .Namespaced}}{{if .Namespaced}}.Namespace(w.namespace){{end}}{{end}}.Create(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &{{ .ResultType|raw }}{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} -`, - - "update": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Update(ctx {{ .contextContext|raw }}, {{ if .Subresource }}_ string, {{ end }}in *{{ .InputType|raw }}, opts {{ .metav1UpdateOptions|raw }}) (*{{ .ResultType|raw }}, error) { - in.SetGroupVersionKind({{ .schemaGroupVersionKind|raw }}{ - Group: "{{ .Group }}", - Version: "{{ .VersionLower }}", - Kind: "{{ .Kind }}", - }) - uo := &{{ .unstructuredUnstructured|raw }}{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.Update(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &{{ .ResultType|raw }}{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} -`, - - "updateStatus": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) UpdateStatus(ctx {{ .contextContext|raw }}, in *{{ .InputType|raw }}, opts {{ .metav1UpdateOptions|raw }}) (*{{ .ResultType|raw }}, error) { - in.SetGroupVersionKind({{ .schemaGroupVersionKind|raw }}{ - Group: "{{ .Group }}", - Version: "{{ .VersionLower }}", - Kind: "{{ .Kind }}", - }) - uo := &{{ .unstructuredUnstructured|raw }}{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err := w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.UpdateStatus(ctx, uo, opts) - if err != nil { - return nil, err - } - out := &{{ .ResultType|raw }}{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} -`, - - "delete": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Delete(ctx {{ .contextContext|raw }}, name string, opts {{ .metav1DeleteOptions|raw }}) error { - return w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.Delete(ctx, name, opts) -} -`, - - "deleteCollection": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) DeleteCollection(ctx {{ .contextContext|raw }}, opts {{ .metav1DeleteOptions|raw }}, listOpts {{ .metav1ListOptions|raw }}) error { - return w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.DeleteCollection(ctx, opts, listOpts) -} -`, - - "get": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Get(ctx {{ .contextContext|raw }}, name string, opts {{ .metav1GetOptions|raw }}) (*{{ .ResultType|raw }}, error) { - uo, err := w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.Get(ctx, name, opts) - if err != nil { - return nil, err - } - out := &{{ .ResultType|raw }}{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} -`, - - "list": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) List(ctx {{ .contextContext|raw }}, opts {{ .metav1ListOptions|raw }}) (*{{ .ResultType|raw }}List, error) { - uo, err := w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.List(ctx, opts) - if err != nil { - return nil, err - } - out := &{{ .ResultType|raw }}List{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} -`, - - "watch": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Watch(ctx {{ .contextContext|raw }}, opts {{ .metav1ListOptions|raw }}) ({{ .watchInterface|raw }}, error) { - return nil, {{ .errorsNew|raw }}("NYI: Watch") -} -`, - "patch": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Patch(ctx {{ .contextContext|raw }}, name string, pt {{ .typesPatchType|raw }}, data []byte, opts {{ .metav1PatchOptions|raw }}, subresources ...string) (result *{{ .ResultType|raw }}, err error) { - uo, err := w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.Patch(ctx, name, pt, data, opts) - if err != nil { - return nil, err - } - out := &{{ .ResultType|raw }}{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} -`, - "apply": `{{if .generateApply}} -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Apply(ctx {{ .contextContext|raw }}, in *{{ .ApplyType|raw }}, opts {{ .metav1ApplyOptions|raw }}) (result *{{ .ResultType|raw }}, err error) { - in.Kind = {{ .ptrString|raw }}("{{ .Kind }}") - {{ if .Group }} - in.APIVersion = {{ .ptrString|raw }}("{{ .Group }}/{{ .VersionLower }}") - {{ else }} - in.APIVersion = {{ .ptrString|raw }}("{{ .VersionLower }}") - {{ end }} - - uo := &{{ .unstructuredUnstructured|raw }}{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.Apply(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &{{ .ResultType|raw }}{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} -{{end}} -`, - "applyStatus": `{{if .generateApply}} -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) ApplyStatus(ctx {{ .contextContext|raw }}, in *{{ .ApplyType|raw }}, opts {{ .metav1ApplyOptions|raw }}) (result *{{ .ResultType|raw }}, err error) { - in.Kind = {{ .ptrString|raw }}("{{ .Kind }}") - {{ if .Group }} - in.APIVersion = {{ .ptrString|raw }}("{{ .Group }}/{{ .VersionLower }}") - {{ else }} - in.APIVersion = {{ .ptrString|raw }}("{{ .VersionLower }}") - {{ end }} - - uo := &{{ .unstructuredUnstructured|raw }}{} - if err := convert(in, uo); err != nil { - return nil, err - } - uo, err = w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.ApplyStatus(ctx, uo.GetName(), uo, opts) - if err != nil { - return nil, err - } - out := &{{ .ResultType|raw }}{} - if err := convert(uo, out); err != nil { - return nil, err - } - return out, nil -} -{{end}} -`, -} - -var extensionVerbs = sets.NewString( /* Populated from extensionVerbMap during init */ ) -var extensionVerbMap = map[string]string{ - "apply": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Apply(ctx {{ .contextContext|raw }}, name string, in *{{ .InputType|raw }}, opts {{ .metav1ApplyOptions|raw }}) (*{{ .ResultType|raw }}, error) { - panic("NYI") -} -`, - "create": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Create(ctx {{ .contextContext|raw }}, {{ if .Subresource }}_ string, {{ end }}in *{{ .InputType|raw }}, opts {{ .metav1CreateOptions|raw }}) (*{{ .ResultType|raw }}, error) { - panic("NYI") -} -`, - "update": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Update(ctx {{ .contextContext|raw }}, {{ if .Subresource }}_ string, {{ end }}in *{{ .InputType|raw }}, opts {{ .metav1UpdateOptions|raw }}) (*{{ .ResultType|raw }}, error) { - panic("NYI") -} -`, - "updateStatus": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) UpdateStatus(ctx {{ .contextContext|raw }}, in *{{ .InputType|raw }}, opts {{ .metav1UpdateOptions|raw }}) (*{{ .ResultType|raw }}, error) { - panic("NYI") -} -`, - "delete": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Delete(ctx {{ .contextContext|raw }}, name string, opts {{ .metav1DeleteOptions|raw }}) error { - panic("NYI") -} -`, - "deleteCollection": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) DeleteCollection(ctx {{ .contextContext|raw }}, opts {{ .metav1DeleteOptions|raw }}, listOpts {{ .metav1ListOptions|raw }}) error { - panic("NYI") -} -`, - "get": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Get(ctx {{ .contextContext|raw }}, name string, opts {{ .metav1GetOptions|raw }}) (*{{ .ResultType|raw }}, error) { - panic("NYI") -} -`, - "list": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) List(ctx {{ .contextContext|raw }}, opts {{ .metav1ListOptions|raw }}) (*{{ .ResultType|raw }}List, error) { - panic("NYI") -} -`, - "watch": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Watch(ctx {{ .contextContext|raw }}, opts {{ .metav1ListOptions|raw }}) ({{ .watchInterface|raw }}, error) { - panic("NYI") -} -`, - "patch": ` -func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Patch(ctx {{ .contextContext|raw }}, name string, pt {{ .typesPatchType|raw }}, data []byte, opts {{ .metav1PatchOptions|raw }}, subresources ...string) (result *{{ .ResultType|raw }}, err error) { - panic("NYI") -} -`, -} - -func init() { - for v := range verbMap { - verbs.Insert(v) - } - for ev := range extensionVerbMap { - extensionVerbs.Insert(ev) - } -} diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/filtered_informer.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/filtered_informer.go index b9c5c4ae2f..3cee6bc423 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/filtered_informer.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/filtered_informer.go @@ -19,7 +19,6 @@ package generators import ( "io" - "k8s.io/code-generator/cmd/client-gen/generators/util" clientgentypes "k8s.io/code-generator/cmd/client-gen/types" "k8s.io/gengo/generator" "k8s.io/gengo/namer" @@ -38,10 +37,6 @@ type filteredInjectionGenerator struct { imports namer.ImportTracker typedInformerPackage string groupInformerFactoryPackage string - injectionClientSetPackage string - clientSetPackage string - listerPkg string - listerHasPointerElem bool } var _ generator.Generator = (*filteredInjectionGenerator)(nil) @@ -83,24 +78,11 @@ func (g *filteredInjectionGenerator) GenerateType(c *generator.Context, t *types klog.V(5).Info("processing type ", t) - tags, err := util.ParseClientGenTags(append(g.typeToGenerate.SecondClosestCommentLines, g.typeToGenerate.CommentLines...)) - if err != nil { - return err - } - m := map[string]interface{}{ - "clientGet": c.Universe.Type(types.Name{Package: g.injectionClientSetPackage, Name: "Get"}), - "clientSetInterface": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}), - "resourceLister": c.Universe.Type(types.Name{Name: g.typeToGenerate.Name.Name + "Lister", Package: g.listerPkg}), - "resourceNamespaceLister": c.Universe.Type(types.Name{Name: g.typeToGenerate.Name.Name + "NamespaceLister", Package: g.listerPkg}), - "listerHasPointerElem": g.listerHasPointerElem, - "groupGoName": namer.IC(g.groupGoName), - "versionGoName": namer.IC(g.groupVersion.Version.String()), "group": namer.IC(g.groupGoName), "type": t, "version": namer.IC(g.groupVersion.Version.String()), "injectionRegisterFilteredInformers": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterFilteredInformers"}), - "injectionRegisterDynamicInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "Dynamic.RegisterDynamicInformer"}), "controllerInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/controller", Name: "Informer"}), "informersTypedInformer": c.Universe.Type(types.Name{Package: g.typedInformerPackage, Name: t.Name.Name + "Informer"}), "factoryLabelKey": c.Universe.Type(types.Name{Package: g.groupInformerFactoryPackage, Name: "LabelKey"}), @@ -117,39 +99,6 @@ func (g *filteredInjectionGenerator) GenerateType(c *generator.Context, t *types Package: "context", Name: "WithValue", }), - "schemaGVR": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/runtime/schema", - Name: "GroupVersionResource", - }), - "labelsSelector": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/labels", - Name: "Selector", - }), - "labelsParseToRequirements": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/labels", - Name: "ParseToRequirements", - }), - "contextTODO": c.Universe.Function(types.Name{ - Package: "context", - Name: "TODO", - }), - "metav1GetOptions": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/apis/meta/v1", - Name: "GetOptions", - }), - "metav1ListOptions": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/apis/meta/v1", - Name: "ListOptions", - }), - "cacheSharedIndexInformer": c.Universe.Type(types.Name{ - Package: "k8s.io/client-go/tools/cache", - Name: "SharedIndexInformer", - }), - "cacheNewSharedIndexInformer": c.Universe.Function(types.Name{ - Package: "k8s.io/client-go/tools/cache", - Name: "NewSharedIndexInformer", - }), - "Namespaced": !tags.NonNamespaced, } sw.Do(filteredInjectionInformer, m) @@ -160,7 +109,6 @@ func (g *filteredInjectionGenerator) GenerateType(c *generator.Context, t *types var filteredInjectionInformer = ` func init() { {{.injectionRegisterFilteredInformers|raw}}(withInformer) - {{.injectionRegisterDynamicInformer|raw}}(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -185,20 +133,6 @@ func withInformer(ctx {{.contextContext|raw}}) ({{.contextContext|raw}}, []{{.co return ctx, infs } -func withDynamicInformer(ctx {{.contextContext|raw}}) {{.contextContext|raw}} { - untyped := ctx.Value({{.factoryLabelKey|raw}}{}) - if untyped == nil { - {{.loggingFromContext|raw}}(ctx).Panic( - "Unable to fetch labelkey from context.") - } - labelSelectors := untyped.([]string) - for _, selector := range labelSelectors { - inf := &wrapper{client: {{ .clientGet|raw }}(ctx), selector: selector} - ctx = {{ .contextWithValue|raw }}(ctx, Key{Selector: selector}, inf) - } - return ctx -} - // Get extracts the typed informer from the context. func Get(ctx {{.contextContext|raw}}, selector string) {{.informersTypedInformer|raw}} { untyped := ctx.Value(Key{Selector: selector}) @@ -208,55 +142,4 @@ func Get(ctx {{.contextContext|raw}}, selector string) {{.informersTypedInformer } return untyped.({{.informersTypedInformer|raw}}) } - -type wrapper struct { - client {{.clientSetInterface|raw}} -{{ if .Namespaced }} - namespace string -{{ end }} - selector string -} - -var _ {{.informersTypedInformer|raw}} = (*wrapper)(nil) -var _ {{.resourceLister|raw}} = (*wrapper)(nil) - -func (w *wrapper) Informer() {{ .cacheSharedIndexInformer|raw }} { - return {{ .cacheNewSharedIndexInformer|raw }}(nil, &{{ .type|raw }}{}, 0, nil) -} - -func (w *wrapper) Lister() {{ .resourceLister|raw }} { - return w -} - -{{if .Namespaced}} -func (w *wrapper) {{ .type|publicPlural }}(namespace string) {{ .resourceNamespaceLister|raw }} { - return &wrapper{client: w.client, namespace: namespace, selector: w.selector} -} -{{end}} - -func (w *wrapper) List(selector {{ .labelsSelector|raw }}) (ret []*{{ .type|raw }}, err error) { - reqs, err := {{ .labelsParseToRequirements|raw }}(w.selector) - if err != nil { - return nil, err - } - selector = selector.Add(reqs...) - lo, err := w.client.{{.groupGoName}}{{.versionGoName}}().{{.type|publicPlural}}({{if .Namespaced}}w.namespace{{end}}).List({{ .contextTODO|raw }}(), {{ .metav1ListOptions|raw }}{ - LabelSelector: selector.String(), - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, {{if not .listerHasPointerElem}}&{{end}}lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*{{ .type|raw }}, error) { - // TODO(mattmoor): Check that the fetched object matches the selector. - return w.client.{{.groupGoName}}{{.versionGoName}}().{{.type|publicPlural}}({{if .Namespaced}}w.namespace{{end}}).Get({{ .contextTODO|raw }}(), name, {{ .metav1GetOptions|raw }}{ - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) -} ` diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/informer.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/informer.go index 305ec2476e..c4fb215f1d 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/informer.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/informer.go @@ -19,7 +19,6 @@ package generators import ( "io" - "k8s.io/code-generator/cmd/client-gen/generators/util" clientgentypes "k8s.io/code-generator/cmd/client-gen/types" "k8s.io/gengo/generator" "k8s.io/gengo/namer" @@ -38,10 +37,6 @@ type injectionGenerator struct { imports namer.ImportTracker typedInformerPackage string groupInformerFactoryPackage string - injectionClientSetPackage string - clientSetPackage string - listerPkg string - listerHasPointerElem bool } var _ generator.Generator = (*injectionGenerator)(nil) @@ -83,27 +78,14 @@ func (g *injectionGenerator) GenerateType(c *generator.Context, t *types.Type, w klog.V(5).Info("processing type ", t) - tags, err := util.ParseClientGenTags(append(g.typeToGenerate.SecondClosestCommentLines, g.typeToGenerate.CommentLines...)) - if err != nil { - return err - } - m := map[string]interface{}{ - "clientGet": c.Universe.Type(types.Name{Package: g.injectionClientSetPackage, Name: "Get"}), - "clientSetInterface": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}), - "resourceLister": c.Universe.Type(types.Name{Name: g.typeToGenerate.Name.Name + "Lister", Package: g.listerPkg}), - "resourceNamespaceLister": c.Universe.Type(types.Name{Name: g.typeToGenerate.Name.Name + "NamespaceLister", Package: g.listerPkg}), - "listerHasPointerElem": g.listerHasPointerElem, - "groupGoName": namer.IC(g.groupGoName), - "versionGoName": namer.IC(g.groupVersion.Version.String()), - "group": g.groupVersion.Group.String(), - "version": g.groupVersion.Version.String(), - "type": t, - "injectionRegisterInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterInformer"}), - "injectionRegisterDynamicInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "Dynamic.RegisterDynamicInformer"}), - "controllerInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/controller", Name: "Informer"}), - "informersTypedInformer": c.Universe.Type(types.Name{Package: g.typedInformerPackage, Name: t.Name.Name + "Informer"}), - "factoryGet": c.Universe.Type(types.Name{Package: g.groupInformerFactoryPackage, Name: "Get"}), + "groupGoName": namer.IC(g.groupGoName), + "versionGoName": namer.IC(g.groupVersion.Version.String()), + "type": t, + "injectionRegisterInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterInformer"}), + "controllerInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/controller", Name: "Informer"}), + "informersTypedInformer": c.Universe.Type(types.Name{Package: g.typedInformerPackage, Name: t.Name.Name + "Informer"}), + "factoryGet": c.Universe.Type(types.Name{Package: g.groupInformerFactoryPackage, Name: "Get"}), "loggingFromContext": c.Universe.Function(types.Name{ Package: "knative.dev/pkg/logging", Name: "FromContext", @@ -116,39 +98,6 @@ func (g *injectionGenerator) GenerateType(c *generator.Context, t *types.Type, w Package: "context", Name: "WithValue", }), - "schemaGVR": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/runtime/schema", - Name: "GroupVersionResource", - }), - "labelsSelector": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/labels", - Name: "Selector", - }), - "contextTODO": c.Universe.Function(types.Name{ - Package: "context", - Name: "TODO", - }), - "metav1GetOptions": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/apis/meta/v1", - Name: "GetOptions", - }), - "metav1ListOptions": c.Universe.Type(types.Name{ - Package: "k8s.io/apimachinery/pkg/apis/meta/v1", - Name: "ListOptions", - }), - "cacheSharedIndexInformer": c.Universe.Type(types.Name{ - Package: "k8s.io/client-go/tools/cache", - Name: "SharedIndexInformer", - }), - "cacheNewSharedIndexInformer": c.Universe.Function(types.Name{ - Package: "k8s.io/client-go/tools/cache", - Name: "NewSharedIndexInformer", - }), - "Namespaced": !tags.NonNamespaced, - "injectionGetResourceVersion": c.Universe.Function(types.Name{ - Package: "knative.dev/pkg/injection", - Name: "GetResourceVersion", - }), } sw.Do(injectionInformer, m) @@ -159,7 +108,6 @@ func (g *injectionGenerator) GenerateType(c *generator.Context, t *types.Type, w var injectionInformer = ` func init() { {{.injectionRegisterInformer|raw}}(withInformer) - {{.injectionRegisterDynamicInformer|raw}}(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -171,11 +119,6 @@ func withInformer(ctx {{.contextContext|raw}}) ({{.contextContext|raw}}, {{.cont return {{ .contextWithValue|raw }}(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx {{.contextContext|raw}}) {{.contextContext|raw}} { - inf := &wrapper{client: {{ .clientGet|raw }}(ctx), resourceVersion: {{ .injectionGetResourceVersion|raw }}(ctx)} - return {{ .contextWithValue|raw }}(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx {{.contextContext|raw}}) {{.informersTypedInformer|raw}} { untyped := ctx.Value(Key{}) @@ -185,58 +128,4 @@ func Get(ctx {{.contextContext|raw}}) {{.informersTypedInformer|raw}} { } return untyped.({{.informersTypedInformer|raw}}) } - -type wrapper struct { - client {{.clientSetInterface|raw}} -{{ if .Namespaced }} - namespace string -{{ end }} - resourceVersion string -} - -var _ {{.informersTypedInformer|raw}} = (*wrapper)(nil) -var _ {{.resourceLister|raw}} = (*wrapper)(nil) - -func (w *wrapper) Informer() {{ .cacheSharedIndexInformer|raw }} { - return {{ .cacheNewSharedIndexInformer|raw }}(nil, &{{ .type|raw }}{}, 0, nil) -} - -func (w *wrapper) Lister() {{ .resourceLister|raw }} { - return w -} - -{{if .Namespaced}} -func (w *wrapper) {{ .type|publicPlural }}(namespace string) {{ .resourceNamespaceLister|raw }} { - return &wrapper{client: w.client, namespace: namespace, resourceVersion: w.resourceVersion} -} -{{end}} - -// SetResourceVersion allows consumers to adjust the minimum resourceVersion -// used by the underlying client. It is not accessible via the standard -// lister interface, but can be accessed through a user-defined interface and -// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) -func (w *wrapper) SetResourceVersion(resourceVersion string) { - w.resourceVersion = resourceVersion -} - -func (w *wrapper) List(selector {{ .labelsSelector|raw }}) (ret []*{{ .type|raw }}, err error) { - lo, err := w.client.{{.groupGoName}}{{.versionGoName}}().{{.type|publicPlural}}({{if .Namespaced}}w.namespace{{end}}).List({{ .contextTODO|raw }}(), {{ .metav1ListOptions|raw }}{ - LabelSelector: selector.String(), - ResourceVersion: w.resourceVersion, - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, {{if not .listerHasPointerElem}}&{{end}}lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*{{ .type|raw }}, error) { - return w.client.{{.groupGoName}}{{.versionGoName}}().{{.type|publicPlural}}({{if .Namespaced}}w.namespace{{end}}).Get({{ .contextTODO|raw }}(), name, {{ .metav1GetOptions|raw }}{ - ResourceVersion: w.resourceVersion, - }) -} - ` diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go index 8c3fe5240e..43768927a5 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go @@ -17,7 +17,6 @@ limitations under the License. package generators import ( - "path" "path/filepath" "strings" @@ -48,22 +47,17 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat var packageList generator.Packages - groupVersions := make(map[string]clientgentypes.GroupVersions) groupGoNames := make(map[string]string) - groupVersionTypes := make(map[string]map[clientgentypes.Version][]*types.Type) for _, inputDir := range arguments.InputDirs { p := context.Universe.Package(vendorless(inputDir)) var gv clientgentypes.GroupVersion - var targetGroupVersions map[string]clientgentypes.GroupVersions parts := strings.Split(p.Path, "/") gv.Group = clientgentypes.Group(parts[len(parts)-2]) gv.Version = clientgentypes.Version(parts[len(parts)-1]) - targetGroupVersions = groupVersions groupPackageName := gv.Group.NonEmpty() - gvPackage := path.Clean(p.Path) // If there's a comment of the form "// +groupName=somegroup" or // "// +groupName=somegroup.foo.bar.io", use the first field (somegroup) as the name of the @@ -82,7 +76,6 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat var typesWithInformers []*types.Type var duckTypes []*types.Type var reconcilerTypes []*types.Type - var clientTypes []*types.Type for _, t := range p.Types { tags := MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)) if tags.NeedsInformerInjection() { @@ -94,26 +87,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat if tags.NeedsReconciler(t, customArgs) { reconcilerTypes = append(reconcilerTypes, t) } - if tags.GenerateClient { - clientTypes = append(clientTypes, t) - } - } - - groupVersionsEntry, ok := targetGroupVersions[groupPackageName] - if !ok { - groupVersionsEntry = clientgentypes.GroupVersions{ - PackageName: groupPackageName, - Group: gv.Group, - } - } - groupVersionsEntry.Versions = append(groupVersionsEntry.Versions, clientgentypes.PackageVersion{Version: gv.Version, Package: gvPackage}) - targetGroupVersions[groupPackageName] = groupVersionsEntry - verTypes, ok := groupVersionTypes[groupPackageName] - if !ok { - verTypes = make(map[clientgentypes.Version][]*types.Type) } - verTypes[gv.Version] = clientTypes - groupVersionTypes[groupPackageName] = verTypes if len(typesWithInformers) != 0 { orderer := namer.Orderer{Namer: namer.NewPrivateNamer(0)} @@ -141,7 +115,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat } // Generate the client and fake. - packageList = append(packageList, versionClientsPackages(versionPackagePath, boilerplate, customArgs, groupVersions, groupGoNames, groupVersionTypes)...) + packageList = append(packageList, versionClientsPackages(versionPackagePath, boilerplate, customArgs)...) // Generate the informer factory and fake. packageList = append(packageList, versionFactoryPackages(versionPackagePath, boilerplate, customArgs)...) @@ -251,7 +225,7 @@ func typedInformerPackage(groupPkgName string, gv clientgentypes.GroupVersion, e return filepath.Join(externalVersionsInformersPackage, groupPkgName, gv.Version.String()) } -func versionClientsPackages(basePackage string, boilerplate []byte, customArgs *informergenargs.CustomArgs, groupVersions map[string]clientgentypes.GroupVersions, groupGoNames map[string]string, groupVersionTypes map[string]map[clientgentypes.Version][]*types.Type) []generator.Package { +func versionClientsPackages(basePackage string, boilerplate []byte, customArgs *informergenargs.CustomArgs) []generator.Package { packagePath := filepath.Join(basePackage, "client") return []generator.Package{ @@ -267,10 +241,6 @@ func versionClientsPackages(basePackage string, boilerplate []byte, customArgs * OptionalName: "client", }, - groupVersions: groupVersions, - groupGoNames: groupGoNames, - groupVersionTypes: groupVersionTypes, - outputPackage: packagePath, imports: generator.NewImportTracker(), clientSetPackage: customArgs.VersionedClientSetPackage, @@ -415,7 +385,6 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg filteredFactoryPackagePath := filepath.Join(basePackage, "informers", "factory", "filtered") packagePath := filepath.Join(basePackage, "informers", groupPkgName, strings.ToLower(gv.Version.NonEmpty())) - listerPackagePath := filepath.Join(customArgs.ListersPackage, groupPkgName, strings.ToLower(gv.Version.NonEmpty())) vers := make([]generator.Package, 0, 2*len(typesToGenerate)) @@ -443,10 +412,6 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg imports: generator.NewImportTracker(), typedInformerPackage: typedInformerPackage, groupInformerFactoryPackage: factoryPackagePath, - clientSetPackage: customArgs.VersionedClientSetPackage, - injectionClientSetPackage: filepath.Join(basePackage, "client"), - listerPkg: listerPackagePath, - listerHasPointerElem: customArgs.ListerHasPointerElem, }) return generators }, @@ -500,10 +465,6 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg imports: generator.NewImportTracker(), typedInformerPackage: typedInformerPackage, groupInformerFactoryPackage: filteredFactoryPackagePath, - clientSetPackage: customArgs.VersionedClientSetPackage, - injectionClientSetPackage: filepath.Join(basePackage, "client"), - listerPkg: listerPackagePath, - listerHasPointerElem: customArgs.ListerHasPointerElem, }) return generators }, diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/main.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/main.go index eae5699f73..2c1a11da77 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/main.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/main.go @@ -18,10 +18,7 @@ package main import ( "flag" - "path/filepath" - "k8s.io/code-generator/pkg/util" - "k8s.io/gengo/args" "k8s.io/klog/v2" "github.com/spf13/pflag" @@ -34,7 +31,6 @@ func main() { genericArgs, customArgs := generatorargs.NewDefaults() // Override defaults. - genericArgs.GoHeaderFilePath = filepath.Join(args.DefaultSourceTree(), util.BoilerplatePath()) genericArgs.OutputPackagePath = "k8s.io/kubernetes/pkg/client/injection/informers/informers_generated" genericArgs.AddFlags(pflag.CommandLine) diff --git a/vendor/knative.dev/pkg/environment/client_config.go b/vendor/knative.dev/pkg/environment/client_config.go index 04d4220b0a..aef33927ef 100644 --- a/vendor/knative.dev/pkg/environment/client_config.go +++ b/vendor/knative.dev/pkg/environment/client_config.go @@ -19,8 +19,10 @@ package environment import ( "flag" "fmt" + "log" "math" "os" + "strconv" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" @@ -45,9 +47,19 @@ func (c *ClientConfig) InitFlags(fs *flag.FlagSet) { fs.StringVar(&c.Kubeconfig, "kubeconfig", os.Getenv("KUBECONFIG"), "Path to a kubeconfig. Only required if out-of-cluster.") - fs.IntVar(&c.Burst, "kube-api-burst", 0, "Maximum burst for throttle.") + fs.IntVar(&c.Burst, "kube-api-burst", int(envVarOrDefault("KUBE_API_BURST", 0)), "Maximum burst for throttle.") - fs.Float64Var(&c.QPS, "kube-api-qps", 0, "Maximum QPS to the server from the client.") + fs.Float64Var(&c.QPS, "kube-api-qps", envVarOrDefault("KUBE_API_QPS", 0.0), "Maximum QPS to the server from the client.") +} + +func envVarOrDefault(key string, val float64) float64 { + var err error + if v := os.Getenv(key); v != "" { + if val, err = strconv.ParseFloat(v, 64); err != nil { + log.Fatal(err) + } + } + return val } func (c *ClientConfig) GetRESTConfig() (*rest.Config, error) { diff --git a/vendor/knative.dev/pkg/injection/clients.go b/vendor/knative.dev/pkg/injection/clients.go index 92e9912185..b71ef1d943 100644 --- a/vendor/knative.dev/pkg/injection/clients.go +++ b/vendor/knative.dev/pkg/injection/clients.go @@ -62,22 +62,3 @@ func (i *impl) FetchAllClients(ctx context.Context) []interface{} { } return clients } - -// DynamicClientInjector holds the type of a callback that attaches a particular -// client type to a context. -type DynamicClientInjector func(context.Context) context.Context - -func (i *impl) RegisterDynamicClient(ci DynamicClientInjector) { - i.m.Lock() - defer i.m.Unlock() - - i.dynamicClients = append(i.dynamicClients, ci) -} - -func (i *impl) GetDynamicClients() []DynamicClientInjector { - i.m.RLock() - defer i.m.RUnlock() - - // Copy the slice before returning. - return append(i.dynamicClients[:0:0], i.dynamicClients...) -} diff --git a/vendor/knative.dev/pkg/injection/clients/dynamicclient/dynamicclient.go b/vendor/knative.dev/pkg/injection/clients/dynamicclient/dynamicclient.go deleted file mode 100644 index 2eece5c555..0000000000 --- a/vendor/knative.dev/pkg/injection/clients/dynamicclient/dynamicclient.go +++ /dev/null @@ -1,49 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package dynamicclient - -import ( - "context" - - "k8s.io/client-go/dynamic" - "k8s.io/client-go/rest" - - "knative.dev/pkg/injection" - "knative.dev/pkg/logging" -) - -func init() { - injection.Default.RegisterClient(withClient) -} - -// Key is used as the key for associating information -// with a context.Context. -type Key struct{} - -func withClient(ctx context.Context, cfg *rest.Config) context.Context { - return context.WithValue(ctx, Key{}, dynamic.NewForConfigOrDie(cfg)) -} - -// Get extracts the Dynamic client from the context. -func Get(ctx context.Context) dynamic.Interface { - untyped := ctx.Value(Key{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch k8s.io/client-go/dynamic.Interface from context.") - } - return untyped.(dynamic.Interface) -} diff --git a/vendor/knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret/secret.go b/vendor/knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret/secret.go index e5193c8655..90d70627f4 100644 --- a/vendor/knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret/secret.go +++ b/vendor/knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret/secret.go @@ -19,14 +19,7 @@ package secret import ( context "context" - apicorev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" v1 "k8s.io/client-go/informers/core/v1" - kubernetes "k8s.io/client-go/kubernetes" - corev1 "k8s.io/client-go/listers/core/v1" - cache "k8s.io/client-go/tools/cache" - client "knative.dev/pkg/client/injection/kube/client" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" factory "knative.dev/pkg/injection/clients/namespacedkube/informers/factory" @@ -35,7 +28,6 @@ import ( func init() { injection.Default.RegisterInformer(withInformer) - injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. @@ -47,11 +39,6 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) { return context.WithValue(ctx, Key{}, inf), inf.Informer() } -func withDynamicInformer(ctx context.Context) context.Context { - inf := &wrapper{client: client.Get(ctx)} - return context.WithValue(ctx, Key{}, inf) -} - // Get extracts the typed informer from the context. func Get(ctx context.Context) v1.SecretInformer { untyped := ctx.Value(Key{}) @@ -61,44 +48,3 @@ func Get(ctx context.Context) v1.SecretInformer { } return untyped.(v1.SecretInformer) } - -type wrapper struct { - client kubernetes.Interface - - namespace string -} - -var _ v1.SecretInformer = (*wrapper)(nil) -var _ corev1.SecretLister = (*wrapper)(nil) - -func (w *wrapper) Informer() cache.SharedIndexInformer { - return cache.NewSharedIndexInformer(nil, &apicorev1.Secret{}, 0, nil) -} - -func (w *wrapper) Lister() corev1.SecretLister { - return w -} - -func (w *wrapper) Secrets(namespace string) corev1.SecretNamespaceLister { - return &wrapper{client: w.client, namespace: namespace} -} - -func (w *wrapper) List(selector labels.Selector) (ret []*apicorev1.Secret, err error) { - lo, err := w.client.CoreV1().Secrets(w.namespace).List(context.TODO(), metav1.ListOptions{ - LabelSelector: selector.String(), - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) - if err != nil { - return nil, err - } - for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) - } - return ret, nil -} - -func (w *wrapper) Get(name string) (*apicorev1.Secret, error) { - return w.client.CoreV1().Secrets(w.namespace).Get(context.TODO(), name, metav1.GetOptions{ - // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. - }) -} diff --git a/vendor/knative.dev/pkg/injection/informers.go b/vendor/knative.dev/pkg/injection/informers.go index ce5d481e88..9356f8d7f9 100644 --- a/vendor/knative.dev/pkg/injection/informers.go +++ b/vendor/knative.dev/pkg/injection/informers.go @@ -28,10 +28,6 @@ import ( // informer type to a context. type InformerInjector func(context.Context) (context.Context, controller.Informer) -// DynamicInformerInjector holds the type of a callback that attaches a particular -// informer type (backed by a Dynamic) to a context. -type DynamicInformerInjector func(context.Context) context.Context - // FilteredInformersInjector holds the type of a callback that attaches a set of particular // filtered informers type to a context. type FilteredInformersInjector func(context.Context) (context.Context, []controller.Informer) @@ -43,13 +39,6 @@ func (i *impl) RegisterInformer(ii InformerInjector) { i.informers = append(i.informers, ii) } -func (i *impl) RegisterDynamicInformer(ii DynamicInformerInjector) { - i.m.Lock() - defer i.m.Unlock() - - i.dynamicInformers = append(i.dynamicInformers, ii) -} - func (i *impl) RegisterFilteredInformers(fii FilteredInformersInjector) { i.m.Lock() defer i.m.Unlock() @@ -65,14 +54,6 @@ func (i *impl) GetInformers() []InformerInjector { return append(i.informers[:0:0], i.informers...) } -func (i *impl) GetDynamicInformers() []DynamicInformerInjector { - i.m.RLock() - defer i.m.RUnlock() - - // Copy the slice before returning. - return append(i.dynamicInformers[:0:0], i.dynamicInformers...) -} - func (i *impl) GetFilteredInformers() []FilteredInformersInjector { i.m.RLock() defer i.m.RUnlock() @@ -81,22 +62,6 @@ func (i *impl) GetFilteredInformers() []FilteredInformersInjector { return append(i.filteredInformers[:0:0], i.filteredInformers...) } -func (i *impl) SetupDynamic(ctx context.Context) context.Context { - // Based on the reconcilers we have linked, build up a set of clients and inject - // them onto the context. - for _, ci := range i.GetDynamicClients() { - ctx = ci(ctx) - } - - // Based on the reconcilers we have linked, build up a set of informers - // and inject them onto the context. - for _, ii := range i.GetDynamicInformers() { - ctx = ii(ctx) - } - - return ctx -} - func (i *impl) SetupInformers(ctx context.Context, cfg *rest.Config) (context.Context, []controller.Informer) { // Based on the reconcilers we have linked, build up a set of clients and inject // them onto the context. diff --git a/vendor/knative.dev/pkg/injection/interface.go b/vendor/knative.dev/pkg/injection/interface.go index 158864015f..c6d5715ad5 100644 --- a/vendor/knative.dev/pkg/injection/interface.go +++ b/vendor/knative.dev/pkg/injection/interface.go @@ -78,29 +78,6 @@ type Interface interface { SetupInformers(context.Context, *rest.Config) (context.Context, []controller.Informer) } -// DynamicInterface is the interface for interacting with dynamicclient-based injection -// implementations, such as Dynamic below. -type DynamicInterface interface { - // RegisterDynamicClient registers a new injector callback for associating - // a new dynamicclient-based client with a context. - RegisterDynamicClient(DynamicClientInjector) - - // GetDynamicClients fetches all of the registered dynamicclient-based client injectors. - GetDynamicClients() []DynamicClientInjector - - // RegisterDynamicInformer registers a new injector callback for associating - // a new dynamicclient-based informer with a context. - RegisterDynamicInformer(DynamicInformerInjector) - - // GetDynamicInformers fetches all of the registered dynamicclient-based informer injectors. - GetDynamicInformers() []DynamicInformerInjector - - // SetupDynamic runs all of the injectors against a context, starting with - // the clients and the given stream. A context infused with the various elements - // is returned. - SetupDynamic(context.Context) context.Context -} - type ControllerConstructor func(context.Context, configmap.Watcher) *controller.Impl // NamedControllerConstructor is a ControllerConstructor with an associated name. @@ -120,10 +97,6 @@ var ( // are being run for real. Default Interface = &impl{} - // Dynamic is the injection interface to use when bootstrapping a version - // of things based on the prototype dynamicclient-based reconciler framework. - Dynamic DynamicInterface = &impl{} - // Fake is the injection interface with which informers should register // to make themselves available to the controller process when it is being // unit tested. @@ -134,11 +107,9 @@ type impl struct { m sync.RWMutex clients []ClientInjector - dynamicClients []DynamicClientInjector clientFetchers []ClientFetcher factories []InformerFactoryInjector informers []InformerInjector - dynamicInformers []DynamicInformerInjector filteredInformers []FilteredInformersInjector ducks []DuckFactoryInjector } diff --git a/vendor/knative.dev/pkg/version/version.go b/vendor/knative.dev/pkg/version/version.go index dbf7daa69a..3a9a4a8cda 100644 --- a/vendor/knative.dev/pkg/version/version.go +++ b/vendor/knative.dev/pkg/version/version.go @@ -33,7 +33,7 @@ const ( // NOTE: If you are changing this line, please also update the minimum kubernetes // version listed here: // https://github.com/knative/docs/blob/mkdocs/docs/snippets/prerequisites.md - defaultMinimumVersion = "v1.24.0" + defaultMinimumVersion = "v1.25.0" ) func getMinimumVersion() string { diff --git a/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/controller.go b/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/controller.go index b50fcf8f41..ba50005d79 100644 --- a/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/controller.go +++ b/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/controller.go @@ -46,13 +46,6 @@ func NewAdmissionController( callbacks ...map[schema.GroupVersionKind]Callback, ) *controller.Impl { - client := kubeclient.Get(ctx) - mwhInformer := mwhinformer.Get(ctx) - secretInformer := secretinformer.Get(ctx) - options := webhook.GetOptions(ctx) - - key := types.NamespacedName{Name: name} - // This not ideal, we are using a variadic argument to effectively make callbacks optional // This allows this addition to be non-breaking to consumers of /pkg // TODO: once all sub-repos have adopted this, we might move this back to a traditional param. @@ -66,6 +59,34 @@ func NewAdmissionController( panic("NewAdmissionController may not be called with multiple callback maps") } + opts := []OptionFunc{ + WithPath(path), + WithTypes(handlers), + WithWrapContext(wc), + WithCallbacks(unwrappedCallbacks), + } + + if disallowUnknownFields { + opts = append(opts, WithDisallowUnknownFields()) + } + + return newController(ctx, name, opts...) +} + +func newController(ctx context.Context, name string, optsFunc ...OptionFunc) *controller.Impl { + client := kubeclient.Get(ctx) + mwhInformer := mwhinformer.Get(ctx) + secretInformer := secretinformer.Get(ctx) + + opts := &options{} + wopts := webhook.GetOptions(ctx) + + for _, f := range optsFunc { + f(opts) + } + + key := types.NamespacedName{Name: name} + wh := &reconciler{ LeaderAwareFuncs: pkgreconciler.LeaderAwareFuncs{ // Have this reconciler enqueue our singleton whenever it becomes leader. @@ -76,13 +97,13 @@ func NewAdmissionController( }, key: key, - path: path, - handlers: handlers, - callbacks: unwrappedCallbacks, + path: opts.path, + handlers: opts.types, + callbacks: opts.callbacks, - withContext: wc, - disallowUnknownFields: disallowUnknownFields, - secretName: options.SecretName, + withContext: opts.wc, + disallowUnknownFields: opts.disallowUnknownFields, + secretName: wopts.SecretName, client: client, mwhlister: mwhInformer.Lister(), @@ -90,8 +111,12 @@ func NewAdmissionController( } logger := logging.FromContext(ctx) - const queueName = "DefaultingWebhook" - c := controller.NewContext(ctx, wh, controller.ControllerOptions{WorkQueueName: queueName, Logger: logger.Named(queueName)}) + controllerOptions := wopts.ControllerOptions + if controllerOptions == nil { + const queueName = "DefaultingWebhook" + controllerOptions = &controller.ControllerOptions{WorkQueueName: queueName, Logger: logger.Named(queueName)} + } + c := controller.NewContext(ctx, wh, *controllerOptions) // Reconcile when the named MutatingWebhookConfiguration changes. mwhInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{ diff --git a/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/options.go b/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/options.go new file mode 100644 index 0000000000..deb04945ad --- /dev/null +++ b/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/options.go @@ -0,0 +1,64 @@ +/* +Copyright 2023 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package defaulting + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime/schema" + "knative.dev/pkg/webhook/resourcesemantics" +) + +type options struct { + path string + types map[schema.GroupVersionKind]resourcesemantics.GenericCRD + wc func(context.Context) context.Context + disallowUnknownFields bool + callbacks map[schema.GroupVersionKind]Callback +} + +type OptionFunc func(*options) + +func WithCallbacks(callbacks map[schema.GroupVersionKind]Callback) OptionFunc { + return func(o *options) { + o.callbacks = callbacks + } +} + +func WithPath(path string) OptionFunc { + return func(o *options) { + o.path = path + } +} + +func WithTypes(types map[schema.GroupVersionKind]resourcesemantics.GenericCRD) OptionFunc { + return func(o *options) { + o.types = types + } +} + +func WithWrapContext(f func(context.Context) context.Context) OptionFunc { + return func(o *options) { + o.wc = f + } +} + +func WithDisallowUnknownFields() OptionFunc { + return func(o *options) { + o.disallowUnknownFields = true + } +} diff --git a/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/controller.go b/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/controller.go index 8e8e008e6c..eee6105b45 100644 --- a/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/controller.go +++ b/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/controller.go @@ -45,10 +45,31 @@ func NewAdmissionControllerWithConfig( disallowUnknownFields bool, callbacks map[schema.GroupVersionKind]Callback, ) *controller.Impl { + + opts := []OptionFunc{ + WithPath(path), + WithTypes(handlers), + WithWrapContext(wc), + WithCallbacks(callbacks), + } + + if disallowUnknownFields { + opts = append(opts, WithDisallowUnknownFields()) + } + return newController(ctx, name, opts...) +} + +func newController(ctx context.Context, name string, optsFunc ...OptionFunc) *controller.Impl { client := kubeclient.Get(ctx) vwhInformer := vwhinformer.Get(ctx) secretInformer := secretinformer.Get(ctx) - options := webhook.GetOptions(ctx) + woptions := webhook.GetOptions(ctx) + + opts := &options{} + + for _, f := range optsFunc { + f(opts) + } wh := &reconciler{ LeaderAwareFuncs: pkgreconciler.LeaderAwareFuncs{ @@ -62,13 +83,13 @@ func NewAdmissionControllerWithConfig( key: types.NamespacedName{ Name: name, }, - path: path, - handlers: handlers, - callbacks: callbacks, + path: opts.path, + handlers: opts.types, + callbacks: opts.callbacks, - withContext: wc, - disallowUnknownFields: disallowUnknownFields, - secretName: options.SecretName, + withContext: opts.wc, + disallowUnknownFields: opts.DisallowUnknownFields(), + secretName: woptions.SecretName, client: client, vwhlister: vwhInformer.Lister(), @@ -76,8 +97,13 @@ func NewAdmissionControllerWithConfig( } logger := logging.FromContext(ctx) - const queueName = "ValidationWebhook" - c := controller.NewContext(ctx, wh, controller.ControllerOptions{WorkQueueName: queueName, Logger: logger.Named(queueName)}) + + controllerOptions := woptions.ControllerOptions + if woptions.ControllerOptions == nil { + const queueName = "ValidationWebhook" + controllerOptions = &controller.ControllerOptions{WorkQueueName: queueName, Logger: logger.Named(queueName)} + } + c := controller.NewContext(ctx, wh, *controllerOptions) // Reconcile when the named ValidatingWebhookConfiguration changes. vwhInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{ diff --git a/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/options.go b/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/options.go new file mode 100644 index 0000000000..108453b6eb --- /dev/null +++ b/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/options.go @@ -0,0 +1,68 @@ +/* +Copyright 2023 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime/schema" + "knative.dev/pkg/webhook/resourcesemantics" +) + +type options struct { + path string + types map[schema.GroupVersionKind]resourcesemantics.GenericCRD + wc func(context.Context) context.Context + disallowUnknownFields bool + callbacks map[schema.GroupVersionKind]Callback +} + +type OptionFunc func(*options) + +func WithCallbacks(callbacks map[schema.GroupVersionKind]Callback) OptionFunc { + return func(o *options) { + o.callbacks = callbacks + } +} + +func WithPath(path string) OptionFunc { + return func(o *options) { + o.path = path + } +} + +func WithTypes(types map[schema.GroupVersionKind]resourcesemantics.GenericCRD) OptionFunc { + return func(o *options) { + o.types = types + } +} + +func WithWrapContext(f func(context.Context) context.Context) OptionFunc { + return func(o *options) { + o.wc = f + } +} + +func WithDisallowUnknownFields() OptionFunc { + return func(o *options) { + o.disallowUnknownFields = true + } +} + +func (o *options) DisallowUnknownFields() bool { + return o.disallowUnknownFields +} diff --git a/vendor/knative.dev/pkg/webhook/webhook.go b/vendor/knative.dev/pkg/webhook/webhook.go index 779d388d22..92dd01ae35 100644 --- a/vendor/knative.dev/pkg/webhook/webhook.go +++ b/vendor/knative.dev/pkg/webhook/webhook.go @@ -22,11 +22,14 @@ import ( "errors" "fmt" "html" + "log" + "net" "net/http" "time" // Injection stuff + "knative.dev/pkg/controller" kubeinformerfactory "knative.dev/pkg/injection/clients/namespacedkube/informers/factory" "knative.dev/pkg/network/handlers" @@ -67,6 +70,10 @@ type Options struct { // GracePeriod is how long to wait after failing readiness probes // before shutting down. GracePeriod time.Duration + + // ControllerOptions encapsulates options for creating a new controller, + // including throttling and stats behavior. + ControllerOptions *controller.ControllerOptions } // Operation is the verb being operated on @@ -94,6 +101,9 @@ type Webhook struct { // The TLS configuration to use for serving (or nil for non-TLS) tlsConfig *tls.Config + + // testListener is only used in testing so we don't get port conflicts + testListener net.Listener } // New constructs a Webhook @@ -196,7 +206,6 @@ func New( default: return nil, fmt.Errorf("unknown webhook controller type: %T", controller) } - } return @@ -209,6 +218,15 @@ func (wh *Webhook) InformersHaveSynced() { wh.Logger.Info("Informers have been synced, unblocking admission webhooks.") } +type zapWrapper struct { + logger *zap.SugaredLogger +} + +func (z *zapWrapper) Write(p []byte) (n int, err error) { + z.logger.Errorw(string(p)) + return len(p), nil +} + // Run implements the admission controller run loop. func (wh *Webhook) Run(stop <-chan struct{}) error { logger := wh.Logger @@ -220,24 +238,34 @@ func (wh *Webhook) Run(stop <-chan struct{}) error { } server := &http.Server{ + ErrorLog: log.New(&zapWrapper{logger}, "", 0), Handler: drainer, Addr: fmt.Sprint(":", wh.Options.Port), TLSConfig: wh.tlsConfig, ReadHeaderTimeout: time.Minute, //https://medium.com/a-journey-with-go/go-understand-and-mitigate-slowloris-attack-711c1b1403f6 } + var serve = server.ListenAndServe + + if server.TLSConfig != nil && wh.testListener != nil { + serve = func() error { + return server.ServeTLS(wh.testListener, "", "") + } + } else if server.TLSConfig != nil { + serve = func() error { + return server.ListenAndServeTLS("", "") + } + } else if wh.testListener != nil { + serve = func() error { + return server.Serve(wh.testListener) + } + } + eg, ctx := errgroup.WithContext(ctx) eg.Go(func() error { - if server.TLSConfig != nil { - if err := server.ListenAndServeTLS("", ""); err != nil && !errors.Is(err, http.ErrServerClosed) { - logger.Errorw("ListenAndServeTLS for admission webhook returned error", zap.Error(err)) - return err - } - } else { - if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) { - logger.Errorw("ListenAndServe for admission webhook returned error", zap.Error(err)) - return err - } + if err := serve(); err != nil && !errors.Is(err, http.ErrServerClosed) { + logger.Errorw("ListenAndServe for admission webhook returned error", zap.Error(err)) + return err } return nil }) diff --git a/vendor/modules.txt b/vendor/modules.txt index 091d2308bc..9ff6017e0e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -2130,8 +2130,9 @@ k8s.io/utils/pointer k8s.io/utils/ptr k8s.io/utils/strings/slices k8s.io/utils/trace -# knative.dev/pkg v0.0.0-20230718152110-aef227e72ead => knative.dev/pkg v0.0.0-20230418073056-dfad48eaa5d0 +# knative.dev/pkg v0.0.0-20230718152110-aef227e72ead => knative.dev/pkg v0.0.0-20230718152110-aef227e72ead ## explicit; go 1.18 +knative.dev/pkg/apiextensions/storageversion knative.dev/pkg/apis knative.dev/pkg/apis/duck knative.dev/pkg/apis/duck/ducktypes @@ -2157,7 +2158,6 @@ knative.dev/pkg/controller knative.dev/pkg/environment knative.dev/pkg/hash knative.dev/pkg/injection -knative.dev/pkg/injection/clients/dynamicclient knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret knative.dev/pkg/injection/clients/namespacedkube/informers/factory knative.dev/pkg/injection/sharedmain @@ -2224,4 +2224,4 @@ sigs.k8s.io/yaml # k8s.io/client-go => k8s.io/client-go v0.25.9 # k8s.io/code-generator => k8s.io/code-generator v0.25.9 # k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20230525220651-2546d827e515 -# knative.dev/pkg => knative.dev/pkg v0.0.0-20230418073056-dfad48eaa5d0 +# knative.dev/pkg => knative.dev/pkg v0.0.0-20230718152110-aef227e72ead