From 1228b41851ae99b8d0bc49d3bbdf198df7c7c4ea Mon Sep 17 00:00:00 2001 From: Scott Seago Date: Fri, 26 Jul 2024 19:05:34 -0400 Subject: [PATCH 1/3] Internal ItemBlockAction plugins This PR implements the internal ItemBlockAction plugins needed for pod, PVC, and SA. Signed-off-by: Scott Seago --- changelogs/unreleased/8054-sseago | 1 + pkg/backup/actions/backup_pv_action.go | 10 +- pkg/backup/actions/pod_action.go | 31 +- pkg/backup/actions/service_account_action.go | 61 +- .../actions/service_account_action_test.go | 53 +- pkg/cmd/server/plugin/plugin.go | 51 +- pkg/itemblock/actions/pod_action.go | 63 ++ pkg/itemblock/actions/pod_action_test.go | 148 +++++ pkg/itemblock/actions/pvc_action.go | 113 ++++ pkg/itemblock/actions/pvc_action_test.go | 167 +++++ .../actions/service_account_action.go | 73 +++ .../actions/service_account_action_test.go | 609 ++++++++++++++++++ pkg/util/actionhelpers/pod_helper.go | 53 ++ pkg/util/actionhelpers/pvc_helper.go | 34 + .../actions => util/actionhelpers}/rbac.go | 56 +- .../actionhelpers/service_account_helper.go | 84 +++ 16 files changed, 1460 insertions(+), 147 deletions(-) create mode 100644 changelogs/unreleased/8054-sseago create mode 100644 pkg/itemblock/actions/pod_action.go create mode 100644 pkg/itemblock/actions/pod_action_test.go create mode 100644 pkg/itemblock/actions/pvc_action.go create mode 100644 pkg/itemblock/actions/pvc_action_test.go create mode 100644 pkg/itemblock/actions/service_account_action.go create mode 100644 pkg/itemblock/actions/service_account_action_test.go create mode 100644 pkg/util/actionhelpers/pod_helper.go create mode 100644 pkg/util/actionhelpers/pvc_helper.go rename pkg/{backup/actions => util/actionhelpers}/rbac.go (71%) create mode 100644 pkg/util/actionhelpers/service_account_helper.go diff --git a/changelogs/unreleased/8054-sseago b/changelogs/unreleased/8054-sseago new file mode 100644 index 000000000..0060d7276 --- /dev/null +++ b/changelogs/unreleased/8054-sseago @@ -0,0 +1 @@ +Internal ItemBlockAction plugins diff --git a/pkg/backup/actions/backup_pv_action.go b/pkg/backup/actions/backup_pv_action.go index f5a65555c..4b8a44ef6 100644 --- a/pkg/backup/actions/backup_pv_action.go +++ b/pkg/backup/actions/backup_pv_action.go @@ -26,8 +26,8 @@ import ( "k8s.io/apimachinery/pkg/runtime" v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "github.com/vmware-tanzu/velero/pkg/kuberesource" "github.com/vmware-tanzu/velero/pkg/plugin/velero" + "github.com/vmware-tanzu/velero/pkg/util/actionhelpers" ) // PVCAction inspects a PersistentVolumeClaim for the PersistentVolume @@ -51,7 +51,7 @@ func (a *PVCAction) AppliesTo() (velero.ResourceSelector, error) { func (a *PVCAction) Execute(item runtime.Unstructured, backup *v1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error) { a.log.Info("Executing PVCAction") - var pvc corev1api.PersistentVolumeClaim + pvc := new(corev1api.PersistentVolumeClaim) if err := runtime.DefaultUnstructuredConverter.FromUnstructured(item.UnstructuredContent(), &pvc); err != nil { return nil, nil, errors.Wrap(err, "unable to convert unstructured item to persistent volume claim") } @@ -60,10 +60,6 @@ func (a *PVCAction) Execute(item runtime.Unstructured, backup *v1.Backup) (runti return item, nil, nil } - pv := velero.ResourceIdentifier{ - GroupResource: kuberesource.PersistentVolumes, - Name: pvc.Spec.VolumeName, - } // remove dataSource if exists from prior restored CSI volumes if pvc.Spec.DataSource != nil { pvc.Spec.DataSource = nil @@ -94,5 +90,5 @@ func (a *PVCAction) Execute(item runtime.Unstructured, backup *v1.Backup) (runti return nil, nil, errors.Wrap(err, "unable to convert pvc to unstructured item") } - return &unstructured.Unstructured{Object: pvcMap}, []velero.ResourceIdentifier{pv}, nil + return &unstructured.Unstructured{Object: pvcMap}, actionhelpers.RelatedItemsForPVC(pvc, a.log), nil } diff --git a/pkg/backup/actions/pod_action.go b/pkg/backup/actions/pod_action.go index ce6b1ade8..8ed5e3b44 100644 --- a/pkg/backup/actions/pod_action.go +++ b/pkg/backup/actions/pod_action.go @@ -23,8 +23,8 @@ import ( "k8s.io/apimachinery/pkg/runtime" v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "github.com/vmware-tanzu/velero/pkg/kuberesource" "github.com/vmware-tanzu/velero/pkg/plugin/velero" + "github.com/vmware-tanzu/velero/pkg/util/actionhelpers" ) // PodAction implements ItemAction. @@ -55,32 +55,5 @@ func (a *PodAction) Execute(item runtime.Unstructured, backup *v1.Backup) (runti if err := runtime.DefaultUnstructuredConverter.FromUnstructured(item.UnstructuredContent(), pod); err != nil { return nil, nil, errors.WithStack(err) } - - var additionalItems []velero.ResourceIdentifier - if pod.Spec.PriorityClassName != "" { - a.log.Infof("Adding priorityclass %s to additionalItems", pod.Spec.PriorityClassName) - additionalItems = append(additionalItems, velero.ResourceIdentifier{ - GroupResource: kuberesource.PriorityClasses, - Name: pod.Spec.PriorityClassName, - }) - } - - if len(pod.Spec.Volumes) == 0 { - a.log.Info("pod has no volumes") - return item, additionalItems, nil - } - - for _, volume := range pod.Spec.Volumes { - if volume.PersistentVolumeClaim != nil && volume.PersistentVolumeClaim.ClaimName != "" { - a.log.Infof("Adding pvc %s to additionalItems", volume.PersistentVolumeClaim.ClaimName) - - additionalItems = append(additionalItems, velero.ResourceIdentifier{ - GroupResource: kuberesource.PersistentVolumeClaims, - Namespace: pod.Namespace, - Name: volume.PersistentVolumeClaim.ClaimName, - }) - } - } - - return item, additionalItems, nil + return item, actionhelpers.RelatedItemsForPod(pod, a.log), nil } diff --git a/pkg/backup/actions/service_account_action.go b/pkg/backup/actions/service_account_action.go index c7a3649c4..b563f7a03 100644 --- a/pkg/backup/actions/service_account_action.go +++ b/pkg/backup/actions/service_account_action.go @@ -19,40 +19,24 @@ package actions import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" - rbac "k8s.io/api/rbac/v1" "k8s.io/apimachinery/pkg/api/meta" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/sets" v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" velerodiscovery "github.com/vmware-tanzu/velero/pkg/discovery" - "github.com/vmware-tanzu/velero/pkg/kuberesource" "github.com/vmware-tanzu/velero/pkg/plugin/velero" + "github.com/vmware-tanzu/velero/pkg/util/actionhelpers" ) // ServiceAccountAction implements ItemAction. type ServiceAccountAction struct { log logrus.FieldLogger - clusterRoleBindings []ClusterRoleBinding + clusterRoleBindings []actionhelpers.ClusterRoleBinding } // NewServiceAccountAction creates a new ItemAction for service accounts. -func NewServiceAccountAction(logger logrus.FieldLogger, clusterRoleBindingListers map[string]ClusterRoleBindingLister, discoveryHelper velerodiscovery.Helper) (*ServiceAccountAction, error) { - // Look up the supported RBAC version - var supportedAPI metav1.GroupVersionForDiscovery - for _, ag := range discoveryHelper.APIGroups() { - if ag.Name == rbac.GroupName { - supportedAPI = ag.PreferredVersion - break - } - } - - crbLister := clusterRoleBindingListers[supportedAPI.Version] - - // This should be safe because the List call will return a 0-item slice - // if there's no matching API version. - crbs, err := crbLister.List() +func NewServiceAccountAction(logger logrus.FieldLogger, clusterRoleBindingListers map[string]actionhelpers.ClusterRoleBindingLister, discoveryHelper velerodiscovery.Helper) (*ServiceAccountAction, error) { + crbs, err := actionhelpers.ClusterRoleBindingsForAction(clusterRoleBindingListers, discoveryHelper) if err != nil { return nil, err } @@ -82,40 +66,5 @@ func (a *ServiceAccountAction) Execute(item runtime.Unstructured, backup *v1.Bac return nil, nil, errors.WithStack(err) } - var ( - namespace = objectMeta.GetNamespace() - name = objectMeta.GetName() - bindings = sets.NewString() - roles = sets.NewString() - ) - - for _, crb := range a.clusterRoleBindings { - for _, s := range crb.ServiceAccountSubjects(namespace) { - if s == name { - a.log.Infof("Adding clusterrole %s and clusterrolebinding %s to additionalItems since serviceaccount %s/%s is a subject", - crb.RoleRefName(), crb.Name(), namespace, name) - - bindings.Insert(crb.Name()) - roles.Insert(crb.RoleRefName()) - break - } - } - } - - var additionalItems []velero.ResourceIdentifier - for binding := range bindings { - additionalItems = append(additionalItems, velero.ResourceIdentifier{ - GroupResource: kuberesource.ClusterRoleBindings, - Name: binding, - }) - } - - for role := range roles { - additionalItems = append(additionalItems, velero.ResourceIdentifier{ - GroupResource: kuberesource.ClusterRoles, - Name: role, - }) - } - - return item, additionalItems, nil + return item, actionhelpers.RelatedItemsForServiceAccount(objectMeta, a.clusterRoleBindings, a.log), nil } diff --git a/pkg/backup/actions/service_account_action_test.go b/pkg/backup/actions/service_account_action_test.go index 5ef441e6f..1ea578ce0 100644 --- a/pkg/backup/actions/service_account_action_test.go +++ b/pkg/backup/actions/service_account_action_test.go @@ -31,21 +31,22 @@ import ( "github.com/vmware-tanzu/velero/pkg/kuberesource" "github.com/vmware-tanzu/velero/pkg/plugin/velero" velerotest "github.com/vmware-tanzu/velero/pkg/test" + "github.com/vmware-tanzu/velero/pkg/util/actionhelpers" ) -func newV1ClusterRoleBindingList(rbacCRBList []rbac.ClusterRoleBinding) []ClusterRoleBinding { - var crbs []ClusterRoleBinding +func newV1ClusterRoleBindingList(rbacCRBList []rbac.ClusterRoleBinding) []actionhelpers.ClusterRoleBinding { + var crbs []actionhelpers.ClusterRoleBinding for _, c := range rbacCRBList { - crbs = append(crbs, v1ClusterRoleBinding{crb: c}) + crbs = append(crbs, actionhelpers.V1ClusterRoleBinding{Crb: c}) } return crbs } -func newV1beta1ClusterRoleBindingList(rbacCRBList []rbacbeta.ClusterRoleBinding) []ClusterRoleBinding { - var crbs []ClusterRoleBinding +func newV1beta1ClusterRoleBindingList(rbacCRBList []rbacbeta.ClusterRoleBinding) []actionhelpers.ClusterRoleBinding { + var crbs []actionhelpers.ClusterRoleBinding for _, c := range rbacCRBList { - crbs = append(crbs, v1beta1ClusterRoleBinding{crb: c}) + crbs = append(crbs, actionhelpers.V1beta1ClusterRoleBinding{Crb: c}) } return crbs @@ -55,10 +56,10 @@ type FakeV1ClusterRoleBindingLister struct { v1crbs []rbac.ClusterRoleBinding } -func (f FakeV1ClusterRoleBindingLister) List() ([]ClusterRoleBinding, error) { - var crbs []ClusterRoleBinding +func (f FakeV1ClusterRoleBindingLister) List() ([]actionhelpers.ClusterRoleBinding, error) { + var crbs []actionhelpers.ClusterRoleBinding for _, c := range f.v1crbs { - crbs = append(crbs, v1ClusterRoleBinding{crb: c}) + crbs = append(crbs, actionhelpers.V1ClusterRoleBinding{Crb: c}) } return crbs, nil } @@ -67,10 +68,10 @@ type FakeV1beta1ClusterRoleBindingLister struct { v1beta1crbs []rbacbeta.ClusterRoleBinding } -func (f FakeV1beta1ClusterRoleBindingLister) List() ([]ClusterRoleBinding, error) { - var crbs []ClusterRoleBinding +func (f FakeV1beta1ClusterRoleBindingLister) List() ([]actionhelpers.ClusterRoleBinding, error) { + var crbs []actionhelpers.ClusterRoleBinding for _, c := range f.v1beta1crbs { - crbs = append(crbs, v1beta1ClusterRoleBinding{crb: c}) + crbs = append(crbs, actionhelpers.V1beta1ClusterRoleBinding{Crb: c}) } return crbs, nil } @@ -93,21 +94,21 @@ func TestNewServiceAccountAction(t *testing.T) { tests := []struct { name string version string - expectedCRBs []ClusterRoleBinding + expectedCRBs []actionhelpers.ClusterRoleBinding }{ { name: "rbac v1 API instantiates an saAction", version: rbac.SchemeGroupVersion.Version, - expectedCRBs: []ClusterRoleBinding{ - v1ClusterRoleBinding{ - crb: rbac.ClusterRoleBinding{ + expectedCRBs: []actionhelpers.ClusterRoleBinding{ + actionhelpers.V1ClusterRoleBinding{ + Crb: rbac.ClusterRoleBinding{ ObjectMeta: metav1.ObjectMeta{ Name: "v1crb-1", }, }, }, - v1ClusterRoleBinding{ - crb: rbac.ClusterRoleBinding{ + actionhelpers.V1ClusterRoleBinding{ + Crb: rbac.ClusterRoleBinding{ ObjectMeta: metav1.ObjectMeta{ Name: "v1crb-2", }, @@ -118,16 +119,16 @@ func TestNewServiceAccountAction(t *testing.T) { { name: "rbac v1beta1 API instantiates an saAction", version: rbacbeta.SchemeGroupVersion.Version, - expectedCRBs: []ClusterRoleBinding{ - v1beta1ClusterRoleBinding{ - crb: rbacbeta.ClusterRoleBinding{ + expectedCRBs: []actionhelpers.ClusterRoleBinding{ + actionhelpers.V1beta1ClusterRoleBinding{ + Crb: rbacbeta.ClusterRoleBinding{ ObjectMeta: metav1.ObjectMeta{ Name: "v1beta1crb-1", }, }, }, - v1beta1ClusterRoleBinding{ - crb: rbacbeta.ClusterRoleBinding{ + actionhelpers.V1beta1ClusterRoleBinding{ + Crb: rbacbeta.ClusterRoleBinding{ ObjectMeta: metav1.ObjectMeta{ Name: "v1beta1crb-2", }, @@ -138,7 +139,7 @@ func TestNewServiceAccountAction(t *testing.T) { { name: "no RBAC API instantiates an saAction with empty slice", version: "", - expectedCRBs: []ClusterRoleBinding{}, + expectedCRBs: []actionhelpers.ClusterRoleBinding{}, }, } // Set up all of our fakes outside the test loop @@ -171,10 +172,10 @@ func TestNewServiceAccountAction(t *testing.T) { }, } - clusterRoleBindingListers := map[string]ClusterRoleBindingLister{ + clusterRoleBindingListers := map[string]actionhelpers.ClusterRoleBindingLister{ rbac.SchemeGroupVersion.Version: FakeV1ClusterRoleBindingLister{v1crbs: v1crbs}, rbacbeta.SchemeGroupVersion.Version: FakeV1beta1ClusterRoleBindingLister{v1beta1crbs: v1beta1crbs}, - "": noopClusterRoleBindingLister{}, + "": actionhelpers.NoopClusterRoleBindingLister{}, } for _, test := range tests { diff --git a/pkg/cmd/server/plugin/plugin.go b/pkg/cmd/server/plugin/plugin.go index 0f729f3ac..265d52607 100644 --- a/pkg/cmd/server/plugin/plugin.go +++ b/pkg/cmd/server/plugin/plugin.go @@ -30,10 +30,12 @@ import ( "github.com/vmware-tanzu/velero/pkg/client" velerodiscovery "github.com/vmware-tanzu/velero/pkg/discovery" "github.com/vmware-tanzu/velero/pkg/features" + iba "github.com/vmware-tanzu/velero/pkg/itemblock/actions" veleroplugin "github.com/vmware-tanzu/velero/pkg/plugin/framework" plugincommon "github.com/vmware-tanzu/velero/pkg/plugin/framework/common" ria "github.com/vmware-tanzu/velero/pkg/restore/actions" csiria "github.com/vmware-tanzu/velero/pkg/restore/actions/csi" + "github.com/vmware-tanzu/velero/pkg/util/actionhelpers" ) func NewCommand(f client.Factory) *cobra.Command { @@ -171,6 +173,18 @@ func NewCommand(f client.Factory) *cobra.Command { RegisterRestoreItemActionV2( "velero.io/csi-volumesnapshotclass-restorer", newVolumeSnapshotClassRestoreItemAction, + ). + RegisterItemBlockAction( + "velero.io/pvc", + newPVCItemBlockAction(f), + ). + RegisterItemBlockAction( + "velero.io/pod", + newPodItemBlockAction, + ). + RegisterItemBlockAction( + "velero.io/service-account", + newServiceAccountItemBlockAction(f), ) if !features.IsEnabled(velerov1api.APIGroupVersionsFeatureFlag) { @@ -211,7 +225,7 @@ func newServiceAccountBackupItemAction(f client.Factory) plugincommon.HandlerIni action, err := bia.NewServiceAccountAction( logger, - bia.NewClusterRoleBindingListerMap(clientset), + actionhelpers.NewClusterRoleBindingListerMap(clientset), discoveryHelper) if err != nil { return nil, err @@ -431,3 +445,38 @@ func newVolumeSnapshotContentRestoreItemAction(logger logrus.FieldLogger) (inter func newVolumeSnapshotClassRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { return csiria.NewVolumeSnapshotClassRestoreItemAction(logger) } + +// ItemBlockAction plugins + +func newPVCItemBlockAction(f client.Factory) plugincommon.HandlerInitializer { + return iba.NewPVCAction(f) +} + +func newPodItemBlockAction(logger logrus.FieldLogger) (interface{}, error) { + return iba.NewPodAction(logger), nil +} + +func newServiceAccountItemBlockAction(f client.Factory) plugincommon.HandlerInitializer { + return func(logger logrus.FieldLogger) (interface{}, error) { + // TODO(ncdc): consider a k8s style WantsKubernetesClientSet initialization approach + clientset, err := f.KubeClient() + if err != nil { + return nil, err + } + + discoveryHelper, err := velerodiscovery.NewHelper(clientset.Discovery(), logger) + if err != nil { + return nil, err + } + + action, err := iba.NewServiceAccountAction( + logger, + actionhelpers.NewClusterRoleBindingListerMap(clientset), + discoveryHelper) + if err != nil { + return nil, err + } + + return action, nil + } +} diff --git a/pkg/itemblock/actions/pod_action.go b/pkg/itemblock/actions/pod_action.go new file mode 100644 index 000000000..2596e78a2 --- /dev/null +++ b/pkg/itemblock/actions/pod_action.go @@ -0,0 +1,63 @@ +/* +Copyright the Velero contributors. + +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 actions + +import ( + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + corev1api "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime" + + v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" + "github.com/vmware-tanzu/velero/pkg/plugin/velero" + "github.com/vmware-tanzu/velero/pkg/util/actionhelpers" +) + +// PodAction implements ItemBlockAction. +type PodAction struct { + log logrus.FieldLogger +} + +// NewPodAction creates a new ItemBlockAction for pods. +func NewPodAction(logger logrus.FieldLogger) *PodAction { + return &PodAction{log: logger} +} + +// AppliesTo returns a ResourceSelector that applies only to pods. +func (a *PodAction) AppliesTo() (velero.ResourceSelector, error) { + return velero.ResourceSelector{ + IncludedResources: []string{"pods"}, + }, nil +} + +// GetRelatedItems scans the pod's spec.volumes for persistentVolumeClaim volumes and returns a +// ResourceIdentifier list containing references to all of the persistentVolumeClaim volumes used by +// the pod. This ensures that when a pod is backed up, all referenced PVCs are backed up along with the pod. +func (a *PodAction) GetRelatedItems(item runtime.Unstructured, backup *v1.Backup) ([]velero.ResourceIdentifier, error) { + a.log.Info("Executing pod ItemBlockAction") + defer a.log.Info("Done executing pod ItemBlockAction") + + pod := new(corev1api.Pod) + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(item.UnstructuredContent(), pod); err != nil { + return nil, errors.WithStack(err) + } + return actionhelpers.RelatedItemsForPod(pod, a.log), nil +} + +func (a *PodAction) Name() string { + return "PodItemBlockAction" +} diff --git a/pkg/itemblock/actions/pod_action_test.go b/pkg/itemblock/actions/pod_action_test.go new file mode 100644 index 000000000..645feeee2 --- /dev/null +++ b/pkg/itemblock/actions/pod_action_test.go @@ -0,0 +1,148 @@ +/* +Copyright the Velero contributors. + +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 actions + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "k8s.io/apimachinery/pkg/runtime" + + "github.com/vmware-tanzu/velero/pkg/kuberesource" + "github.com/vmware-tanzu/velero/pkg/plugin/velero" + velerotest "github.com/vmware-tanzu/velero/pkg/test" +) + +func TestPodActionAppliesTo(t *testing.T) { + a := NewPodAction(velerotest.NewLogger()) + + actual, err := a.AppliesTo() + require.NoError(t, err) + + expected := velero.ResourceSelector{ + IncludedResources: []string{"pods"}, + } + assert.Equal(t, expected, actual) +} + +func TestPodActionGetRelatedItems(t *testing.T) { + tests := []struct { + name string + pod runtime.Unstructured + expected []velero.ResourceIdentifier + }{ + { + name: "no spec.volumes", + pod: velerotest.UnstructuredOrDie(` + { + "apiVersion": "v1", + "kind": "Pod", + "metadata": { + "namespace": "foo", + "name": "bar" + } + } + `), + }, + { + name: "persistentVolumeClaim without claimName", + pod: velerotest.UnstructuredOrDie(` + { + "apiVersion": "v1", + "kind": "Pod", + "metadata": { + "namespace": "foo", + "name": "bar" + }, + "spec": { + "volumes": [ + { + "persistentVolumeClaim": {} + } + ] + } + } + `), + }, + { + name: "full test, mix of volume types", + pod: velerotest.UnstructuredOrDie(` + { + "apiVersion": "v1", + "kind": "Pod", + "metadata": { + "namespace": "foo", + "name": "bar" + }, + "spec": { + "volumes": [ + { + "persistentVolumeClaim": {} + }, + { + "emptyDir": {} + }, + { + "persistentVolumeClaim": {"claimName": "claim1"} + }, + { + "emptyDir": {} + }, + { + "persistentVolumeClaim": {"claimName": "claim2"} + } + ] + } + } + `), + expected: []velero.ResourceIdentifier{ + {GroupResource: kuberesource.PersistentVolumeClaims, Namespace: "foo", Name: "claim1"}, + {GroupResource: kuberesource.PersistentVolumeClaims, Namespace: "foo", Name: "claim2"}, + }, + }, + { + name: "test priority class", + pod: velerotest.UnstructuredOrDie(` + { + "apiVersion": "v1", + "kind": "Pod", + "metadata": { + "namespace": "foo", + "name": "bar" + }, + "spec": { + "priorityClassName": "testPriorityClass" + } + } + `), + expected: []velero.ResourceIdentifier{ + {GroupResource: kuberesource.PriorityClasses, Name: "testPriorityClass"}, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + a := NewPodAction(velerotest.NewLogger()) + + relatedItems, err := a.GetRelatedItems(test.pod, nil) + require.NoError(t, err) + assert.Equal(t, test.expected, relatedItems) + }) + } +} diff --git a/pkg/itemblock/actions/pvc_action.go b/pkg/itemblock/actions/pvc_action.go new file mode 100644 index 000000000..4ec99d03b --- /dev/null +++ b/pkg/itemblock/actions/pvc_action.go @@ -0,0 +1,113 @@ +/* +Copyright the Velero contributors. + +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 actions + +import ( + "context" + + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + corev1api "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime" + crclient "sigs.k8s.io/controller-runtime/pkg/client" + + v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" + "github.com/vmware-tanzu/velero/pkg/client" + "github.com/vmware-tanzu/velero/pkg/kuberesource" + plugincommon "github.com/vmware-tanzu/velero/pkg/plugin/framework/common" + "github.com/vmware-tanzu/velero/pkg/plugin/velero" + "github.com/vmware-tanzu/velero/pkg/util/actionhelpers" + "github.com/vmware-tanzu/velero/pkg/util/kube" +) + +// PVCAction inspects a PersistentVolumeClaim for the PersistentVolume +// that it references and backs it up +type PVCAction struct { + log logrus.FieldLogger + crClient crclient.Client +} + +func NewPVCAction(f client.Factory) plugincommon.HandlerInitializer { + return func(logger logrus.FieldLogger) (interface{}, error) { + crClient, err := f.KubebuilderClient() + if err != nil { + return nil, errors.WithStack(err) + } + + return &PVCAction{ + log: logger, + crClient: crClient, + }, nil + } +} + +func (a *PVCAction) AppliesTo() (velero.ResourceSelector, error) { + return velero.ResourceSelector{ + IncludedResources: []string{"persistentvolumeclaims"}, + }, nil +} + +func (a *PVCAction) GetRelatedItems(item runtime.Unstructured, backup *v1.Backup) ([]velero.ResourceIdentifier, error) { + a.log.Info("Executing PVC ItemBlockAction") + defer a.log.Info("Done executing PVC ItemBlockAction") + + pvc := new(corev1api.PersistentVolumeClaim) + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(item.UnstructuredContent(), &pvc); err != nil { + return nil, errors.Wrap(err, "unable to convert unstructured item to persistent volume claim") + } + + if pvc.Status.Phase != corev1api.ClaimBound || pvc.Spec.VolumeName == "" { + return nil, nil + } + // returns the PV for the PVC (shared with BIA additionalItems) + relatedItems := actionhelpers.RelatedItemsForPVC(pvc, a.log) + + // Adds pods mounting this PVC to ensure that multiple pods mounting the same RWX + // volume get backed up together. + pods := new(corev1api.PodList) + err := a.crClient.List(context.Background(), pods, crclient.InNamespace(pvc.Namespace)) + if err != nil { + return nil, errors.Wrap(err, "failed to list pods") + } + + for i := range pods.Items { + for _, volume := range pods.Items[i].Spec.Volumes { + if volume.VolumeSource.PersistentVolumeClaim == nil { + continue + } + if volume.PersistentVolumeClaim.ClaimName == pvc.Name { + if kube.IsPodRunning(&pods.Items[i]) != nil { + a.log.Infof("Related pod %s is not running, not adding to ItemBlock for PVC %s", pods.Items[i].Name, pvc.Name) + } else { + a.log.Infof("Adding related Pod %s to PVC %s", pods.Items[i].Name, pvc.Name) + relatedItems = append(relatedItems, velero.ResourceIdentifier{ + GroupResource: kuberesource.Pods, + Namespace: pods.Items[i].Namespace, + Name: pods.Items[i].Name, + }) + } + break + } + } + } + + return relatedItems, nil +} + +func (a *PVCAction) Name() string { + return "PodItemBlockAction" +} diff --git a/pkg/itemblock/actions/pvc_action_test.go b/pkg/itemblock/actions/pvc_action_test.go new file mode 100644 index 000000000..c485dcd80 --- /dev/null +++ b/pkg/itemblock/actions/pvc_action_test.go @@ -0,0 +1,167 @@ +/* +Copyright 2017 the Velero contributors. + +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 actions + +import ( + "context" + "fmt" + "testing" + + "github.com/sirupsen/logrus" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + corev1api "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + + v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" + "github.com/vmware-tanzu/velero/pkg/builder" + factorymocks "github.com/vmware-tanzu/velero/pkg/client/mocks" + "github.com/vmware-tanzu/velero/pkg/kuberesource" + "github.com/vmware-tanzu/velero/pkg/plugin/velero" + velerotest "github.com/vmware-tanzu/velero/pkg/test" +) + +func TestBackupPVAction(t *testing.T) { + tests := []struct { + name string + pvc *corev1api.PersistentVolumeClaim + pods []*corev1api.Pod + expectedErr error + expectedRelated []velero.ResourceIdentifier + }{ + { + name: "Test no volumeName", + pvc: builder.ForPersistentVolumeClaim("velero", "testPVC").Phase(corev1api.ClaimBound).Result(), + expectedErr: nil, + expectedRelated: nil, + }, + { + name: "Test empty volumeName", + pvc: builder.ForPersistentVolumeClaim("velero", "testPVC").VolumeName("").Phase(corev1api.ClaimBound).Result(), + expectedErr: nil, + expectedRelated: nil, + }, + { + name: "Test no status phase", + pvc: builder.ForPersistentVolumeClaim("velero", "testPVC").VolumeName("testPV").Result(), + expectedErr: nil, + expectedRelated: nil, + }, + { + name: "Test pending status phase", + pvc: builder.ForPersistentVolumeClaim("velero", "testPVC").VolumeName("testPV").Phase(corev1api.ClaimPending).Result(), + expectedErr: nil, + expectedRelated: nil, + }, + { + name: "Test lost status phase", + pvc: builder.ForPersistentVolumeClaim("velero", "testPVC").VolumeName("testPV").Phase(corev1api.ClaimLost).Result(), + expectedErr: nil, + expectedRelated: nil, + }, + { + name: "Test with volume", + pvc: builder.ForPersistentVolumeClaim("velero", "testPVC").VolumeName("testPV").Phase(corev1api.ClaimBound).Result(), + expectedErr: nil, + expectedRelated: []velero.ResourceIdentifier{ + {GroupResource: kuberesource.PersistentVolumes, Name: "testPV"}, + }, + }, + { + name: "Test with volume and one running pod", + pvc: builder.ForPersistentVolumeClaim("velero", "testPVC").VolumeName("testPV").Phase(corev1api.ClaimBound).Result(), + pods: []*corev1api.Pod{ + builder.ForPod("velero", "testPod1").Volumes(builder.ForVolume("testPVC").PersistentVolumeClaimSource("testPVC").Result()).NodeName("velero").Phase(corev1api.PodRunning).Result(), + }, + expectedErr: nil, + expectedRelated: []velero.ResourceIdentifier{ + {GroupResource: kuberesource.PersistentVolumes, Name: "testPV"}, + {GroupResource: kuberesource.Pods, Namespace: "velero", Name: "testPod1"}, + }, + }, + { + name: "Test with volume and multiple running pods", + pvc: builder.ForPersistentVolumeClaim("velero", "testPVC").VolumeName("testPV").Phase(corev1api.ClaimBound).Result(), + pods: []*corev1api.Pod{ + builder.ForPod("velero", "testPod1").Volumes(builder.ForVolume("testPVC").PersistentVolumeClaimSource("testPVC").Result()).NodeName("velero").Phase(corev1api.PodRunning).Result(), + builder.ForPod("velero", "testPod2").Volumes(builder.ForVolume("testPVC").PersistentVolumeClaimSource("testPVC").Result()).NodeName("velero").Phase(corev1api.PodRunning).Result(), + builder.ForPod("velero", "testPod3").Volumes(builder.ForVolume("testPVC").PersistentVolumeClaimSource("testPVC").Result()).NodeName("velero").Phase(corev1api.PodRunning).Result(), + }, + expectedErr: nil, + expectedRelated: []velero.ResourceIdentifier{ + {GroupResource: kuberesource.PersistentVolumes, Name: "testPV"}, + {GroupResource: kuberesource.Pods, Namespace: "velero", Name: "testPod1"}, + {GroupResource: kuberesource.Pods, Namespace: "velero", Name: "testPod2"}, + {GroupResource: kuberesource.Pods, Namespace: "velero", Name: "testPod3"}, + }, + }, + { + name: "Test with volume and multiple running pods, some not running", + pvc: builder.ForPersistentVolumeClaim("velero", "testPVC").VolumeName("testPV").Phase(corev1api.ClaimBound).Result(), + pods: []*corev1api.Pod{ + builder.ForPod("velero", "testPod1").Volumes(builder.ForVolume("testPVC").PersistentVolumeClaimSource("testPVC").Result()).NodeName("velero").Phase(corev1api.PodSucceeded).Result(), + builder.ForPod("velero", "testPod2").Volumes(builder.ForVolume("testPVC").PersistentVolumeClaimSource("testPVC").Result()).NodeName("velero").Phase(corev1api.PodRunning).Result(), + builder.ForPod("velero", "testPod3").Volumes(builder.ForVolume("testPVC").PersistentVolumeClaimSource("testPVC").Result()).Phase(corev1api.PodRunning).Result(), + }, + expectedErr: nil, + expectedRelated: []velero.ResourceIdentifier{ + {GroupResource: kuberesource.PersistentVolumes, Name: "testPV"}, + {GroupResource: kuberesource.Pods, Namespace: "velero", Name: "testPod2"}, + }, + }, + } + + backup := &v1.Backup{} + logger := logrus.New() + + f := &factorymocks.Factory{} + f.On("KubebuilderClient").Return(nil, fmt.Errorf("")) + plugin := NewPVCAction(f) + _, err := plugin(logger) + require.Error(t, err) + + for _, tc := range tests { + t.Run(tc.name, func(*testing.T) { + crClient := velerotest.NewFakeControllerRuntimeClient(t) + f := &factorymocks.Factory{} + f.On("KubebuilderClient").Return(crClient, nil) + plugin := NewPVCAction(f) + i, err := plugin(logger) + require.NoError(t, err) + a := i.(*PVCAction) + + if tc.pvc != nil { + require.NoError(t, crClient.Create(context.Background(), tc.pvc)) + } + for _, pod := range tc.pods { + require.NoError(t, crClient.Create(context.Background(), pod)) + } + + pvcMap, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&tc.pvc) + require.NoError(t, err) + + relatedItems, err := a.GetRelatedItems(&unstructured.Unstructured{Object: pvcMap}, backup) + if tc.expectedErr != nil { + require.EqualError(t, err, tc.expectedErr.Error()) + } else { + require.NoError(t, err) + } + assert.Equal(t, tc.expectedRelated, relatedItems) + }) + } +} diff --git a/pkg/itemblock/actions/service_account_action.go b/pkg/itemblock/actions/service_account_action.go new file mode 100644 index 000000000..91cdbbe59 --- /dev/null +++ b/pkg/itemblock/actions/service_account_action.go @@ -0,0 +1,73 @@ +/* +Copyright the Velero contributors. + +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 actions + +import ( + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/runtime" + + v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" + velerodiscovery "github.com/vmware-tanzu/velero/pkg/discovery" + "github.com/vmware-tanzu/velero/pkg/plugin/velero" + "github.com/vmware-tanzu/velero/pkg/util/actionhelpers" +) + +// ServiceAccountAction implements ItemBlockAction. +type ServiceAccountAction struct { + log logrus.FieldLogger + clusterRoleBindings []actionhelpers.ClusterRoleBinding +} + +// NewServiceAccountAction creates a new ItemBlockAction for service accounts. +func NewServiceAccountAction(logger logrus.FieldLogger, clusterRoleBindingListers map[string]actionhelpers.ClusterRoleBindingLister, discoveryHelper velerodiscovery.Helper) (*ServiceAccountAction, error) { + crbs, err := actionhelpers.ClusterRoleBindingsForAction(clusterRoleBindingListers, discoveryHelper) + if err != nil { + return nil, err + } + + return &ServiceAccountAction{ + log: logger, + clusterRoleBindings: crbs, + }, nil +} + +// AppliesTo returns a ResourceSelector that applies only to service accounts. +func (a *ServiceAccountAction) AppliesTo() (velero.ResourceSelector, error) { + return velero.ResourceSelector{ + IncludedResources: []string{"serviceaccounts"}, + }, nil +} + +// GetRelatedItems checks for any ClusterRoleBindings that have this service account as a subject, and +// returns the ClusterRoleBinding and associated ClusterRole. +func (a *ServiceAccountAction) GetRelatedItems(item runtime.Unstructured, backup *v1.Backup) ([]velero.ResourceIdentifier, error) { + a.log.Info("Running ServiceAccount ItemBlockAction") + defer a.log.Info("Done running ServiceAccount ItemBlockAction") + + objectMeta, err := meta.Accessor(item) + if err != nil { + return nil, errors.WithStack(err) + } + + return actionhelpers.RelatedItemsForServiceAccount(objectMeta, a.clusterRoleBindings, a.log), nil +} + +func (a *ServiceAccountAction) Name() string { + return "ServiceAccountItemBlockAction" +} diff --git a/pkg/itemblock/actions/service_account_action_test.go b/pkg/itemblock/actions/service_account_action_test.go new file mode 100644 index 000000000..52c39b0bc --- /dev/null +++ b/pkg/itemblock/actions/service_account_action_test.go @@ -0,0 +1,609 @@ +/* +Copyright the Velero contributors. + +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 actions + +import ( + "fmt" + "sort" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + rbac "k8s.io/api/rbac/v1" + rbacbeta "k8s.io/api/rbac/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + "github.com/vmware-tanzu/velero/pkg/kuberesource" + "github.com/vmware-tanzu/velero/pkg/plugin/velero" + velerotest "github.com/vmware-tanzu/velero/pkg/test" + "github.com/vmware-tanzu/velero/pkg/util/actionhelpers" +) + +func newV1ClusterRoleBindingList(rbacCRBList []rbac.ClusterRoleBinding) []actionhelpers.ClusterRoleBinding { + var crbs []actionhelpers.ClusterRoleBinding + for _, c := range rbacCRBList { + crbs = append(crbs, actionhelpers.V1ClusterRoleBinding{Crb: c}) + } + + return crbs +} + +func newV1beta1ClusterRoleBindingList(rbacCRBList []rbacbeta.ClusterRoleBinding) []actionhelpers.ClusterRoleBinding { + var crbs []actionhelpers.ClusterRoleBinding + for _, c := range rbacCRBList { + crbs = append(crbs, actionhelpers.V1beta1ClusterRoleBinding{Crb: c}) + } + + return crbs +} + +type FakeV1ClusterRoleBindingLister struct { + v1crbs []rbac.ClusterRoleBinding +} + +func (f FakeV1ClusterRoleBindingLister) List() ([]actionhelpers.ClusterRoleBinding, error) { + var crbs []actionhelpers.ClusterRoleBinding + for _, c := range f.v1crbs { + crbs = append(crbs, actionhelpers.V1ClusterRoleBinding{Crb: c}) + } + return crbs, nil +} + +type FakeV1beta1ClusterRoleBindingLister struct { + v1beta1crbs []rbacbeta.ClusterRoleBinding +} + +func (f FakeV1beta1ClusterRoleBindingLister) List() ([]actionhelpers.ClusterRoleBinding, error) { + var crbs []actionhelpers.ClusterRoleBinding + for _, c := range f.v1beta1crbs { + crbs = append(crbs, actionhelpers.V1beta1ClusterRoleBinding{Crb: c}) + } + return crbs, nil +} + +func TestServiceAccountActionAppliesTo(t *testing.T) { + // Instantiating the struct directly since using + // NewServiceAccountAction requires a full Kubernetes clientset + a := &ServiceAccountAction{} + + actual, err := a.AppliesTo() + require.NoError(t, err) + + expected := velero.ResourceSelector{ + IncludedResources: []string{"serviceaccounts"}, + } + assert.Equal(t, expected, actual) +} + +func TestNewServiceAccountAction(t *testing.T) { + tests := []struct { + name string + version string + expectedCRBs []actionhelpers.ClusterRoleBinding + }{ + { + name: "rbac v1 API instantiates an saAction", + version: rbac.SchemeGroupVersion.Version, + expectedCRBs: []actionhelpers.ClusterRoleBinding{ + actionhelpers.V1ClusterRoleBinding{ + Crb: rbac.ClusterRoleBinding{ + ObjectMeta: metav1.ObjectMeta{ + Name: "v1crb-1", + }, + }, + }, + actionhelpers.V1ClusterRoleBinding{ + Crb: rbac.ClusterRoleBinding{ + ObjectMeta: metav1.ObjectMeta{ + Name: "v1crb-2", + }, + }, + }, + }, + }, + { + name: "rbac v1beta1 API instantiates an saAction", + version: rbacbeta.SchemeGroupVersion.Version, + expectedCRBs: []actionhelpers.ClusterRoleBinding{ + actionhelpers.V1beta1ClusterRoleBinding{ + Crb: rbacbeta.ClusterRoleBinding{ + ObjectMeta: metav1.ObjectMeta{ + Name: "v1beta1crb-1", + }, + }, + }, + actionhelpers.V1beta1ClusterRoleBinding{ + Crb: rbacbeta.ClusterRoleBinding{ + ObjectMeta: metav1.ObjectMeta{ + Name: "v1beta1crb-2", + }, + }, + }, + }, + }, + { + name: "no RBAC API instantiates an saAction with empty slice", + version: "", + expectedCRBs: []actionhelpers.ClusterRoleBinding{}, + }, + } + // Set up all of our fakes outside the test loop + discoveryHelper := velerotest.FakeDiscoveryHelper{} + logger := velerotest.NewLogger() + + v1crbs := []rbac.ClusterRoleBinding{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "v1crb-1", + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "v1crb-2", + }, + }, + } + + v1beta1crbs := []rbacbeta.ClusterRoleBinding{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "v1beta1crb-1", + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "v1beta1crb-2", + }, + }, + } + + clusterRoleBindingListers := map[string]actionhelpers.ClusterRoleBindingLister{ + rbac.SchemeGroupVersion.Version: FakeV1ClusterRoleBindingLister{v1crbs: v1crbs}, + rbacbeta.SchemeGroupVersion.Version: FakeV1beta1ClusterRoleBindingLister{v1beta1crbs: v1beta1crbs}, + "": actionhelpers.NoopClusterRoleBindingLister{}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + // We only care about the preferred version, nothing else in the list + discoveryHelper.APIGroupsList = []metav1.APIGroup{ + { + Name: rbac.GroupName, + PreferredVersion: metav1.GroupVersionForDiscovery{ + Version: test.version, + }, + }, + } + action, err := NewServiceAccountAction(logger, clusterRoleBindingListers, &discoveryHelper) + require.NoError(t, err) + assert.Equal(t, test.expectedCRBs, action.clusterRoleBindings) + }) + } +} + +func TestServiceAccountActionExecute(t *testing.T) { + tests := []struct { + name string + serviceAccount runtime.Unstructured + crbs []rbac.ClusterRoleBinding + expectedAdditionalItems []velero.ResourceIdentifier + }{ + { + name: "no crbs", + serviceAccount: velerotest.UnstructuredOrDie(` + { + "apiVersion": "v1", + "kind": "ServiceAccount", + "metadata": { + "namespace": "velero", + "name": "velero" + } + } + `), + crbs: nil, + expectedAdditionalItems: nil, + }, + { + name: "no matching crbs", + serviceAccount: velerotest.UnstructuredOrDie(` + { + "apiVersion": "v1", + "kind": "ServiceAccount", + "metadata": { + "namespace": "velero", + "name": "velero" + } + } + `), + crbs: []rbac.ClusterRoleBinding{ + { + Subjects: []rbac.Subject{ + { + Kind: "non-matching-kind", + Namespace: "non-matching-ns", + Name: "non-matching-name", + }, + { + Kind: "non-matching-kind", + Namespace: "velero", + Name: "velero", + }, + { + Kind: rbac.ServiceAccountKind, + Namespace: "non-matching-ns", + Name: "velero", + }, + { + Kind: rbac.ServiceAccountKind, + Namespace: "velero", + Name: "non-matching-name", + }, + }, + RoleRef: rbac.RoleRef{ + Name: "role", + }, + }, + }, + expectedAdditionalItems: nil, + }, + { + name: "some matching crbs", + serviceAccount: velerotest.UnstructuredOrDie(` + { + "apiVersion": "v1", + "kind": "ServiceAccount", + "metadata": { + "namespace": "velero", + "name": "velero" + } + } + `), + crbs: []rbac.ClusterRoleBinding{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "crb-1", + }, + Subjects: []rbac.Subject{ + { + Kind: "non-matching-kind", + Namespace: "non-matching-ns", + Name: "non-matching-name", + }, + }, + RoleRef: rbac.RoleRef{ + Name: "role-1", + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "crb-2", + }, + Subjects: []rbac.Subject{ + { + Kind: "non-matching-kind", + Namespace: "non-matching-ns", + Name: "non-matching-name", + }, + { + Kind: rbac.ServiceAccountKind, + Namespace: "velero", + Name: "velero", + }, + }, + RoleRef: rbac.RoleRef{ + Name: "role-2", + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "crb-3", + }, + Subjects: []rbac.Subject{ + { + Kind: rbac.ServiceAccountKind, + Namespace: "velero", + Name: "velero", + }, + }, + RoleRef: rbac.RoleRef{ + Name: "role-3", + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "crb-4", + }, + Subjects: []rbac.Subject{ + { + Kind: rbac.ServiceAccountKind, + Namespace: "velero", + Name: "velero", + }, + { + Kind: "non-matching-kind", + Namespace: "non-matching-ns", + Name: "non-matching-name", + }, + }, + RoleRef: rbac.RoleRef{ + Name: "role-4", + }, + }, + }, + expectedAdditionalItems: []velero.ResourceIdentifier{ + { + GroupResource: kuberesource.ClusterRoleBindings, + Name: "crb-2", + }, + { + GroupResource: kuberesource.ClusterRoleBindings, + Name: "crb-3", + }, + { + GroupResource: kuberesource.ClusterRoleBindings, + Name: "crb-4", + }, + { + GroupResource: kuberesource.ClusterRoles, + Name: "role-2", + }, + { + GroupResource: kuberesource.ClusterRoles, + Name: "role-3", + }, + { + GroupResource: kuberesource.ClusterRoles, + Name: "role-4", + }, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + // Create the action struct directly so we don't need to mock a clientset + action := &ServiceAccountAction{ + log: velerotest.NewLogger(), + clusterRoleBindings: newV1ClusterRoleBindingList(test.crbs), + } + + additional, err := action.GetRelatedItems(test.serviceAccount, nil) + + assert.NoError(t, err) + + // ensure slices are ordered for valid comparison + sort.Slice(test.expectedAdditionalItems, func(i, j int) bool { + return fmt.Sprintf("%s.%s", test.expectedAdditionalItems[i].GroupResource.String(), test.expectedAdditionalItems[i].Name) < + fmt.Sprintf("%s.%s", test.expectedAdditionalItems[j].GroupResource.String(), test.expectedAdditionalItems[j].Name) + }) + + sort.Slice(additional, func(i, j int) bool { + return fmt.Sprintf("%s.%s", additional[i].GroupResource.String(), additional[i].Name) < + fmt.Sprintf("%s.%s", additional[j].GroupResource.String(), additional[j].Name) + }) + + assert.Equal(t, test.expectedAdditionalItems, additional) + }) + } +} + +func TestServiceAccountActionExecuteOnBeta1(t *testing.T) { + tests := []struct { + name string + serviceAccount runtime.Unstructured + crbs []rbacbeta.ClusterRoleBinding + expectedAdditionalItems []velero.ResourceIdentifier + }{ + { + name: "no crbs", + serviceAccount: velerotest.UnstructuredOrDie(` + { + "apiVersion": "v1", + "kind": "ServiceAccount", + "metadata": { + "namespace": "velero", + "name": "velero" + } + } + `), + crbs: nil, + expectedAdditionalItems: nil, + }, + { + name: "no matching crbs", + serviceAccount: velerotest.UnstructuredOrDie(` + { + "apiVersion": "v1", + "kind": "ServiceAccount", + "metadata": { + "namespace": "velero", + "name": "velero" + } + } + `), + crbs: []rbacbeta.ClusterRoleBinding{ + { + Subjects: []rbacbeta.Subject{ + { + Kind: "non-matching-kind", + Namespace: "non-matching-ns", + Name: "non-matching-name", + }, + { + Kind: "non-matching-kind", + Namespace: "velero", + Name: "velero", + }, + { + Kind: rbacbeta.ServiceAccountKind, + Namespace: "non-matching-ns", + Name: "velero", + }, + { + Kind: rbacbeta.ServiceAccountKind, + Namespace: "velero", + Name: "non-matching-name", + }, + }, + RoleRef: rbacbeta.RoleRef{ + Name: "role", + }, + }, + }, + expectedAdditionalItems: nil, + }, + { + name: "some matching crbs", + serviceAccount: velerotest.UnstructuredOrDie(` + { + "apiVersion": "v1", + "kind": "ServiceAccount", + "metadata": { + "namespace": "velero", + "name": "velero" + } + } + `), + crbs: []rbacbeta.ClusterRoleBinding{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "crb-1", + }, + Subjects: []rbacbeta.Subject{ + { + Kind: "non-matching-kind", + Namespace: "non-matching-ns", + Name: "non-matching-name", + }, + }, + RoleRef: rbacbeta.RoleRef{ + Name: "role-1", + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "crb-2", + }, + Subjects: []rbacbeta.Subject{ + { + Kind: "non-matching-kind", + Namespace: "non-matching-ns", + Name: "non-matching-name", + }, + { + Kind: rbacbeta.ServiceAccountKind, + Namespace: "velero", + Name: "velero", + }, + }, + RoleRef: rbacbeta.RoleRef{ + Name: "role-2", + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "crb-3", + }, + Subjects: []rbacbeta.Subject{ + { + Kind: rbacbeta.ServiceAccountKind, + Namespace: "velero", + Name: "velero", + }, + }, + RoleRef: rbacbeta.RoleRef{ + Name: "role-3", + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "crb-4", + }, + Subjects: []rbacbeta.Subject{ + { + Kind: rbacbeta.ServiceAccountKind, + Namespace: "velero", + Name: "velero", + }, + { + Kind: "non-matching-kind", + Namespace: "non-matching-ns", + Name: "non-matching-name", + }, + }, + RoleRef: rbacbeta.RoleRef{ + Name: "role-4", + }, + }, + }, + expectedAdditionalItems: []velero.ResourceIdentifier{ + { + GroupResource: kuberesource.ClusterRoleBindings, + Name: "crb-2", + }, + { + GroupResource: kuberesource.ClusterRoleBindings, + Name: "crb-3", + }, + { + GroupResource: kuberesource.ClusterRoleBindings, + Name: "crb-4", + }, + { + GroupResource: kuberesource.ClusterRoles, + Name: "role-2", + }, + { + GroupResource: kuberesource.ClusterRoles, + Name: "role-3", + }, + { + GroupResource: kuberesource.ClusterRoles, + Name: "role-4", + }, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + // Create the action struct directly so we don't need to mock a clientset + action := &ServiceAccountAction{ + log: velerotest.NewLogger(), + clusterRoleBindings: newV1beta1ClusterRoleBindingList(test.crbs), + } + + additional, err := action.GetRelatedItems(test.serviceAccount, nil) + + assert.NoError(t, err) + + // ensure slices are ordered for valid comparison + sort.Slice(test.expectedAdditionalItems, func(i, j int) bool { + return fmt.Sprintf("%s.%s", test.expectedAdditionalItems[i].GroupResource.String(), test.expectedAdditionalItems[i].Name) < + fmt.Sprintf("%s.%s", test.expectedAdditionalItems[j].GroupResource.String(), test.expectedAdditionalItems[j].Name) + }) + + sort.Slice(additional, func(i, j int) bool { + return fmt.Sprintf("%s.%s", additional[i].GroupResource.String(), additional[i].Name) < + fmt.Sprintf("%s.%s", additional[j].GroupResource.String(), additional[j].Name) + }) + + assert.Equal(t, test.expectedAdditionalItems, additional) + }) + } +} diff --git a/pkg/util/actionhelpers/pod_helper.go b/pkg/util/actionhelpers/pod_helper.go new file mode 100644 index 000000000..72c42936c --- /dev/null +++ b/pkg/util/actionhelpers/pod_helper.go @@ -0,0 +1,53 @@ +/* +Copyright the Velero contributors. + +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 actionhelpers + +import ( + "github.com/sirupsen/logrus" + corev1api "k8s.io/api/core/v1" + + "github.com/vmware-tanzu/velero/pkg/kuberesource" + "github.com/vmware-tanzu/velero/pkg/plugin/velero" +) + +func RelatedItemsForPod(pod *corev1api.Pod, log logrus.FieldLogger) []velero.ResourceIdentifier { + var additionalItems []velero.ResourceIdentifier + if pod.Spec.PriorityClassName != "" { + log.Infof("Adding priorityclass %s to additionalItems", pod.Spec.PriorityClassName) + additionalItems = append(additionalItems, velero.ResourceIdentifier{ + GroupResource: kuberesource.PriorityClasses, + Name: pod.Spec.PriorityClassName, + }) + } + + if len(pod.Spec.Volumes) == 0 { + log.Info("pod has no volumes") + } + + for _, volume := range pod.Spec.Volumes { + if volume.PersistentVolumeClaim != nil && volume.PersistentVolumeClaim.ClaimName != "" { + log.Infof("Adding pvc %s to additionalItems", volume.PersistentVolumeClaim.ClaimName) + + additionalItems = append(additionalItems, velero.ResourceIdentifier{ + GroupResource: kuberesource.PersistentVolumeClaims, + Namespace: pod.Namespace, + Name: volume.PersistentVolumeClaim.ClaimName, + }) + } + } + return additionalItems +} diff --git a/pkg/util/actionhelpers/pvc_helper.go b/pkg/util/actionhelpers/pvc_helper.go new file mode 100644 index 000000000..f6a72eeaa --- /dev/null +++ b/pkg/util/actionhelpers/pvc_helper.go @@ -0,0 +1,34 @@ +/* +Copyright the Velero contributors. + +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 actionhelpers + +import ( + "github.com/sirupsen/logrus" + corev1api "k8s.io/api/core/v1" + + "github.com/vmware-tanzu/velero/pkg/kuberesource" + "github.com/vmware-tanzu/velero/pkg/plugin/velero" +) + +func RelatedItemsForPVC(pvc *corev1api.PersistentVolumeClaim, log logrus.FieldLogger) []velero.ResourceIdentifier { + return []velero.ResourceIdentifier{ + { + GroupResource: kuberesource.PersistentVolumes, + Name: pvc.Spec.VolumeName, + }, + } +} diff --git a/pkg/backup/actions/rbac.go b/pkg/util/actionhelpers/rbac.go similarity index 71% rename from pkg/backup/actions/rbac.go rename to pkg/util/actionhelpers/rbac.go index 5da936ef7..b763ec858 100644 --- a/pkg/backup/actions/rbac.go +++ b/pkg/util/actionhelpers/rbac.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package actions +package actionhelpers import ( "context" @@ -35,42 +35,42 @@ type ClusterRoleBindingLister interface { } // noopClusterRoleBindingLister exists to handle clusters where RBAC is disabled. -type noopClusterRoleBindingLister struct { +type NoopClusterRoleBindingLister struct { } -func (noop noopClusterRoleBindingLister) List() ([]ClusterRoleBinding, error) { +func (noop NoopClusterRoleBindingLister) List() ([]ClusterRoleBinding, error) { return []ClusterRoleBinding{}, nil } -type v1ClusterRoleBindingLister struct { +type V1ClusterRoleBindingLister struct { client rbacclient.ClusterRoleBindingInterface } -func (v1 v1ClusterRoleBindingLister) List() ([]ClusterRoleBinding, error) { +func (v1 V1ClusterRoleBindingLister) List() ([]ClusterRoleBinding, error) { crbList, err := v1.client.List(context.TODO(), metav1.ListOptions{}) if err != nil { return nil, errors.WithStack(err) } var crbs []ClusterRoleBinding for _, crb := range crbList.Items { - crbs = append(crbs, v1ClusterRoleBinding{crb: crb}) + crbs = append(crbs, V1ClusterRoleBinding{Crb: crb}) } return crbs, nil } -type v1beta1ClusterRoleBindingLister struct { +type V1beta1ClusterRoleBindingLister struct { client rbacbetaclient.ClusterRoleBindingInterface } -func (v1beta1 v1beta1ClusterRoleBindingLister) List() ([]ClusterRoleBinding, error) { +func (v1beta1 V1beta1ClusterRoleBindingLister) List() ([]ClusterRoleBinding, error) { crbList, err := v1beta1.client.List(context.TODO(), metav1.ListOptions{}) if err != nil { return nil, errors.WithStack(err) } var crbs []ClusterRoleBinding for _, crb := range crbList.Items { - crbs = append(crbs, v1beta1ClusterRoleBinding{crb: crb}) + crbs = append(crbs, V1beta1ClusterRoleBinding{Crb: crb}) } return crbs, nil @@ -81,9 +81,9 @@ func (v1beta1 v1beta1ClusterRoleBindingLister) List() ([]ClusterRoleBinding, err // Necessary so that callers to the ClusterRoleBindingLister interfaces don't need the kubernetes.Interface. func NewClusterRoleBindingListerMap(clientset kubernetes.Interface) map[string]ClusterRoleBindingLister { return map[string]ClusterRoleBindingLister{ - rbac.SchemeGroupVersion.Version: v1ClusterRoleBindingLister{client: clientset.RbacV1().ClusterRoleBindings()}, - rbacbeta.SchemeGroupVersion.Version: v1beta1ClusterRoleBindingLister{client: clientset.RbacV1beta1().ClusterRoleBindings()}, - "": noopClusterRoleBindingLister{}, + rbac.SchemeGroupVersion.Version: V1ClusterRoleBindingLister{client: clientset.RbacV1().ClusterRoleBindings()}, + rbacbeta.SchemeGroupVersion.Version: V1beta1ClusterRoleBindingLister{client: clientset.RbacV1beta1().ClusterRoleBindings()}, + "": NoopClusterRoleBindingLister{}, } } @@ -97,21 +97,21 @@ type ClusterRoleBinding interface { RoleRefName() string } -type v1ClusterRoleBinding struct { - crb rbac.ClusterRoleBinding +type V1ClusterRoleBinding struct { + Crb rbac.ClusterRoleBinding } -func (c v1ClusterRoleBinding) Name() string { - return c.crb.Name +func (c V1ClusterRoleBinding) Name() string { + return c.Crb.Name } -func (c v1ClusterRoleBinding) RoleRefName() string { - return c.crb.RoleRef.Name +func (c V1ClusterRoleBinding) RoleRefName() string { + return c.Crb.RoleRef.Name } -func (c v1ClusterRoleBinding) ServiceAccountSubjects(namespace string) []string { +func (c V1ClusterRoleBinding) ServiceAccountSubjects(namespace string) []string { var saSubjects []string - for _, s := range c.crb.Subjects { + for _, s := range c.Crb.Subjects { if s.Kind == rbac.ServiceAccountKind && s.Namespace == namespace { saSubjects = append(saSubjects, s.Name) } @@ -119,21 +119,21 @@ func (c v1ClusterRoleBinding) ServiceAccountSubjects(namespace string) []string return saSubjects } -type v1beta1ClusterRoleBinding struct { - crb rbacbeta.ClusterRoleBinding +type V1beta1ClusterRoleBinding struct { + Crb rbacbeta.ClusterRoleBinding } -func (c v1beta1ClusterRoleBinding) Name() string { - return c.crb.Name +func (c V1beta1ClusterRoleBinding) Name() string { + return c.Crb.Name } -func (c v1beta1ClusterRoleBinding) RoleRefName() string { - return c.crb.RoleRef.Name +func (c V1beta1ClusterRoleBinding) RoleRefName() string { + return c.Crb.RoleRef.Name } -func (c v1beta1ClusterRoleBinding) ServiceAccountSubjects(namespace string) []string { +func (c V1beta1ClusterRoleBinding) ServiceAccountSubjects(namespace string) []string { var saSubjects []string - for _, s := range c.crb.Subjects { + for _, s := range c.Crb.Subjects { if s.Kind == rbac.ServiceAccountKind && s.Namespace == namespace { saSubjects = append(saSubjects, s.Name) } diff --git a/pkg/util/actionhelpers/service_account_helper.go b/pkg/util/actionhelpers/service_account_helper.go new file mode 100644 index 000000000..7c388c4da --- /dev/null +++ b/pkg/util/actionhelpers/service_account_helper.go @@ -0,0 +1,84 @@ +/* +Copyright the Velero contributors. + +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 actionhelpers + +import ( + "github.com/sirupsen/logrus" + rbac "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/sets" + + velerodiscovery "github.com/vmware-tanzu/velero/pkg/discovery" + "github.com/vmware-tanzu/velero/pkg/kuberesource" + "github.com/vmware-tanzu/velero/pkg/plugin/velero" +) + +func ClusterRoleBindingsForAction(clusterRoleBindingListers map[string]ClusterRoleBindingLister, discoveryHelper velerodiscovery.Helper) ([]ClusterRoleBinding, error) { + // Look up the supported RBAC version + var supportedAPI metav1.GroupVersionForDiscovery + for _, ag := range discoveryHelper.APIGroups() { + if ag.Name == rbac.GroupName { + supportedAPI = ag.PreferredVersion + break + } + } + + crbLister := clusterRoleBindingListers[supportedAPI.Version] + + // This should be safe because the List call will return a 0-item slice + // if there's no matching API version. + return crbLister.List() +} + +func RelatedItemsForServiceAccount(objectMeta metav1.Object, clusterRoleBindings []ClusterRoleBinding, log logrus.FieldLogger) []velero.ResourceIdentifier { + var ( + namespace = objectMeta.GetNamespace() + name = objectMeta.GetName() + bindings = sets.NewString() + roles = sets.NewString() + ) + + for _, crb := range clusterRoleBindings { + for _, s := range crb.ServiceAccountSubjects(namespace) { + if s == name { + log.Infof("Adding clusterrole %s and clusterrolebinding %s to relatedItems since serviceaccount %s/%s is a subject", + crb.RoleRefName(), crb.Name(), namespace, name) + + bindings.Insert(crb.Name()) + roles.Insert(crb.RoleRefName()) + break + } + } + } + + var relatedItems []velero.ResourceIdentifier + for binding := range bindings { + relatedItems = append(relatedItems, velero.ResourceIdentifier{ + GroupResource: kuberesource.ClusterRoleBindings, + Name: binding, + }) + } + + for role := range roles { + relatedItems = append(relatedItems, velero.ResourceIdentifier{ + GroupResource: kuberesource.ClusterRoles, + Name: role, + }) + } + + return relatedItems +} From 8eac3606d9adb63822efaa3225b2e399b758b7de Mon Sep 17 00:00:00 2001 From: Shubham Pampattiwar Date: Mon, 12 Aug 2024 16:55:36 -0700 Subject: [PATCH 2/3] Add support for backup PVC configuration Signed-off-by: Shubham Pampattiwar add changelog file Signed-off-by: Shubham Pampattiwar make update Signed-off-by: Shubham Pampattiwar pass backupPVCConfig to exposer as part of csi params Signed-off-by: Shubham Pampattiwar --- .../unreleased/8109-shubham-pampattiwar | 1 + pkg/cmd/cli/nodeagent/server.go | 8 +- pkg/controller/data_upload_controller.go | 5 +- pkg/controller/data_upload_controller_test.go | 4 +- pkg/exposer/csi_snapshot.go | 25 ++- pkg/exposer/csi_snapshot_test.go | 147 ++++++++++++++++++ pkg/nodeagent/node_agent.go | 11 ++ 7 files changed, 195 insertions(+), 6 deletions(-) create mode 100644 changelogs/unreleased/8109-shubham-pampattiwar diff --git a/changelogs/unreleased/8109-shubham-pampattiwar b/changelogs/unreleased/8109-shubham-pampattiwar new file mode 100644 index 000000000..db84fc0c6 --- /dev/null +++ b/changelogs/unreleased/8109-shubham-pampattiwar @@ -0,0 +1 @@ +Add support for backup PVC configuration diff --git a/pkg/cmd/cli/nodeagent/server.go b/pkg/cmd/cli/nodeagent/server.go index 181afbf69..935e97250 100644 --- a/pkg/cmd/cli/nodeagent/server.go +++ b/pkg/cmd/cli/nodeagent/server.go @@ -292,7 +292,13 @@ func (s *nodeAgentServer) run() { if s.dataPathConfigs != nil && len(s.dataPathConfigs.LoadAffinity) > 0 { loadAffinity = s.dataPathConfigs.LoadAffinity[0] } - dataUploadReconciler := controller.NewDataUploadReconciler(s.mgr.GetClient(), s.mgr, s.kubeClient, s.csiSnapshotClient.SnapshotV1(), s.dataPathMgr, loadAffinity, repoEnsurer, clock.RealClock{}, credentialGetter, s.nodeName, s.fileSystem, s.config.dataMoverPrepareTimeout, s.logger, s.metrics) + + var backupPVCConfig map[string]nodeagent.BackupPVC + if s.dataPathConfigs != nil && s.dataPathConfigs.BackupPVCConfig != nil { + backupPVCConfig = s.dataPathConfigs.BackupPVCConfig + } + + dataUploadReconciler := controller.NewDataUploadReconciler(s.mgr.GetClient(), s.mgr, s.kubeClient, s.csiSnapshotClient.SnapshotV1(), s.dataPathMgr, loadAffinity, backupPVCConfig, repoEnsurer, clock.RealClock{}, credentialGetter, s.nodeName, s.fileSystem, s.config.dataMoverPrepareTimeout, s.logger, s.metrics) if err = dataUploadReconciler.SetupWithManager(s.mgr); err != nil { s.logger.WithError(err).Fatal("Unable to create the data upload controller") } diff --git a/pkg/controller/data_upload_controller.go b/pkg/controller/data_upload_controller.go index 4660e5b2f..520e48795 100644 --- a/pkg/controller/data_upload_controller.go +++ b/pkg/controller/data_upload_controller.go @@ -78,12 +78,13 @@ type DataUploadReconciler struct { snapshotExposerList map[velerov2alpha1api.SnapshotType]exposer.SnapshotExposer dataPathMgr *datapath.Manager loadAffinity *nodeagent.LoadAffinity + backupPVCConfig map[string]nodeagent.BackupPVC preparingTimeout time.Duration metrics *metrics.ServerMetrics } func NewDataUploadReconciler(client client.Client, mgr manager.Manager, kubeClient kubernetes.Interface, csiSnapshotClient snapshotter.SnapshotV1Interface, - dataPathMgr *datapath.Manager, loadAffinity *nodeagent.LoadAffinity, repoEnsurer *repository.Ensurer, clock clocks.WithTickerAndDelayedExecution, + dataPathMgr *datapath.Manager, loadAffinity *nodeagent.LoadAffinity, backupPVCConfig map[string]nodeagent.BackupPVC, repoEnsurer *repository.Ensurer, clock clocks.WithTickerAndDelayedExecution, cred *credentials.CredentialGetter, nodeName string, fs filesystem.Interface, preparingTimeout time.Duration, log logrus.FieldLogger, metrics *metrics.ServerMetrics) *DataUploadReconciler { return &DataUploadReconciler{ client: client, @@ -99,6 +100,7 @@ func NewDataUploadReconciler(client client.Client, mgr manager.Manager, kubeClie snapshotExposerList: map[velerov2alpha1api.SnapshotType]exposer.SnapshotExposer{velerov2alpha1api.SnapshotTypeCSI: exposer.NewCSISnapshotExposer(kubeClient, csiSnapshotClient, log)}, dataPathMgr: dataPathMgr, loadAffinity: loadAffinity, + backupPVCConfig: backupPVCConfig, preparingTimeout: preparingTimeout, metrics: metrics, } @@ -788,6 +790,7 @@ func (r *DataUploadReconciler) setupExposeParam(du *velerov2alpha1api.DataUpload ExposeTimeout: r.preparingTimeout, VolumeSize: pvc.Spec.Resources.Requests[corev1.ResourceStorage], Affinity: r.loadAffinity, + BackupPVCConfig: r.backupPVCConfig, }, nil } return nil, nil diff --git a/pkg/controller/data_upload_controller_test.go b/pkg/controller/data_upload_controller_test.go index 4024a714d..2a8d55010 100644 --- a/pkg/controller/data_upload_controller_test.go +++ b/pkg/controller/data_upload_controller_test.go @@ -22,6 +22,8 @@ import ( "testing" "time" + "github.com/vmware-tanzu/velero/pkg/nodeagent" + snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v7/apis/volumesnapshot/v1" snapshotFake "github.com/kubernetes-csi/external-snapshotter/client/v7/clientset/versioned/fake" "github.com/pkg/errors" @@ -245,7 +247,7 @@ func initDataUploaderReconcilerWithError(needError ...error) (*DataUploadReconci if err != nil { return nil, err } - return NewDataUploadReconciler(fakeClient, nil, fakeKubeClient, fakeSnapshotClient.SnapshotV1(), dataPathMgr, nil, nil, + return NewDataUploadReconciler(fakeClient, nil, fakeKubeClient, fakeSnapshotClient.SnapshotV1(), dataPathMgr, nil, map[string]nodeagent.BackupPVC{}, nil, testclocks.NewFakeClock(now), &credentials.CredentialGetter{FromFile: credentialFileStore}, "test-node", fakeFS, time.Minute*5, velerotest.NewLogger(), metrics.NewServerMetrics()), nil } diff --git a/pkg/exposer/csi_snapshot.go b/pkg/exposer/csi_snapshot.go index 28c29e197..cd0450ad5 100644 --- a/pkg/exposer/csi_snapshot.go +++ b/pkg/exposer/csi_snapshot.go @@ -67,6 +67,9 @@ type CSISnapshotExposeParam struct { // Affinity specifies the node affinity of the backup pod Affinity *nodeagent.LoadAffinity + + // BackupPVCConfig is the config for backupPVC (intermediate PVC) of snapshot data movement + BackupPVCConfig map[string]nodeagent.BackupPVC } // CSISnapshotExposeWaitParam define the input param for WaitExposed of CSI snapshots @@ -163,7 +166,17 @@ func (e *csiSnapshotExposer) Expose(ctx context.Context, ownerObject corev1.Obje curLog.WithField("vs name", volumeSnapshot.Name).Warnf("The snapshot doesn't contain a valid restore size, use source volume's size %v", volumeSize) } - backupPVC, err := e.createBackupPVC(ctx, ownerObject, backupVS.Name, csiExposeParam.StorageClass, csiExposeParam.AccessMode, volumeSize) + // check if there is a mapping for source pvc storage class in backupPVC config + // if the mapping exists then use the values(storage class, readOnly accessMode) + // for backupPVC (intermediate PVC in snapshot data movement) object creation + backupPVCStorageClass := csiExposeParam.StorageClass + backupPVCReadOnly := false + if value, exists := csiExposeParam.BackupPVCConfig[csiExposeParam.StorageClass]; exists { + backupPVCStorageClass = value.StorageClass + backupPVCReadOnly = value.ReadOnly + } + + backupPVC, err := e.createBackupPVC(ctx, ownerObject, backupVS.Name, backupPVCStorageClass, csiExposeParam.AccessMode, volumeSize, backupPVCReadOnly) if err != nil { return errors.Wrap(err, "error to create backup pvc") } @@ -347,7 +360,7 @@ func (e *csiSnapshotExposer) createBackupVSC(ctx context.Context, ownerObject co return e.csiSnapshotClient.VolumeSnapshotContents().Create(ctx, vsc, metav1.CreateOptions{}) } -func (e *csiSnapshotExposer) createBackupPVC(ctx context.Context, ownerObject corev1.ObjectReference, backupVS, storageClass, accessMode string, resource resource.Quantity) (*corev1.PersistentVolumeClaim, error) { +func (e *csiSnapshotExposer) createBackupPVC(ctx context.Context, ownerObject corev1.ObjectReference, backupVS, storageClass, accessMode string, resource resource.Quantity, readOnly bool) (*corev1.PersistentVolumeClaim, error) { backupPVCName := ownerObject.Name volumeMode, err := getVolumeModeByAccessMode(accessMode) @@ -355,6 +368,12 @@ func (e *csiSnapshotExposer) createBackupPVC(ctx context.Context, ownerObject co return nil, err } + pvcAccessMode := corev1.ReadWriteOnce + + if readOnly { + pvcAccessMode = corev1.ReadOnlyMany + } + dataSource := &corev1.TypedLocalObjectReference{ APIGroup: &snapshotv1api.SchemeGroupVersion.Group, Kind: "VolumeSnapshot", @@ -377,7 +396,7 @@ func (e *csiSnapshotExposer) createBackupPVC(ctx context.Context, ownerObject co }, Spec: corev1.PersistentVolumeClaimSpec{ AccessModes: []corev1.PersistentVolumeAccessMode{ - corev1.ReadWriteOnce, + pvcAccessMode, }, StorageClassName: &storageClass, VolumeMode: &volumeMode, diff --git a/pkg/exposer/csi_snapshot_test.go b/pkg/exposer/csi_snapshot_test.go index e11102294..82044dbb8 100644 --- a/pkg/exposer/csi_snapshot_test.go +++ b/pkg/exposer/csi_snapshot_test.go @@ -18,10 +18,13 @@ package exposer import ( "context" + "fmt" "reflect" "testing" "time" + "k8s.io/utils/pointer" + snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v7/apis/volumesnapshot/v1" snapshotFake "github.com/kubernetes-csi/external-snapshotter/client/v7/clientset/versioned/fake" "github.com/pkg/errors" @@ -821,3 +824,147 @@ func TestToSystemAffinity(t *testing.T) { }) } } + +func Test_csiSnapshotExposer_createBackupPVC(t *testing.T) { + backup := &velerov1.Backup{ + TypeMeta: metav1.TypeMeta{ + APIVersion: velerov1.SchemeGroupVersion.String(), + Kind: "Backup", + }, + ObjectMeta: metav1.ObjectMeta{ + Namespace: velerov1.DefaultNamespace, + Name: "fake-backup", + UID: "fake-uid", + }, + } + + dataSource := &corev1.TypedLocalObjectReference{ + APIGroup: &snapshotv1api.SchemeGroupVersion.Group, + Kind: "VolumeSnapshot", + Name: "fake-snapshot", + } + volumeMode := corev1.PersistentVolumeFilesystem + + backupPVC := corev1.PersistentVolumeClaim{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: velerov1.DefaultNamespace, + Name: "fake-backup", + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: backup.APIVersion, + Kind: backup.Kind, + Name: backup.Name, + UID: backup.UID, + Controller: pointer.BoolPtr(true), + }, + }, + }, + Spec: corev1.PersistentVolumeClaimSpec{ + AccessModes: []corev1.PersistentVolumeAccessMode{ + corev1.ReadWriteOnce, + }, + VolumeMode: &volumeMode, + DataSource: dataSource, + DataSourceRef: nil, + StorageClassName: pointer.String("fake-storage-class"), + Resources: corev1.VolumeResourceRequirements{ + Requests: corev1.ResourceList{ + corev1.ResourceStorage: resource.MustParse("1Gi"), + }, + }, + }, + } + + backupPVCReadOnly := corev1.PersistentVolumeClaim{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: velerov1.DefaultNamespace, + Name: "fake-backup", + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: backup.APIVersion, + Kind: backup.Kind, + Name: backup.Name, + UID: backup.UID, + Controller: pointer.BoolPtr(true), + }, + }, + }, + Spec: corev1.PersistentVolumeClaimSpec{ + AccessModes: []corev1.PersistentVolumeAccessMode{ + corev1.ReadOnlyMany, + }, + VolumeMode: &volumeMode, + DataSource: dataSource, + DataSourceRef: nil, + StorageClassName: pointer.String("fake-storage-class"), + Resources: corev1.VolumeResourceRequirements{ + Requests: corev1.ResourceList{ + corev1.ResourceStorage: resource.MustParse("1Gi"), + }, + }, + }, + } + + tests := []struct { + name string + ownerBackup *velerov1.Backup + backupVS string + storageClass string + accessMode string + resource resource.Quantity + readOnly bool + kubeClientObj []runtime.Object + snapshotClientObj []runtime.Object + want *corev1.PersistentVolumeClaim + wantErr assert.ErrorAssertionFunc + }{ + { + name: "backupPVC gets created successfully with parameters from source PVC", + ownerBackup: backup, + backupVS: "fake-snapshot", + storageClass: "fake-storage-class", + accessMode: AccessModeFileSystem, + resource: resource.MustParse("1Gi"), + readOnly: false, + want: &backupPVC, + wantErr: assert.NoError, + }, + { + name: "backupPVC gets created successfully with parameters from source PVC but accessMode from backupPVC Config as read only", + ownerBackup: backup, + backupVS: "fake-snapshot", + storageClass: "fake-storage-class", + accessMode: AccessModeFileSystem, + resource: resource.MustParse("1Gi"), + readOnly: true, + want: &backupPVCReadOnly, + wantErr: assert.NoError, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + fakeKubeClient := fake.NewSimpleClientset(tt.kubeClientObj...) + fakeSnapshotClient := snapshotFake.NewSimpleClientset(tt.snapshotClientObj...) + e := &csiSnapshotExposer{ + kubeClient: fakeKubeClient, + csiSnapshotClient: fakeSnapshotClient.SnapshotV1(), + log: velerotest.NewLogger(), + } + var ownerObject corev1.ObjectReference + if tt.ownerBackup != nil { + ownerObject = corev1.ObjectReference{ + Kind: tt.ownerBackup.Kind, + Namespace: tt.ownerBackup.Namespace, + Name: tt.ownerBackup.Name, + UID: tt.ownerBackup.UID, + APIVersion: tt.ownerBackup.APIVersion, + } + } + got, err := e.createBackupPVC(context.Background(), ownerObject, tt.backupVS, tt.storageClass, tt.accessMode, tt.resource, tt.readOnly) + if !tt.wantErr(t, err, fmt.Sprintf("createBackupPVC(%v, %v, %v, %v, %v, %v)", ownerObject, tt.backupVS, tt.storageClass, tt.accessMode, tt.resource, tt.readOnly)) { + return + } + assert.Equalf(t, tt.want, got, "createBackupPVC(%v, %v, %v, %v, %v, %v)", ownerObject, tt.backupVS, tt.storageClass, tt.accessMode, tt.resource, tt.readOnly) + }) + } +} diff --git a/pkg/nodeagent/node_agent.go b/pkg/nodeagent/node_agent.go index e3597e27a..483b29565 100644 --- a/pkg/nodeagent/node_agent.go +++ b/pkg/nodeagent/node_agent.go @@ -63,12 +63,23 @@ type RuledConfigs struct { Number int `json:"number"` } +type BackupPVC struct { + // StorageClass is the name of storage class to be used by the backupPVC + StorageClass string `json:"storageClass,omitempty"` + + // ReadOnly sets the backupPVC's access mode as read only + ReadOnly bool `json:"readOnly,omitempty"` +} + type Configs struct { // LoadConcurrency is the config for data path load concurrency per node. LoadConcurrency *LoadConcurrency `json:"loadConcurrency,omitempty"` // LoadAffinity is the config for data path load affinity. LoadAffinity []*LoadAffinity `json:"loadAffinity,omitempty"` + + // BackupPVCConfig is the config for backupPVC (intermediate PVC) of snapshot data movement + BackupPVCConfig map[string]BackupPVC `json:"backupPVC,omitempty"` } // IsRunning checks if the node agent daemonset is running properly. If not, return the error found From 4ffc6d17b2207b02aba3a56102dfd2fcfc580251 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Wed, 14 Aug 2024 10:32:04 +0800 Subject: [PATCH 3/3] Delete the pkg/generated directory. Signed-off-by: Xun Jiang --- changelogs/unreleased/8114-blackpiglet | 1 + .../clientset/versioned/clientset.go | 111 -------- pkg/generated/clientset/versioned/doc.go | 20 -- .../versioned/fake/clientset_generated.go | 92 ------- pkg/generated/clientset/versioned/fake/doc.go | 20 -- .../clientset/versioned/fake/register.go | 58 ---- .../clientset/versioned/mocks/Interface.go | 79 ------ .../clientset/versioned/scheme/doc.go | 20 -- .../clientset/versioned/scheme/register.go | 58 ---- .../versioned/typed/velero/v1/backup.go | 195 -------------- .../typed/velero/v1/backuprepository.go | 195 -------------- .../typed/velero/v1/backupstoragelocation.go | 195 -------------- .../typed/velero/v1/deletebackuprequest.go | 195 -------------- .../versioned/typed/velero/v1/doc.go | 20 -- .../typed/velero/v1/downloadrequest.go | 195 -------------- .../versioned/typed/velero/v1/fake/doc.go | 20 -- .../typed/velero/v1/fake/fake_backup.go | 142 ---------- .../velero/v1/fake/fake_backuprepository.go | 142 ---------- .../v1/fake/fake_backupstoragelocation.go | 142 ---------- .../v1/fake/fake_deletebackuprequest.go | 142 ---------- .../velero/v1/fake/fake_downloadrequest.go | 142 ---------- .../velero/v1/fake/fake_podvolumebackup.go | 142 ---------- .../velero/v1/fake/fake_podvolumerestore.go | 142 ---------- .../typed/velero/v1/fake/fake_restore.go | 142 ---------- .../typed/velero/v1/fake/fake_schedule.go | 142 ---------- .../v1/fake/fake_serverstatusrequest.go | 142 ---------- .../velero/v1/fake/fake_velero_client.go | 80 ------ .../v1/fake/fake_volumesnapshotlocation.go | 142 ---------- .../typed/velero/v1/generated_expansion.go | 41 --- .../typed/velero/v1/mocks/BackupInterface.go | 252 ------------------ .../typed/velero/v1/mocks/BackupsGetter.go | 43 --- .../v1/mocks/DeleteBackupRequestInterface.go | 252 ------------------ .../v1/mocks/DeleteBackupRequestsGetter.go | 43 --- .../v1/mocks/PodVolumeBackupInterface.go | 252 ------------------ .../velero/v1/mocks/ScheduleInterface.go | 252 ------------------ .../typed/velero/v1/mocks/SchedulesGetter.go | 43 --- .../velero/v1/mocks/VeleroV1Interface.go | 221 --------------- .../mocks/VolumeSnapshotLocationInterface.go | 252 ------------------ .../v1/mocks/VolumeSnapshotLocationsGetter.go | 43 --- .../typed/velero/v1/podvolumebackup.go | 195 -------------- .../typed/velero/v1/podvolumerestore.go | 195 -------------- .../versioned/typed/velero/v1/restore.go | 195 -------------- .../versioned/typed/velero/v1/schedule.go | 195 -------------- .../typed/velero/v1/serverstatusrequest.go | 195 -------------- .../typed/velero/v1/velero_client.go | 139 ---------- .../typed/velero/v1/volumesnapshotlocation.go | 195 -------------- .../typed/velero/v2alpha1/datadownload.go | 195 -------------- .../typed/velero/v2alpha1/dataupload.go | 195 -------------- .../versioned/typed/velero/v2alpha1/doc.go | 20 -- .../typed/velero/v2alpha1/fake/doc.go | 20 -- .../velero/v2alpha1/fake/fake_datadownload.go | 142 ---------- .../velero/v2alpha1/fake/fake_dataupload.go | 142 ---------- .../v2alpha1/fake/fake_velero_client.go | 44 --- .../velero/v2alpha1/generated_expansion.go | 23 -- .../typed/velero/v2alpha1/velero_client.go | 94 ------- .../informers/externalversions/factory.go | 180 ------------- .../informers/externalversions/generic.go | 89 ------- .../internalinterfaces/factory_interfaces.go | 40 --- .../externalversions/velero/interface.go | 54 ---- .../externalversions/velero/v1/backup.go | 90 ------- .../velero/v1/backuprepository.go | 90 ------- .../velero/v1/backupstoragelocation.go | 90 ------- .../velero/v1/deletebackuprequest.go | 90 ------- .../velero/v1/downloadrequest.go | 90 ------- .../externalversions/velero/v1/interface.go | 115 -------- .../velero/v1/podvolumebackup.go | 90 ------- .../velero/v1/podvolumerestore.go | 90 ------- .../externalversions/velero/v1/restore.go | 90 ------- .../externalversions/velero/v1/schedule.go | 90 ------- .../velero/v1/serverstatusrequest.go | 90 ------- .../velero/v1/volumesnapshotlocation.go | 90 ------- .../velero/v2alpha1/datadownload.go | 90 ------- .../velero/v2alpha1/dataupload.go | 90 ------- .../velero/v2alpha1/interface.go | 52 ---- pkg/generated/listers/velero/v1/backup.go | 99 ------- .../listers/velero/v1/backuprepository.go | 99 ------- .../velero/v1/backupstoragelocation.go | 99 ------- .../listers/velero/v1/deletebackuprequest.go | 99 ------- .../listers/velero/v1/downloadrequest.go | 99 ------- .../listers/velero/v1/expansion_generated.go | 107 -------- .../listers/velero/v1/podvolumebackup.go | 99 ------- .../listers/velero/v1/podvolumerestore.go | 99 ------- pkg/generated/listers/velero/v1/restore.go | 99 ------- pkg/generated/listers/velero/v1/schedule.go | 99 ------- .../listers/velero/v1/serverstatusrequest.go | 99 ------- .../velero/v1/volumesnapshotlocation.go | 99 ------- .../listers/velero/v2alpha1/datadownload.go | 99 ------- .../listers/velero/v2alpha1/dataupload.go | 99 ------- .../velero/v2alpha1/expansion_generated.go | 35 --- 89 files changed, 1 insertion(+), 10122 deletions(-) create mode 100644 changelogs/unreleased/8114-blackpiglet delete mode 100644 pkg/generated/clientset/versioned/clientset.go delete mode 100644 pkg/generated/clientset/versioned/doc.go delete mode 100644 pkg/generated/clientset/versioned/fake/clientset_generated.go delete mode 100644 pkg/generated/clientset/versioned/fake/doc.go delete mode 100644 pkg/generated/clientset/versioned/fake/register.go delete mode 100644 pkg/generated/clientset/versioned/mocks/Interface.go delete mode 100644 pkg/generated/clientset/versioned/scheme/doc.go delete mode 100644 pkg/generated/clientset/versioned/scheme/register.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/backup.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/backuprepository.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/backupstoragelocation.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/deletebackuprequest.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/doc.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/downloadrequest.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/fake/doc.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_backup.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_backuprepository.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_backupstoragelocation.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_deletebackuprequest.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_downloadrequest.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_podvolumebackup.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_podvolumerestore.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_restore.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_schedule.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_serverstatusrequest.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_velero_client.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_volumesnapshotlocation.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/generated_expansion.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/mocks/BackupInterface.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/mocks/BackupsGetter.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/mocks/DeleteBackupRequestInterface.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/mocks/DeleteBackupRequestsGetter.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/mocks/PodVolumeBackupInterface.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/mocks/ScheduleInterface.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/mocks/SchedulesGetter.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/mocks/VeleroV1Interface.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/mocks/VolumeSnapshotLocationInterface.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/mocks/VolumeSnapshotLocationsGetter.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/podvolumebackup.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/podvolumerestore.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/restore.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/schedule.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/serverstatusrequest.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/velero_client.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v1/volumesnapshotlocation.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v2alpha1/datadownload.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v2alpha1/dataupload.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v2alpha1/doc.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/doc.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/fake_datadownload.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/fake_dataupload.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/fake_velero_client.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v2alpha1/generated_expansion.go delete mode 100644 pkg/generated/clientset/versioned/typed/velero/v2alpha1/velero_client.go delete mode 100644 pkg/generated/informers/externalversions/factory.go delete mode 100644 pkg/generated/informers/externalversions/generic.go delete mode 100644 pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go delete mode 100644 pkg/generated/informers/externalversions/velero/interface.go delete mode 100644 pkg/generated/informers/externalversions/velero/v1/backup.go delete mode 100644 pkg/generated/informers/externalversions/velero/v1/backuprepository.go delete mode 100644 pkg/generated/informers/externalversions/velero/v1/backupstoragelocation.go delete mode 100644 pkg/generated/informers/externalversions/velero/v1/deletebackuprequest.go delete mode 100644 pkg/generated/informers/externalversions/velero/v1/downloadrequest.go delete mode 100644 pkg/generated/informers/externalversions/velero/v1/interface.go delete mode 100644 pkg/generated/informers/externalversions/velero/v1/podvolumebackup.go delete mode 100644 pkg/generated/informers/externalversions/velero/v1/podvolumerestore.go delete mode 100644 pkg/generated/informers/externalversions/velero/v1/restore.go delete mode 100644 pkg/generated/informers/externalversions/velero/v1/schedule.go delete mode 100644 pkg/generated/informers/externalversions/velero/v1/serverstatusrequest.go delete mode 100644 pkg/generated/informers/externalversions/velero/v1/volumesnapshotlocation.go delete mode 100644 pkg/generated/informers/externalversions/velero/v2alpha1/datadownload.go delete mode 100644 pkg/generated/informers/externalversions/velero/v2alpha1/dataupload.go delete mode 100644 pkg/generated/informers/externalversions/velero/v2alpha1/interface.go delete mode 100644 pkg/generated/listers/velero/v1/backup.go delete mode 100644 pkg/generated/listers/velero/v1/backuprepository.go delete mode 100644 pkg/generated/listers/velero/v1/backupstoragelocation.go delete mode 100644 pkg/generated/listers/velero/v1/deletebackuprequest.go delete mode 100644 pkg/generated/listers/velero/v1/downloadrequest.go delete mode 100644 pkg/generated/listers/velero/v1/expansion_generated.go delete mode 100644 pkg/generated/listers/velero/v1/podvolumebackup.go delete mode 100644 pkg/generated/listers/velero/v1/podvolumerestore.go delete mode 100644 pkg/generated/listers/velero/v1/restore.go delete mode 100644 pkg/generated/listers/velero/v1/schedule.go delete mode 100644 pkg/generated/listers/velero/v1/serverstatusrequest.go delete mode 100644 pkg/generated/listers/velero/v1/volumesnapshotlocation.go delete mode 100644 pkg/generated/listers/velero/v2alpha1/datadownload.go delete mode 100644 pkg/generated/listers/velero/v2alpha1/dataupload.go delete mode 100644 pkg/generated/listers/velero/v2alpha1/expansion_generated.go diff --git a/changelogs/unreleased/8114-blackpiglet b/changelogs/unreleased/8114-blackpiglet new file mode 100644 index 000000000..d068ff437 --- /dev/null +++ b/changelogs/unreleased/8114-blackpiglet @@ -0,0 +1 @@ +Delete generated k8s client and informer. \ No newline at end of file diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go deleted file mode 100644 index 881dee994..000000000 --- a/pkg/generated/clientset/versioned/clientset.go +++ /dev/null @@ -1,111 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package versioned - -import ( - "fmt" - - velerov1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1" - velerov2alpha1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v2alpha1" - discovery "k8s.io/client-go/discovery" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" -) - -type Interface interface { - Discovery() discovery.DiscoveryInterface - VeleroV1() velerov1.VeleroV1Interface - VeleroV2alpha1() velerov2alpha1.VeleroV2alpha1Interface -} - -// Clientset contains the clients for groups. Each group has exactly one -// version included in a Clientset. -type Clientset struct { - *discovery.DiscoveryClient - veleroV1 *velerov1.VeleroV1Client - veleroV2alpha1 *velerov2alpha1.VeleroV2alpha1Client -} - -// VeleroV1 retrieves the VeleroV1Client -func (c *Clientset) VeleroV1() velerov1.VeleroV1Interface { - return c.veleroV1 -} - -// VeleroV2alpha1 retrieves the VeleroV2alpha1Client -func (c *Clientset) VeleroV2alpha1() velerov2alpha1.VeleroV2alpha1Interface { - return c.veleroV2alpha1 -} - -// Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - if c == nil { - return nil - } - return c.DiscoveryClient -} - -// NewForConfig creates a new Clientset for the given config. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfig will generate a rate-limiter in configShallowCopy. -func NewForConfig(c *rest.Config) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - if configShallowCopy.Burst <= 0 { - return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") - } - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - var cs Clientset - var err error - cs.veleroV1, err = velerov1.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } - cs.veleroV2alpha1, err = velerov2alpha1.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } - - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) - if err != nil { - return nil, err - } - return &cs, nil -} - -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *Clientset { - var cs Clientset - cs.veleroV1 = velerov1.NewForConfigOrDie(c) - cs.veleroV2alpha1 = velerov2alpha1.NewForConfigOrDie(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) - return &cs -} - -// New creates a new Clientset for the given RESTClient. -func New(c rest.Interface) *Clientset { - var cs Clientset - cs.veleroV1 = velerov1.New(c) - cs.veleroV2alpha1 = velerov2alpha1.New(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClient(c) - return &cs -} diff --git a/pkg/generated/clientset/versioned/doc.go b/pkg/generated/clientset/versioned/doc.go deleted file mode 100644 index 95ffaaafa..000000000 --- a/pkg/generated/clientset/versioned/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go deleted file mode 100644 index d514b27c1..000000000 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ /dev/null @@ -1,92 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - clientset "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - velerov1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1" - fakevelerov1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1/fake" - velerov2alpha1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v2alpha1" - fakevelerov2alpha1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/discovery" - fakediscovery "k8s.io/client-go/discovery/fake" - "k8s.io/client-go/testing" -) - -// NewSimpleClientset returns a clientset that will respond with the provided objects. -// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement -// for a real clientset and is mostly useful in simple unit tests. -func NewSimpleClientset(objects ...runtime.Object) *Clientset { - o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) - for _, obj := range objects { - if err := o.Add(obj); err != nil { - panic(err) - } - } - - cs := &Clientset{tracker: o} - cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} - cs.AddReactor("*", "*", testing.ObjectReaction(o)) - cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { - gvr := action.GetResource() - ns := action.GetNamespace() - watch, err := o.Watch(gvr, ns) - if err != nil { - return false, nil, err - } - return true, watch, nil - }) - - return cs -} - -// Clientset implements clientset.Interface. Meant to be embedded into a -// struct to get a default implementation. This makes faking out just the method -// you want to test easier. -type Clientset struct { - testing.Fake - discovery *fakediscovery.FakeDiscovery - tracker testing.ObjectTracker -} - -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - return c.discovery -} - -func (c *Clientset) Tracker() testing.ObjectTracker { - return c.tracker -} - -var ( - _ clientset.Interface = &Clientset{} - _ testing.FakeClient = &Clientset{} -) - -// VeleroV1 retrieves the VeleroV1Client -func (c *Clientset) VeleroV1() velerov1.VeleroV1Interface { - return &fakevelerov1.FakeVeleroV1{Fake: &c.Fake} -} - -// VeleroV2alpha1 retrieves the VeleroV2alpha1Client -func (c *Clientset) VeleroV2alpha1() velerov2alpha1.VeleroV2alpha1Interface { - return &fakevelerov2alpha1.FakeVeleroV2alpha1{Fake: &c.Fake} -} diff --git a/pkg/generated/clientset/versioned/fake/doc.go b/pkg/generated/clientset/versioned/fake/doc.go deleted file mode 100644 index 1403ef8c7..000000000 --- a/pkg/generated/clientset/versioned/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated fake clientset. -package fake diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go deleted file mode 100644 index 8e9316a47..000000000 --- a/pkg/generated/clientset/versioned/fake/register.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - velerov2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var scheme = runtime.NewScheme() -var codecs = serializer.NewCodecFactory(scheme) - -var localSchemeBuilder = runtime.SchemeBuilder{ - velerov1.AddToScheme, - velerov2alpha1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(scheme)) -} diff --git a/pkg/generated/clientset/versioned/mocks/Interface.go b/pkg/generated/clientset/versioned/mocks/Interface.go deleted file mode 100644 index 4544cbc4d..000000000 --- a/pkg/generated/clientset/versioned/mocks/Interface.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by mockery v2.30.1. DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - discovery "k8s.io/client-go/discovery" - - v1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1" - - v2alpha1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v2alpha1" -) - -// Interface is an autogenerated mock type for the Interface type -type Interface struct { - mock.Mock -} - -// Discovery provides a mock function with given fields: -func (_m *Interface) Discovery() discovery.DiscoveryInterface { - ret := _m.Called() - - var r0 discovery.DiscoveryInterface - if rf, ok := ret.Get(0).(func() discovery.DiscoveryInterface); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(discovery.DiscoveryInterface) - } - } - - return r0 -} - -// VeleroV1 provides a mock function with given fields: -func (_m *Interface) VeleroV1() v1.VeleroV1Interface { - ret := _m.Called() - - var r0 v1.VeleroV1Interface - if rf, ok := ret.Get(0).(func() v1.VeleroV1Interface); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.VeleroV1Interface) - } - } - - return r0 -} - -// VeleroV2alpha1 provides a mock function with given fields: -func (_m *Interface) VeleroV2alpha1() v2alpha1.VeleroV2alpha1Interface { - ret := _m.Called() - - var r0 v2alpha1.VeleroV2alpha1Interface - if rf, ok := ret.Get(0).(func() v2alpha1.VeleroV2alpha1Interface); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v2alpha1.VeleroV2alpha1Interface) - } - } - - return r0 -} - -// NewInterface creates a new instance of Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *Interface { - mock := &Interface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/generated/clientset/versioned/scheme/doc.go b/pkg/generated/clientset/versioned/scheme/doc.go deleted file mode 100644 index 927fc4f47..000000000 --- a/pkg/generated/clientset/versioned/scheme/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package contains the scheme of the automatically generated clientset. -package scheme diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go deleted file mode 100644 index 12654733e..000000000 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package scheme - -import ( - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - velerov2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) -var ParameterCodec = runtime.NewParameterCodec(Scheme) -var localSchemeBuilder = runtime.SchemeBuilder{ - velerov1.AddToScheme, - velerov2alpha1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(Scheme)) -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/backup.go b/pkg/generated/clientset/versioned/typed/velero/v1/backup.go deleted file mode 100644 index 420bfc5c9..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/backup.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - scheme "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// BackupsGetter has a method to return a BackupInterface. -// A group's client should implement this interface. -type BackupsGetter interface { - Backups(namespace string) BackupInterface -} - -// BackupInterface has methods to work with Backup resources. -type BackupInterface interface { - Create(ctx context.Context, backup *v1.Backup, opts metav1.CreateOptions) (*v1.Backup, error) - Update(ctx context.Context, backup *v1.Backup, opts metav1.UpdateOptions) (*v1.Backup, error) - UpdateStatus(ctx context.Context, backup *v1.Backup, opts metav1.UpdateOptions) (*v1.Backup, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Backup, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.BackupList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Backup, err error) - BackupExpansion -} - -// backups implements BackupInterface -type backups struct { - client rest.Interface - ns string -} - -// newBackups returns a Backups -func newBackups(c *VeleroV1Client, namespace string) *backups { - return &backups{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the backup, and returns the corresponding backup object, and an error if there is any. -func (c *backups) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Backup, err error) { - result = &v1.Backup{} - err = c.client.Get(). - Namespace(c.ns). - Resource("backups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Backups that match those selectors. -func (c *backups) List(ctx context.Context, opts metav1.ListOptions) (result *v1.BackupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.BackupList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("backups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested backups. -func (c *backups) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("backups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a backup and creates it. Returns the server's representation of the backup, and an error, if there is any. -func (c *backups) Create(ctx context.Context, backup *v1.Backup, opts metav1.CreateOptions) (result *v1.Backup, err error) { - result = &v1.Backup{} - err = c.client.Post(). - Namespace(c.ns). - Resource("backups"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backup). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a backup and updates it. Returns the server's representation of the backup, and an error, if there is any. -func (c *backups) Update(ctx context.Context, backup *v1.Backup, opts metav1.UpdateOptions) (result *v1.Backup, err error) { - result = &v1.Backup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("backups"). - Name(backup.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backup). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *backups) UpdateStatus(ctx context.Context, backup *v1.Backup, opts metav1.UpdateOptions) (result *v1.Backup, err error) { - result = &v1.Backup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("backups"). - Name(backup.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backup). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the backup and deletes it. Returns an error if one occurs. -func (c *backups) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("backups"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *backups) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("backups"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched backup. -func (c *backups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Backup, err error) { - result = &v1.Backup{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("backups"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/backuprepository.go b/pkg/generated/clientset/versioned/typed/velero/v1/backuprepository.go deleted file mode 100644 index 7ecef6dcf..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/backuprepository.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - scheme "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// BackupRepositoriesGetter has a method to return a BackupRepositoryInterface. -// A group's client should implement this interface. -type BackupRepositoriesGetter interface { - BackupRepositories(namespace string) BackupRepositoryInterface -} - -// BackupRepositoryInterface has methods to work with BackupRepository resources. -type BackupRepositoryInterface interface { - Create(ctx context.Context, backupRepository *v1.BackupRepository, opts metav1.CreateOptions) (*v1.BackupRepository, error) - Update(ctx context.Context, backupRepository *v1.BackupRepository, opts metav1.UpdateOptions) (*v1.BackupRepository, error) - UpdateStatus(ctx context.Context, backupRepository *v1.BackupRepository, opts metav1.UpdateOptions) (*v1.BackupRepository, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.BackupRepository, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.BackupRepositoryList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BackupRepository, err error) - BackupRepositoryExpansion -} - -// backupRepositories implements BackupRepositoryInterface -type backupRepositories struct { - client rest.Interface - ns string -} - -// newBackupRepositories returns a BackupRepositories -func newBackupRepositories(c *VeleroV1Client, namespace string) *backupRepositories { - return &backupRepositories{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the backupRepository, and returns the corresponding backupRepository object, and an error if there is any. -func (c *backupRepositories) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.BackupRepository, err error) { - result = &v1.BackupRepository{} - err = c.client.Get(). - Namespace(c.ns). - Resource("backuprepositories"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of BackupRepositories that match those selectors. -func (c *backupRepositories) List(ctx context.Context, opts metav1.ListOptions) (result *v1.BackupRepositoryList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.BackupRepositoryList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("backuprepositories"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested backupRepositories. -func (c *backupRepositories) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("backuprepositories"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a backupRepository and creates it. Returns the server's representation of the backupRepository, and an error, if there is any. -func (c *backupRepositories) Create(ctx context.Context, backupRepository *v1.BackupRepository, opts metav1.CreateOptions) (result *v1.BackupRepository, err error) { - result = &v1.BackupRepository{} - err = c.client.Post(). - Namespace(c.ns). - Resource("backuprepositories"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backupRepository). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a backupRepository and updates it. Returns the server's representation of the backupRepository, and an error, if there is any. -func (c *backupRepositories) Update(ctx context.Context, backupRepository *v1.BackupRepository, opts metav1.UpdateOptions) (result *v1.BackupRepository, err error) { - result = &v1.BackupRepository{} - err = c.client.Put(). - Namespace(c.ns). - Resource("backuprepositories"). - Name(backupRepository.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backupRepository). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *backupRepositories) UpdateStatus(ctx context.Context, backupRepository *v1.BackupRepository, opts metav1.UpdateOptions) (result *v1.BackupRepository, err error) { - result = &v1.BackupRepository{} - err = c.client.Put(). - Namespace(c.ns). - Resource("backuprepositories"). - Name(backupRepository.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backupRepository). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the backupRepository and deletes it. Returns an error if one occurs. -func (c *backupRepositories) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("backuprepositories"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *backupRepositories) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("backuprepositories"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched backupRepository. -func (c *backupRepositories) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BackupRepository, err error) { - result = &v1.BackupRepository{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("backuprepositories"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/backupstoragelocation.go b/pkg/generated/clientset/versioned/typed/velero/v1/backupstoragelocation.go deleted file mode 100644 index 352c08ad2..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/backupstoragelocation.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - scheme "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// BackupStorageLocationsGetter has a method to return a BackupStorageLocationInterface. -// A group's client should implement this interface. -type BackupStorageLocationsGetter interface { - BackupStorageLocations(namespace string) BackupStorageLocationInterface -} - -// BackupStorageLocationInterface has methods to work with BackupStorageLocation resources. -type BackupStorageLocationInterface interface { - Create(ctx context.Context, backupStorageLocation *v1.BackupStorageLocation, opts metav1.CreateOptions) (*v1.BackupStorageLocation, error) - Update(ctx context.Context, backupStorageLocation *v1.BackupStorageLocation, opts metav1.UpdateOptions) (*v1.BackupStorageLocation, error) - UpdateStatus(ctx context.Context, backupStorageLocation *v1.BackupStorageLocation, opts metav1.UpdateOptions) (*v1.BackupStorageLocation, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.BackupStorageLocation, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.BackupStorageLocationList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BackupStorageLocation, err error) - BackupStorageLocationExpansion -} - -// backupStorageLocations implements BackupStorageLocationInterface -type backupStorageLocations struct { - client rest.Interface - ns string -} - -// newBackupStorageLocations returns a BackupStorageLocations -func newBackupStorageLocations(c *VeleroV1Client, namespace string) *backupStorageLocations { - return &backupStorageLocations{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the backupStorageLocation, and returns the corresponding backupStorageLocation object, and an error if there is any. -func (c *backupStorageLocations) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.BackupStorageLocation, err error) { - result = &v1.BackupStorageLocation{} - err = c.client.Get(). - Namespace(c.ns). - Resource("backupstoragelocations"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of BackupStorageLocations that match those selectors. -func (c *backupStorageLocations) List(ctx context.Context, opts metav1.ListOptions) (result *v1.BackupStorageLocationList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.BackupStorageLocationList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("backupstoragelocations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested backupStorageLocations. -func (c *backupStorageLocations) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("backupstoragelocations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a backupStorageLocation and creates it. Returns the server's representation of the backupStorageLocation, and an error, if there is any. -func (c *backupStorageLocations) Create(ctx context.Context, backupStorageLocation *v1.BackupStorageLocation, opts metav1.CreateOptions) (result *v1.BackupStorageLocation, err error) { - result = &v1.BackupStorageLocation{} - err = c.client.Post(). - Namespace(c.ns). - Resource("backupstoragelocations"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backupStorageLocation). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a backupStorageLocation and updates it. Returns the server's representation of the backupStorageLocation, and an error, if there is any. -func (c *backupStorageLocations) Update(ctx context.Context, backupStorageLocation *v1.BackupStorageLocation, opts metav1.UpdateOptions) (result *v1.BackupStorageLocation, err error) { - result = &v1.BackupStorageLocation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("backupstoragelocations"). - Name(backupStorageLocation.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backupStorageLocation). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *backupStorageLocations) UpdateStatus(ctx context.Context, backupStorageLocation *v1.BackupStorageLocation, opts metav1.UpdateOptions) (result *v1.BackupStorageLocation, err error) { - result = &v1.BackupStorageLocation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("backupstoragelocations"). - Name(backupStorageLocation.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backupStorageLocation). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the backupStorageLocation and deletes it. Returns an error if one occurs. -func (c *backupStorageLocations) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("backupstoragelocations"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *backupStorageLocations) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("backupstoragelocations"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched backupStorageLocation. -func (c *backupStorageLocations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BackupStorageLocation, err error) { - result = &v1.BackupStorageLocation{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("backupstoragelocations"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/deletebackuprequest.go b/pkg/generated/clientset/versioned/typed/velero/v1/deletebackuprequest.go deleted file mode 100644 index e713e4df9..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/deletebackuprequest.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - scheme "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// DeleteBackupRequestsGetter has a method to return a DeleteBackupRequestInterface. -// A group's client should implement this interface. -type DeleteBackupRequestsGetter interface { - DeleteBackupRequests(namespace string) DeleteBackupRequestInterface -} - -// DeleteBackupRequestInterface has methods to work with DeleteBackupRequest resources. -type DeleteBackupRequestInterface interface { - Create(ctx context.Context, deleteBackupRequest *v1.DeleteBackupRequest, opts metav1.CreateOptions) (*v1.DeleteBackupRequest, error) - Update(ctx context.Context, deleteBackupRequest *v1.DeleteBackupRequest, opts metav1.UpdateOptions) (*v1.DeleteBackupRequest, error) - UpdateStatus(ctx context.Context, deleteBackupRequest *v1.DeleteBackupRequest, opts metav1.UpdateOptions) (*v1.DeleteBackupRequest, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.DeleteBackupRequest, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.DeleteBackupRequestList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.DeleteBackupRequest, err error) - DeleteBackupRequestExpansion -} - -// deleteBackupRequests implements DeleteBackupRequestInterface -type deleteBackupRequests struct { - client rest.Interface - ns string -} - -// newDeleteBackupRequests returns a DeleteBackupRequests -func newDeleteBackupRequests(c *VeleroV1Client, namespace string) *deleteBackupRequests { - return &deleteBackupRequests{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the deleteBackupRequest, and returns the corresponding deleteBackupRequest object, and an error if there is any. -func (c *deleteBackupRequests) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.DeleteBackupRequest, err error) { - result = &v1.DeleteBackupRequest{} - err = c.client.Get(). - Namespace(c.ns). - Resource("deletebackuprequests"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DeleteBackupRequests that match those selectors. -func (c *deleteBackupRequests) List(ctx context.Context, opts metav1.ListOptions) (result *v1.DeleteBackupRequestList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.DeleteBackupRequestList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("deletebackuprequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested deleteBackupRequests. -func (c *deleteBackupRequests) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("deletebackuprequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a deleteBackupRequest and creates it. Returns the server's representation of the deleteBackupRequest, and an error, if there is any. -func (c *deleteBackupRequests) Create(ctx context.Context, deleteBackupRequest *v1.DeleteBackupRequest, opts metav1.CreateOptions) (result *v1.DeleteBackupRequest, err error) { - result = &v1.DeleteBackupRequest{} - err = c.client.Post(). - Namespace(c.ns). - Resource("deletebackuprequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(deleteBackupRequest). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a deleteBackupRequest and updates it. Returns the server's representation of the deleteBackupRequest, and an error, if there is any. -func (c *deleteBackupRequests) Update(ctx context.Context, deleteBackupRequest *v1.DeleteBackupRequest, opts metav1.UpdateOptions) (result *v1.DeleteBackupRequest, err error) { - result = &v1.DeleteBackupRequest{} - err = c.client.Put(). - Namespace(c.ns). - Resource("deletebackuprequests"). - Name(deleteBackupRequest.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(deleteBackupRequest). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *deleteBackupRequests) UpdateStatus(ctx context.Context, deleteBackupRequest *v1.DeleteBackupRequest, opts metav1.UpdateOptions) (result *v1.DeleteBackupRequest, err error) { - result = &v1.DeleteBackupRequest{} - err = c.client.Put(). - Namespace(c.ns). - Resource("deletebackuprequests"). - Name(deleteBackupRequest.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(deleteBackupRequest). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the deleteBackupRequest and deletes it. Returns an error if one occurs. -func (c *deleteBackupRequests) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("deletebackuprequests"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *deleteBackupRequests) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("deletebackuprequests"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched deleteBackupRequest. -func (c *deleteBackupRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.DeleteBackupRequest, err error) { - result = &v1.DeleteBackupRequest{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("deletebackuprequests"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/doc.go b/pkg/generated/clientset/versioned/typed/velero/v1/doc.go deleted file mode 100644 index d2243753c..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1 diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/downloadrequest.go b/pkg/generated/clientset/versioned/typed/velero/v1/downloadrequest.go deleted file mode 100644 index 68e5011f7..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/downloadrequest.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - scheme "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// DownloadRequestsGetter has a method to return a DownloadRequestInterface. -// A group's client should implement this interface. -type DownloadRequestsGetter interface { - DownloadRequests(namespace string) DownloadRequestInterface -} - -// DownloadRequestInterface has methods to work with DownloadRequest resources. -type DownloadRequestInterface interface { - Create(ctx context.Context, downloadRequest *v1.DownloadRequest, opts metav1.CreateOptions) (*v1.DownloadRequest, error) - Update(ctx context.Context, downloadRequest *v1.DownloadRequest, opts metav1.UpdateOptions) (*v1.DownloadRequest, error) - UpdateStatus(ctx context.Context, downloadRequest *v1.DownloadRequest, opts metav1.UpdateOptions) (*v1.DownloadRequest, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.DownloadRequest, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.DownloadRequestList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.DownloadRequest, err error) - DownloadRequestExpansion -} - -// downloadRequests implements DownloadRequestInterface -type downloadRequests struct { - client rest.Interface - ns string -} - -// newDownloadRequests returns a DownloadRequests -func newDownloadRequests(c *VeleroV1Client, namespace string) *downloadRequests { - return &downloadRequests{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the downloadRequest, and returns the corresponding downloadRequest object, and an error if there is any. -func (c *downloadRequests) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.DownloadRequest, err error) { - result = &v1.DownloadRequest{} - err = c.client.Get(). - Namespace(c.ns). - Resource("downloadrequests"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DownloadRequests that match those selectors. -func (c *downloadRequests) List(ctx context.Context, opts metav1.ListOptions) (result *v1.DownloadRequestList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.DownloadRequestList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("downloadrequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested downloadRequests. -func (c *downloadRequests) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("downloadrequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a downloadRequest and creates it. Returns the server's representation of the downloadRequest, and an error, if there is any. -func (c *downloadRequests) Create(ctx context.Context, downloadRequest *v1.DownloadRequest, opts metav1.CreateOptions) (result *v1.DownloadRequest, err error) { - result = &v1.DownloadRequest{} - err = c.client.Post(). - Namespace(c.ns). - Resource("downloadrequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(downloadRequest). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a downloadRequest and updates it. Returns the server's representation of the downloadRequest, and an error, if there is any. -func (c *downloadRequests) Update(ctx context.Context, downloadRequest *v1.DownloadRequest, opts metav1.UpdateOptions) (result *v1.DownloadRequest, err error) { - result = &v1.DownloadRequest{} - err = c.client.Put(). - Namespace(c.ns). - Resource("downloadrequests"). - Name(downloadRequest.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(downloadRequest). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *downloadRequests) UpdateStatus(ctx context.Context, downloadRequest *v1.DownloadRequest, opts metav1.UpdateOptions) (result *v1.DownloadRequest, err error) { - result = &v1.DownloadRequest{} - err = c.client.Put(). - Namespace(c.ns). - Resource("downloadrequests"). - Name(downloadRequest.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(downloadRequest). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the downloadRequest and deletes it. Returns an error if one occurs. -func (c *downloadRequests) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("downloadrequests"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *downloadRequests) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("downloadrequests"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched downloadRequest. -func (c *downloadRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.DownloadRequest, err error) { - result = &v1.DownloadRequest{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("downloadrequests"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/fake/doc.go b/pkg/generated/clientset/versioned/typed/velero/v1/fake/doc.go deleted file mode 100644 index de930591e..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_backup.go b/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_backup.go deleted file mode 100644 index 4045f4bb5..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_backup.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeBackups implements BackupInterface -type FakeBackups struct { - Fake *FakeVeleroV1 - ns string -} - -var backupsResource = schema.GroupVersionResource{Group: "velero.io", Version: "v1", Resource: "backups"} - -var backupsKind = schema.GroupVersionKind{Group: "velero.io", Version: "v1", Kind: "Backup"} - -// Get takes name of the backup, and returns the corresponding backup object, and an error if there is any. -func (c *FakeBackups) Get(ctx context.Context, name string, options v1.GetOptions) (result *velerov1.Backup, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(backupsResource, c.ns, name), &velerov1.Backup{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Backup), err -} - -// List takes label and field selectors, and returns the list of Backups that match those selectors. -func (c *FakeBackups) List(ctx context.Context, opts v1.ListOptions) (result *velerov1.BackupList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(backupsResource, backupsKind, c.ns, opts), &velerov1.BackupList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &velerov1.BackupList{ListMeta: obj.(*velerov1.BackupList).ListMeta} - for _, item := range obj.(*velerov1.BackupList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested backups. -func (c *FakeBackups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(backupsResource, c.ns, opts)) - -} - -// Create takes the representation of a backup and creates it. Returns the server's representation of the backup, and an error, if there is any. -func (c *FakeBackups) Create(ctx context.Context, backup *velerov1.Backup, opts v1.CreateOptions) (result *velerov1.Backup, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(backupsResource, c.ns, backup), &velerov1.Backup{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Backup), err -} - -// Update takes the representation of a backup and updates it. Returns the server's representation of the backup, and an error, if there is any. -func (c *FakeBackups) Update(ctx context.Context, backup *velerov1.Backup, opts v1.UpdateOptions) (result *velerov1.Backup, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(backupsResource, c.ns, backup), &velerov1.Backup{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Backup), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeBackups) UpdateStatus(ctx context.Context, backup *velerov1.Backup, opts v1.UpdateOptions) (*velerov1.Backup, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(backupsResource, "status", c.ns, backup), &velerov1.Backup{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Backup), err -} - -// Delete takes name of the backup and deletes it. Returns an error if one occurs. -func (c *FakeBackups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(backupsResource, c.ns, name), &velerov1.Backup{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeBackups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(backupsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &velerov1.BackupList{}) - return err -} - -// Patch applies the patch and returns the patched backup. -func (c *FakeBackups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *velerov1.Backup, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(backupsResource, c.ns, name, pt, data, subresources...), &velerov1.Backup{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Backup), err -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_backuprepository.go b/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_backuprepository.go deleted file mode 100644 index ef9d6b41c..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_backuprepository.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeBackupRepositories implements BackupRepositoryInterface -type FakeBackupRepositories struct { - Fake *FakeVeleroV1 - ns string -} - -var backuprepositoriesResource = schema.GroupVersionResource{Group: "velero.io", Version: "v1", Resource: "backuprepositories"} - -var backuprepositoriesKind = schema.GroupVersionKind{Group: "velero.io", Version: "v1", Kind: "BackupRepository"} - -// Get takes name of the backupRepository, and returns the corresponding backupRepository object, and an error if there is any. -func (c *FakeBackupRepositories) Get(ctx context.Context, name string, options v1.GetOptions) (result *velerov1.BackupRepository, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(backuprepositoriesResource, c.ns, name), &velerov1.BackupRepository{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.BackupRepository), err -} - -// List takes label and field selectors, and returns the list of BackupRepositories that match those selectors. -func (c *FakeBackupRepositories) List(ctx context.Context, opts v1.ListOptions) (result *velerov1.BackupRepositoryList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(backuprepositoriesResource, backuprepositoriesKind, c.ns, opts), &velerov1.BackupRepositoryList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &velerov1.BackupRepositoryList{ListMeta: obj.(*velerov1.BackupRepositoryList).ListMeta} - for _, item := range obj.(*velerov1.BackupRepositoryList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested backupRepositories. -func (c *FakeBackupRepositories) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(backuprepositoriesResource, c.ns, opts)) - -} - -// Create takes the representation of a backupRepository and creates it. Returns the server's representation of the backupRepository, and an error, if there is any. -func (c *FakeBackupRepositories) Create(ctx context.Context, backupRepository *velerov1.BackupRepository, opts v1.CreateOptions) (result *velerov1.BackupRepository, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(backuprepositoriesResource, c.ns, backupRepository), &velerov1.BackupRepository{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.BackupRepository), err -} - -// Update takes the representation of a backupRepository and updates it. Returns the server's representation of the backupRepository, and an error, if there is any. -func (c *FakeBackupRepositories) Update(ctx context.Context, backupRepository *velerov1.BackupRepository, opts v1.UpdateOptions) (result *velerov1.BackupRepository, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(backuprepositoriesResource, c.ns, backupRepository), &velerov1.BackupRepository{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.BackupRepository), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeBackupRepositories) UpdateStatus(ctx context.Context, backupRepository *velerov1.BackupRepository, opts v1.UpdateOptions) (*velerov1.BackupRepository, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(backuprepositoriesResource, "status", c.ns, backupRepository), &velerov1.BackupRepository{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.BackupRepository), err -} - -// Delete takes name of the backupRepository and deletes it. Returns an error if one occurs. -func (c *FakeBackupRepositories) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(backuprepositoriesResource, c.ns, name), &velerov1.BackupRepository{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeBackupRepositories) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(backuprepositoriesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &velerov1.BackupRepositoryList{}) - return err -} - -// Patch applies the patch and returns the patched backupRepository. -func (c *FakeBackupRepositories) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *velerov1.BackupRepository, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(backuprepositoriesResource, c.ns, name, pt, data, subresources...), &velerov1.BackupRepository{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.BackupRepository), err -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_backupstoragelocation.go b/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_backupstoragelocation.go deleted file mode 100644 index 4ad942d05..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_backupstoragelocation.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeBackupStorageLocations implements BackupStorageLocationInterface -type FakeBackupStorageLocations struct { - Fake *FakeVeleroV1 - ns string -} - -var backupstoragelocationsResource = schema.GroupVersionResource{Group: "velero.io", Version: "v1", Resource: "backupstoragelocations"} - -var backupstoragelocationsKind = schema.GroupVersionKind{Group: "velero.io", Version: "v1", Kind: "BackupStorageLocation"} - -// Get takes name of the backupStorageLocation, and returns the corresponding backupStorageLocation object, and an error if there is any. -func (c *FakeBackupStorageLocations) Get(ctx context.Context, name string, options v1.GetOptions) (result *velerov1.BackupStorageLocation, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(backupstoragelocationsResource, c.ns, name), &velerov1.BackupStorageLocation{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.BackupStorageLocation), err -} - -// List takes label and field selectors, and returns the list of BackupStorageLocations that match those selectors. -func (c *FakeBackupStorageLocations) List(ctx context.Context, opts v1.ListOptions) (result *velerov1.BackupStorageLocationList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(backupstoragelocationsResource, backupstoragelocationsKind, c.ns, opts), &velerov1.BackupStorageLocationList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &velerov1.BackupStorageLocationList{ListMeta: obj.(*velerov1.BackupStorageLocationList).ListMeta} - for _, item := range obj.(*velerov1.BackupStorageLocationList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested backupStorageLocations. -func (c *FakeBackupStorageLocations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(backupstoragelocationsResource, c.ns, opts)) - -} - -// Create takes the representation of a backupStorageLocation and creates it. Returns the server's representation of the backupStorageLocation, and an error, if there is any. -func (c *FakeBackupStorageLocations) Create(ctx context.Context, backupStorageLocation *velerov1.BackupStorageLocation, opts v1.CreateOptions) (result *velerov1.BackupStorageLocation, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(backupstoragelocationsResource, c.ns, backupStorageLocation), &velerov1.BackupStorageLocation{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.BackupStorageLocation), err -} - -// Update takes the representation of a backupStorageLocation and updates it. Returns the server's representation of the backupStorageLocation, and an error, if there is any. -func (c *FakeBackupStorageLocations) Update(ctx context.Context, backupStorageLocation *velerov1.BackupStorageLocation, opts v1.UpdateOptions) (result *velerov1.BackupStorageLocation, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(backupstoragelocationsResource, c.ns, backupStorageLocation), &velerov1.BackupStorageLocation{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.BackupStorageLocation), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeBackupStorageLocations) UpdateStatus(ctx context.Context, backupStorageLocation *velerov1.BackupStorageLocation, opts v1.UpdateOptions) (*velerov1.BackupStorageLocation, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(backupstoragelocationsResource, "status", c.ns, backupStorageLocation), &velerov1.BackupStorageLocation{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.BackupStorageLocation), err -} - -// Delete takes name of the backupStorageLocation and deletes it. Returns an error if one occurs. -func (c *FakeBackupStorageLocations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(backupstoragelocationsResource, c.ns, name), &velerov1.BackupStorageLocation{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeBackupStorageLocations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(backupstoragelocationsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &velerov1.BackupStorageLocationList{}) - return err -} - -// Patch applies the patch and returns the patched backupStorageLocation. -func (c *FakeBackupStorageLocations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *velerov1.BackupStorageLocation, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(backupstoragelocationsResource, c.ns, name, pt, data, subresources...), &velerov1.BackupStorageLocation{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.BackupStorageLocation), err -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_deletebackuprequest.go b/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_deletebackuprequest.go deleted file mode 100644 index 50a8a466d..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_deletebackuprequest.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeDeleteBackupRequests implements DeleteBackupRequestInterface -type FakeDeleteBackupRequests struct { - Fake *FakeVeleroV1 - ns string -} - -var deletebackuprequestsResource = schema.GroupVersionResource{Group: "velero.io", Version: "v1", Resource: "deletebackuprequests"} - -var deletebackuprequestsKind = schema.GroupVersionKind{Group: "velero.io", Version: "v1", Kind: "DeleteBackupRequest"} - -// Get takes name of the deleteBackupRequest, and returns the corresponding deleteBackupRequest object, and an error if there is any. -func (c *FakeDeleteBackupRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *velerov1.DeleteBackupRequest, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(deletebackuprequestsResource, c.ns, name), &velerov1.DeleteBackupRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.DeleteBackupRequest), err -} - -// List takes label and field selectors, and returns the list of DeleteBackupRequests that match those selectors. -func (c *FakeDeleteBackupRequests) List(ctx context.Context, opts v1.ListOptions) (result *velerov1.DeleteBackupRequestList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(deletebackuprequestsResource, deletebackuprequestsKind, c.ns, opts), &velerov1.DeleteBackupRequestList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &velerov1.DeleteBackupRequestList{ListMeta: obj.(*velerov1.DeleteBackupRequestList).ListMeta} - for _, item := range obj.(*velerov1.DeleteBackupRequestList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested deleteBackupRequests. -func (c *FakeDeleteBackupRequests) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(deletebackuprequestsResource, c.ns, opts)) - -} - -// Create takes the representation of a deleteBackupRequest and creates it. Returns the server's representation of the deleteBackupRequest, and an error, if there is any. -func (c *FakeDeleteBackupRequests) Create(ctx context.Context, deleteBackupRequest *velerov1.DeleteBackupRequest, opts v1.CreateOptions) (result *velerov1.DeleteBackupRequest, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(deletebackuprequestsResource, c.ns, deleteBackupRequest), &velerov1.DeleteBackupRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.DeleteBackupRequest), err -} - -// Update takes the representation of a deleteBackupRequest and updates it. Returns the server's representation of the deleteBackupRequest, and an error, if there is any. -func (c *FakeDeleteBackupRequests) Update(ctx context.Context, deleteBackupRequest *velerov1.DeleteBackupRequest, opts v1.UpdateOptions) (result *velerov1.DeleteBackupRequest, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(deletebackuprequestsResource, c.ns, deleteBackupRequest), &velerov1.DeleteBackupRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.DeleteBackupRequest), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDeleteBackupRequests) UpdateStatus(ctx context.Context, deleteBackupRequest *velerov1.DeleteBackupRequest, opts v1.UpdateOptions) (*velerov1.DeleteBackupRequest, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(deletebackuprequestsResource, "status", c.ns, deleteBackupRequest), &velerov1.DeleteBackupRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.DeleteBackupRequest), err -} - -// Delete takes name of the deleteBackupRequest and deletes it. Returns an error if one occurs. -func (c *FakeDeleteBackupRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(deletebackuprequestsResource, c.ns, name), &velerov1.DeleteBackupRequest{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeDeleteBackupRequests) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(deletebackuprequestsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &velerov1.DeleteBackupRequestList{}) - return err -} - -// Patch applies the patch and returns the patched deleteBackupRequest. -func (c *FakeDeleteBackupRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *velerov1.DeleteBackupRequest, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(deletebackuprequestsResource, c.ns, name, pt, data, subresources...), &velerov1.DeleteBackupRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.DeleteBackupRequest), err -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_downloadrequest.go b/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_downloadrequest.go deleted file mode 100644 index 04e7f0e6e..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_downloadrequest.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeDownloadRequests implements DownloadRequestInterface -type FakeDownloadRequests struct { - Fake *FakeVeleroV1 - ns string -} - -var downloadrequestsResource = schema.GroupVersionResource{Group: "velero.io", Version: "v1", Resource: "downloadrequests"} - -var downloadrequestsKind = schema.GroupVersionKind{Group: "velero.io", Version: "v1", Kind: "DownloadRequest"} - -// Get takes name of the downloadRequest, and returns the corresponding downloadRequest object, and an error if there is any. -func (c *FakeDownloadRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *velerov1.DownloadRequest, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(downloadrequestsResource, c.ns, name), &velerov1.DownloadRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.DownloadRequest), err -} - -// List takes label and field selectors, and returns the list of DownloadRequests that match those selectors. -func (c *FakeDownloadRequests) List(ctx context.Context, opts v1.ListOptions) (result *velerov1.DownloadRequestList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(downloadrequestsResource, downloadrequestsKind, c.ns, opts), &velerov1.DownloadRequestList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &velerov1.DownloadRequestList{ListMeta: obj.(*velerov1.DownloadRequestList).ListMeta} - for _, item := range obj.(*velerov1.DownloadRequestList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested downloadRequests. -func (c *FakeDownloadRequests) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(downloadrequestsResource, c.ns, opts)) - -} - -// Create takes the representation of a downloadRequest and creates it. Returns the server's representation of the downloadRequest, and an error, if there is any. -func (c *FakeDownloadRequests) Create(ctx context.Context, downloadRequest *velerov1.DownloadRequest, opts v1.CreateOptions) (result *velerov1.DownloadRequest, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(downloadrequestsResource, c.ns, downloadRequest), &velerov1.DownloadRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.DownloadRequest), err -} - -// Update takes the representation of a downloadRequest and updates it. Returns the server's representation of the downloadRequest, and an error, if there is any. -func (c *FakeDownloadRequests) Update(ctx context.Context, downloadRequest *velerov1.DownloadRequest, opts v1.UpdateOptions) (result *velerov1.DownloadRequest, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(downloadrequestsResource, c.ns, downloadRequest), &velerov1.DownloadRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.DownloadRequest), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDownloadRequests) UpdateStatus(ctx context.Context, downloadRequest *velerov1.DownloadRequest, opts v1.UpdateOptions) (*velerov1.DownloadRequest, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(downloadrequestsResource, "status", c.ns, downloadRequest), &velerov1.DownloadRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.DownloadRequest), err -} - -// Delete takes name of the downloadRequest and deletes it. Returns an error if one occurs. -func (c *FakeDownloadRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(downloadrequestsResource, c.ns, name), &velerov1.DownloadRequest{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeDownloadRequests) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(downloadrequestsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &velerov1.DownloadRequestList{}) - return err -} - -// Patch applies the patch and returns the patched downloadRequest. -func (c *FakeDownloadRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *velerov1.DownloadRequest, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(downloadrequestsResource, c.ns, name, pt, data, subresources...), &velerov1.DownloadRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.DownloadRequest), err -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_podvolumebackup.go b/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_podvolumebackup.go deleted file mode 100644 index 00c76f935..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_podvolumebackup.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakePodVolumeBackups implements PodVolumeBackupInterface -type FakePodVolumeBackups struct { - Fake *FakeVeleroV1 - ns string -} - -var podvolumebackupsResource = schema.GroupVersionResource{Group: "velero.io", Version: "v1", Resource: "podvolumebackups"} - -var podvolumebackupsKind = schema.GroupVersionKind{Group: "velero.io", Version: "v1", Kind: "PodVolumeBackup"} - -// Get takes name of the podVolumeBackup, and returns the corresponding podVolumeBackup object, and an error if there is any. -func (c *FakePodVolumeBackups) Get(ctx context.Context, name string, options v1.GetOptions) (result *velerov1.PodVolumeBackup, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(podvolumebackupsResource, c.ns, name), &velerov1.PodVolumeBackup{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.PodVolumeBackup), err -} - -// List takes label and field selectors, and returns the list of PodVolumeBackups that match those selectors. -func (c *FakePodVolumeBackups) List(ctx context.Context, opts v1.ListOptions) (result *velerov1.PodVolumeBackupList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(podvolumebackupsResource, podvolumebackupsKind, c.ns, opts), &velerov1.PodVolumeBackupList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &velerov1.PodVolumeBackupList{ListMeta: obj.(*velerov1.PodVolumeBackupList).ListMeta} - for _, item := range obj.(*velerov1.PodVolumeBackupList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested podVolumeBackups. -func (c *FakePodVolumeBackups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(podvolumebackupsResource, c.ns, opts)) - -} - -// Create takes the representation of a podVolumeBackup and creates it. Returns the server's representation of the podVolumeBackup, and an error, if there is any. -func (c *FakePodVolumeBackups) Create(ctx context.Context, podVolumeBackup *velerov1.PodVolumeBackup, opts v1.CreateOptions) (result *velerov1.PodVolumeBackup, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(podvolumebackupsResource, c.ns, podVolumeBackup), &velerov1.PodVolumeBackup{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.PodVolumeBackup), err -} - -// Update takes the representation of a podVolumeBackup and updates it. Returns the server's representation of the podVolumeBackup, and an error, if there is any. -func (c *FakePodVolumeBackups) Update(ctx context.Context, podVolumeBackup *velerov1.PodVolumeBackup, opts v1.UpdateOptions) (result *velerov1.PodVolumeBackup, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(podvolumebackupsResource, c.ns, podVolumeBackup), &velerov1.PodVolumeBackup{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.PodVolumeBackup), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakePodVolumeBackups) UpdateStatus(ctx context.Context, podVolumeBackup *velerov1.PodVolumeBackup, opts v1.UpdateOptions) (*velerov1.PodVolumeBackup, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(podvolumebackupsResource, "status", c.ns, podVolumeBackup), &velerov1.PodVolumeBackup{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.PodVolumeBackup), err -} - -// Delete takes name of the podVolumeBackup and deletes it. Returns an error if one occurs. -func (c *FakePodVolumeBackups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(podvolumebackupsResource, c.ns, name), &velerov1.PodVolumeBackup{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakePodVolumeBackups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(podvolumebackupsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &velerov1.PodVolumeBackupList{}) - return err -} - -// Patch applies the patch and returns the patched podVolumeBackup. -func (c *FakePodVolumeBackups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *velerov1.PodVolumeBackup, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(podvolumebackupsResource, c.ns, name, pt, data, subresources...), &velerov1.PodVolumeBackup{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.PodVolumeBackup), err -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_podvolumerestore.go b/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_podvolumerestore.go deleted file mode 100644 index da1238797..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_podvolumerestore.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakePodVolumeRestores implements PodVolumeRestoreInterface -type FakePodVolumeRestores struct { - Fake *FakeVeleroV1 - ns string -} - -var podvolumerestoresResource = schema.GroupVersionResource{Group: "velero.io", Version: "v1", Resource: "podvolumerestores"} - -var podvolumerestoresKind = schema.GroupVersionKind{Group: "velero.io", Version: "v1", Kind: "PodVolumeRestore"} - -// Get takes name of the podVolumeRestore, and returns the corresponding podVolumeRestore object, and an error if there is any. -func (c *FakePodVolumeRestores) Get(ctx context.Context, name string, options v1.GetOptions) (result *velerov1.PodVolumeRestore, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(podvolumerestoresResource, c.ns, name), &velerov1.PodVolumeRestore{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.PodVolumeRestore), err -} - -// List takes label and field selectors, and returns the list of PodVolumeRestores that match those selectors. -func (c *FakePodVolumeRestores) List(ctx context.Context, opts v1.ListOptions) (result *velerov1.PodVolumeRestoreList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(podvolumerestoresResource, podvolumerestoresKind, c.ns, opts), &velerov1.PodVolumeRestoreList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &velerov1.PodVolumeRestoreList{ListMeta: obj.(*velerov1.PodVolumeRestoreList).ListMeta} - for _, item := range obj.(*velerov1.PodVolumeRestoreList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested podVolumeRestores. -func (c *FakePodVolumeRestores) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(podvolumerestoresResource, c.ns, opts)) - -} - -// Create takes the representation of a podVolumeRestore and creates it. Returns the server's representation of the podVolumeRestore, and an error, if there is any. -func (c *FakePodVolumeRestores) Create(ctx context.Context, podVolumeRestore *velerov1.PodVolumeRestore, opts v1.CreateOptions) (result *velerov1.PodVolumeRestore, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(podvolumerestoresResource, c.ns, podVolumeRestore), &velerov1.PodVolumeRestore{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.PodVolumeRestore), err -} - -// Update takes the representation of a podVolumeRestore and updates it. Returns the server's representation of the podVolumeRestore, and an error, if there is any. -func (c *FakePodVolumeRestores) Update(ctx context.Context, podVolumeRestore *velerov1.PodVolumeRestore, opts v1.UpdateOptions) (result *velerov1.PodVolumeRestore, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(podvolumerestoresResource, c.ns, podVolumeRestore), &velerov1.PodVolumeRestore{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.PodVolumeRestore), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakePodVolumeRestores) UpdateStatus(ctx context.Context, podVolumeRestore *velerov1.PodVolumeRestore, opts v1.UpdateOptions) (*velerov1.PodVolumeRestore, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(podvolumerestoresResource, "status", c.ns, podVolumeRestore), &velerov1.PodVolumeRestore{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.PodVolumeRestore), err -} - -// Delete takes name of the podVolumeRestore and deletes it. Returns an error if one occurs. -func (c *FakePodVolumeRestores) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(podvolumerestoresResource, c.ns, name), &velerov1.PodVolumeRestore{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakePodVolumeRestores) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(podvolumerestoresResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &velerov1.PodVolumeRestoreList{}) - return err -} - -// Patch applies the patch and returns the patched podVolumeRestore. -func (c *FakePodVolumeRestores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *velerov1.PodVolumeRestore, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(podvolumerestoresResource, c.ns, name, pt, data, subresources...), &velerov1.PodVolumeRestore{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.PodVolumeRestore), err -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_restore.go b/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_restore.go deleted file mode 100644 index 73e00128a..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_restore.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeRestores implements RestoreInterface -type FakeRestores struct { - Fake *FakeVeleroV1 - ns string -} - -var restoresResource = schema.GroupVersionResource{Group: "velero.io", Version: "v1", Resource: "restores"} - -var restoresKind = schema.GroupVersionKind{Group: "velero.io", Version: "v1", Kind: "Restore"} - -// Get takes name of the restore, and returns the corresponding restore object, and an error if there is any. -func (c *FakeRestores) Get(ctx context.Context, name string, options v1.GetOptions) (result *velerov1.Restore, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(restoresResource, c.ns, name), &velerov1.Restore{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Restore), err -} - -// List takes label and field selectors, and returns the list of Restores that match those selectors. -func (c *FakeRestores) List(ctx context.Context, opts v1.ListOptions) (result *velerov1.RestoreList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(restoresResource, restoresKind, c.ns, opts), &velerov1.RestoreList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &velerov1.RestoreList{ListMeta: obj.(*velerov1.RestoreList).ListMeta} - for _, item := range obj.(*velerov1.RestoreList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested restores. -func (c *FakeRestores) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(restoresResource, c.ns, opts)) - -} - -// Create takes the representation of a restore and creates it. Returns the server's representation of the restore, and an error, if there is any. -func (c *FakeRestores) Create(ctx context.Context, restore *velerov1.Restore, opts v1.CreateOptions) (result *velerov1.Restore, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(restoresResource, c.ns, restore), &velerov1.Restore{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Restore), err -} - -// Update takes the representation of a restore and updates it. Returns the server's representation of the restore, and an error, if there is any. -func (c *FakeRestores) Update(ctx context.Context, restore *velerov1.Restore, opts v1.UpdateOptions) (result *velerov1.Restore, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(restoresResource, c.ns, restore), &velerov1.Restore{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Restore), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeRestores) UpdateStatus(ctx context.Context, restore *velerov1.Restore, opts v1.UpdateOptions) (*velerov1.Restore, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(restoresResource, "status", c.ns, restore), &velerov1.Restore{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Restore), err -} - -// Delete takes name of the restore and deletes it. Returns an error if one occurs. -func (c *FakeRestores) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(restoresResource, c.ns, name), &velerov1.Restore{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeRestores) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(restoresResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &velerov1.RestoreList{}) - return err -} - -// Patch applies the patch and returns the patched restore. -func (c *FakeRestores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *velerov1.Restore, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(restoresResource, c.ns, name, pt, data, subresources...), &velerov1.Restore{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Restore), err -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_schedule.go b/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_schedule.go deleted file mode 100644 index 5789e7e9e..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_schedule.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeSchedules implements ScheduleInterface -type FakeSchedules struct { - Fake *FakeVeleroV1 - ns string -} - -var schedulesResource = schema.GroupVersionResource{Group: "velero.io", Version: "v1", Resource: "schedules"} - -var schedulesKind = schema.GroupVersionKind{Group: "velero.io", Version: "v1", Kind: "Schedule"} - -// Get takes name of the schedule, and returns the corresponding schedule object, and an error if there is any. -func (c *FakeSchedules) Get(ctx context.Context, name string, options v1.GetOptions) (result *velerov1.Schedule, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(schedulesResource, c.ns, name), &velerov1.Schedule{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Schedule), err -} - -// List takes label and field selectors, and returns the list of Schedules that match those selectors. -func (c *FakeSchedules) List(ctx context.Context, opts v1.ListOptions) (result *velerov1.ScheduleList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(schedulesResource, schedulesKind, c.ns, opts), &velerov1.ScheduleList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &velerov1.ScheduleList{ListMeta: obj.(*velerov1.ScheduleList).ListMeta} - for _, item := range obj.(*velerov1.ScheduleList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested schedules. -func (c *FakeSchedules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(schedulesResource, c.ns, opts)) - -} - -// Create takes the representation of a schedule and creates it. Returns the server's representation of the schedule, and an error, if there is any. -func (c *FakeSchedules) Create(ctx context.Context, schedule *velerov1.Schedule, opts v1.CreateOptions) (result *velerov1.Schedule, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(schedulesResource, c.ns, schedule), &velerov1.Schedule{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Schedule), err -} - -// Update takes the representation of a schedule and updates it. Returns the server's representation of the schedule, and an error, if there is any. -func (c *FakeSchedules) Update(ctx context.Context, schedule *velerov1.Schedule, opts v1.UpdateOptions) (result *velerov1.Schedule, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(schedulesResource, c.ns, schedule), &velerov1.Schedule{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Schedule), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSchedules) UpdateStatus(ctx context.Context, schedule *velerov1.Schedule, opts v1.UpdateOptions) (*velerov1.Schedule, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(schedulesResource, "status", c.ns, schedule), &velerov1.Schedule{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Schedule), err -} - -// Delete takes name of the schedule and deletes it. Returns an error if one occurs. -func (c *FakeSchedules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(schedulesResource, c.ns, name), &velerov1.Schedule{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeSchedules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(schedulesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &velerov1.ScheduleList{}) - return err -} - -// Patch applies the patch and returns the patched schedule. -func (c *FakeSchedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *velerov1.Schedule, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(schedulesResource, c.ns, name, pt, data, subresources...), &velerov1.Schedule{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.Schedule), err -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_serverstatusrequest.go b/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_serverstatusrequest.go deleted file mode 100644 index dc0c9e4ee..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_serverstatusrequest.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeServerStatusRequests implements ServerStatusRequestInterface -type FakeServerStatusRequests struct { - Fake *FakeVeleroV1 - ns string -} - -var serverstatusrequestsResource = schema.GroupVersionResource{Group: "velero.io", Version: "v1", Resource: "serverstatusrequests"} - -var serverstatusrequestsKind = schema.GroupVersionKind{Group: "velero.io", Version: "v1", Kind: "ServerStatusRequest"} - -// Get takes name of the serverStatusRequest, and returns the corresponding serverStatusRequest object, and an error if there is any. -func (c *FakeServerStatusRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *velerov1.ServerStatusRequest, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(serverstatusrequestsResource, c.ns, name), &velerov1.ServerStatusRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.ServerStatusRequest), err -} - -// List takes label and field selectors, and returns the list of ServerStatusRequests that match those selectors. -func (c *FakeServerStatusRequests) List(ctx context.Context, opts v1.ListOptions) (result *velerov1.ServerStatusRequestList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(serverstatusrequestsResource, serverstatusrequestsKind, c.ns, opts), &velerov1.ServerStatusRequestList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &velerov1.ServerStatusRequestList{ListMeta: obj.(*velerov1.ServerStatusRequestList).ListMeta} - for _, item := range obj.(*velerov1.ServerStatusRequestList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested serverStatusRequests. -func (c *FakeServerStatusRequests) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(serverstatusrequestsResource, c.ns, opts)) - -} - -// Create takes the representation of a serverStatusRequest and creates it. Returns the server's representation of the serverStatusRequest, and an error, if there is any. -func (c *FakeServerStatusRequests) Create(ctx context.Context, serverStatusRequest *velerov1.ServerStatusRequest, opts v1.CreateOptions) (result *velerov1.ServerStatusRequest, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(serverstatusrequestsResource, c.ns, serverStatusRequest), &velerov1.ServerStatusRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.ServerStatusRequest), err -} - -// Update takes the representation of a serverStatusRequest and updates it. Returns the server's representation of the serverStatusRequest, and an error, if there is any. -func (c *FakeServerStatusRequests) Update(ctx context.Context, serverStatusRequest *velerov1.ServerStatusRequest, opts v1.UpdateOptions) (result *velerov1.ServerStatusRequest, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(serverstatusrequestsResource, c.ns, serverStatusRequest), &velerov1.ServerStatusRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.ServerStatusRequest), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeServerStatusRequests) UpdateStatus(ctx context.Context, serverStatusRequest *velerov1.ServerStatusRequest, opts v1.UpdateOptions) (*velerov1.ServerStatusRequest, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(serverstatusrequestsResource, "status", c.ns, serverStatusRequest), &velerov1.ServerStatusRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.ServerStatusRequest), err -} - -// Delete takes name of the serverStatusRequest and deletes it. Returns an error if one occurs. -func (c *FakeServerStatusRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(serverstatusrequestsResource, c.ns, name), &velerov1.ServerStatusRequest{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeServerStatusRequests) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(serverstatusrequestsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &velerov1.ServerStatusRequestList{}) - return err -} - -// Patch applies the patch and returns the patched serverStatusRequest. -func (c *FakeServerStatusRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *velerov1.ServerStatusRequest, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(serverstatusrequestsResource, c.ns, name, pt, data, subresources...), &velerov1.ServerStatusRequest{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.ServerStatusRequest), err -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_velero_client.go b/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_velero_client.go deleted file mode 100644 index 444c1f89f..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_velero_client.go +++ /dev/null @@ -1,80 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeVeleroV1 struct { - *testing.Fake -} - -func (c *FakeVeleroV1) Backups(namespace string) v1.BackupInterface { - return &FakeBackups{c, namespace} -} - -func (c *FakeVeleroV1) BackupRepositories(namespace string) v1.BackupRepositoryInterface { - return &FakeBackupRepositories{c, namespace} -} - -func (c *FakeVeleroV1) BackupStorageLocations(namespace string) v1.BackupStorageLocationInterface { - return &FakeBackupStorageLocations{c, namespace} -} - -func (c *FakeVeleroV1) DeleteBackupRequests(namespace string) v1.DeleteBackupRequestInterface { - return &FakeDeleteBackupRequests{c, namespace} -} - -func (c *FakeVeleroV1) DownloadRequests(namespace string) v1.DownloadRequestInterface { - return &FakeDownloadRequests{c, namespace} -} - -func (c *FakeVeleroV1) PodVolumeBackups(namespace string) v1.PodVolumeBackupInterface { - return &FakePodVolumeBackups{c, namespace} -} - -func (c *FakeVeleroV1) PodVolumeRestores(namespace string) v1.PodVolumeRestoreInterface { - return &FakePodVolumeRestores{c, namespace} -} - -func (c *FakeVeleroV1) Restores(namespace string) v1.RestoreInterface { - return &FakeRestores{c, namespace} -} - -func (c *FakeVeleroV1) Schedules(namespace string) v1.ScheduleInterface { - return &FakeSchedules{c, namespace} -} - -func (c *FakeVeleroV1) ServerStatusRequests(namespace string) v1.ServerStatusRequestInterface { - return &FakeServerStatusRequests{c, namespace} -} - -func (c *FakeVeleroV1) VolumeSnapshotLocations(namespace string) v1.VolumeSnapshotLocationInterface { - return &FakeVolumeSnapshotLocations{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeVeleroV1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_volumesnapshotlocation.go b/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_volumesnapshotlocation.go deleted file mode 100644 index c5a7b4fb2..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/fake/fake_volumesnapshotlocation.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeVolumeSnapshotLocations implements VolumeSnapshotLocationInterface -type FakeVolumeSnapshotLocations struct { - Fake *FakeVeleroV1 - ns string -} - -var volumesnapshotlocationsResource = schema.GroupVersionResource{Group: "velero.io", Version: "v1", Resource: "volumesnapshotlocations"} - -var volumesnapshotlocationsKind = schema.GroupVersionKind{Group: "velero.io", Version: "v1", Kind: "VolumeSnapshotLocation"} - -// Get takes name of the volumeSnapshotLocation, and returns the corresponding volumeSnapshotLocation object, and an error if there is any. -func (c *FakeVolumeSnapshotLocations) Get(ctx context.Context, name string, options v1.GetOptions) (result *velerov1.VolumeSnapshotLocation, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(volumesnapshotlocationsResource, c.ns, name), &velerov1.VolumeSnapshotLocation{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.VolumeSnapshotLocation), err -} - -// List takes label and field selectors, and returns the list of VolumeSnapshotLocations that match those selectors. -func (c *FakeVolumeSnapshotLocations) List(ctx context.Context, opts v1.ListOptions) (result *velerov1.VolumeSnapshotLocationList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(volumesnapshotlocationsResource, volumesnapshotlocationsKind, c.ns, opts), &velerov1.VolumeSnapshotLocationList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &velerov1.VolumeSnapshotLocationList{ListMeta: obj.(*velerov1.VolumeSnapshotLocationList).ListMeta} - for _, item := range obj.(*velerov1.VolumeSnapshotLocationList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshotLocations. -func (c *FakeVolumeSnapshotLocations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(volumesnapshotlocationsResource, c.ns, opts)) - -} - -// Create takes the representation of a volumeSnapshotLocation and creates it. Returns the server's representation of the volumeSnapshotLocation, and an error, if there is any. -func (c *FakeVolumeSnapshotLocations) Create(ctx context.Context, volumeSnapshotLocation *velerov1.VolumeSnapshotLocation, opts v1.CreateOptions) (result *velerov1.VolumeSnapshotLocation, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(volumesnapshotlocationsResource, c.ns, volumeSnapshotLocation), &velerov1.VolumeSnapshotLocation{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.VolumeSnapshotLocation), err -} - -// Update takes the representation of a volumeSnapshotLocation and updates it. Returns the server's representation of the volumeSnapshotLocation, and an error, if there is any. -func (c *FakeVolumeSnapshotLocations) Update(ctx context.Context, volumeSnapshotLocation *velerov1.VolumeSnapshotLocation, opts v1.UpdateOptions) (result *velerov1.VolumeSnapshotLocation, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(volumesnapshotlocationsResource, c.ns, volumeSnapshotLocation), &velerov1.VolumeSnapshotLocation{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.VolumeSnapshotLocation), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVolumeSnapshotLocations) UpdateStatus(ctx context.Context, volumeSnapshotLocation *velerov1.VolumeSnapshotLocation, opts v1.UpdateOptions) (*velerov1.VolumeSnapshotLocation, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(volumesnapshotlocationsResource, "status", c.ns, volumeSnapshotLocation), &velerov1.VolumeSnapshotLocation{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.VolumeSnapshotLocation), err -} - -// Delete takes name of the volumeSnapshotLocation and deletes it. Returns an error if one occurs. -func (c *FakeVolumeSnapshotLocations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(volumesnapshotlocationsResource, c.ns, name), &velerov1.VolumeSnapshotLocation{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVolumeSnapshotLocations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(volumesnapshotlocationsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &velerov1.VolumeSnapshotLocationList{}) - return err -} - -// Patch applies the patch and returns the patched volumeSnapshotLocation. -func (c *FakeVolumeSnapshotLocations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *velerov1.VolumeSnapshotLocation, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(volumesnapshotlocationsResource, c.ns, name, pt, data, subresources...), &velerov1.VolumeSnapshotLocation{}) - - if obj == nil { - return nil, err - } - return obj.(*velerov1.VolumeSnapshotLocation), err -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/velero/v1/generated_expansion.go deleted file mode 100644 index 5032fd6a4..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/generated_expansion.go +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -type BackupExpansion interface{} - -type BackupRepositoryExpansion interface{} - -type BackupStorageLocationExpansion interface{} - -type DeleteBackupRequestExpansion interface{} - -type DownloadRequestExpansion interface{} - -type PodVolumeBackupExpansion interface{} - -type PodVolumeRestoreExpansion interface{} - -type RestoreExpansion interface{} - -type ScheduleExpansion interface{} - -type ServerStatusRequestExpansion interface{} - -type VolumeSnapshotLocationExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/BackupInterface.go b/pkg/generated/clientset/versioned/typed/velero/v1/mocks/BackupInterface.go deleted file mode 100644 index ba059729d..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/BackupInterface.go +++ /dev/null @@ -1,252 +0,0 @@ -// Code generated by mockery v2.30.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - types "k8s.io/apimachinery/pkg/types" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - - watch "k8s.io/apimachinery/pkg/watch" -) - -// BackupInterface is an autogenerated mock type for the BackupInterface type -type BackupInterface struct { - mock.Mock -} - -// Create provides a mock function with given fields: ctx, backup, opts -func (_m *BackupInterface) Create(ctx context.Context, backup *v1.Backup, opts metav1.CreateOptions) (*v1.Backup, error) { - ret := _m.Called(ctx, backup, opts) - - var r0 *v1.Backup - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.Backup, metav1.CreateOptions) (*v1.Backup, error)); ok { - return rf(ctx, backup, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.Backup, metav1.CreateOptions) *v1.Backup); ok { - r0 = rf(ctx, backup, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Backup) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.Backup, metav1.CreateOptions) error); ok { - r1 = rf(ctx, backup, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Delete provides a mock function with given fields: ctx, name, opts -func (_m *BackupInterface) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - ret := _m.Called(ctx, name, opts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.DeleteOptions) error); ok { - r0 = rf(ctx, name, opts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// DeleteCollection provides a mock function with given fields: ctx, opts, listOpts -func (_m *BackupInterface) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - ret := _m.Called(ctx, opts, listOpts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.DeleteOptions, metav1.ListOptions) error); ok { - r0 = rf(ctx, opts, listOpts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Get provides a mock function with given fields: ctx, name, opts -func (_m *BackupInterface) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Backup, error) { - ret := _m.Called(ctx, name, opts) - - var r0 *v1.Backup - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) (*v1.Backup, error)); ok { - return rf(ctx, name, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) *v1.Backup); ok { - r0 = rf(ctx, name, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Backup) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, metav1.GetOptions) error); ok { - r1 = rf(ctx, name, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// List provides a mock function with given fields: ctx, opts -func (_m *BackupInterface) List(ctx context.Context, opts metav1.ListOptions) (*v1.BackupList, error) { - ret := _m.Called(ctx, opts) - - var r0 *v1.BackupList - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (*v1.BackupList, error)); ok { - return rf(ctx, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) *v1.BackupList); ok { - r0 = rf(ctx, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.BackupList) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok { - r1 = rf(ctx, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Patch provides a mock function with given fields: ctx, name, pt, data, opts, subresources -func (_m *BackupInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*v1.Backup, error) { - _va := make([]interface{}, len(subresources)) - for _i := range subresources { - _va[_i] = subresources[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, name, pt, data, opts) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *v1.Backup - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) (*v1.Backup, error)); ok { - return rf(ctx, name, pt, data, opts, subresources...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) *v1.Backup); ok { - r0 = rf(ctx, name, pt, data, opts, subresources...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Backup) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) error); ok { - r1 = rf(ctx, name, pt, data, opts, subresources...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Update provides a mock function with given fields: ctx, backup, opts -func (_m *BackupInterface) Update(ctx context.Context, backup *v1.Backup, opts metav1.UpdateOptions) (*v1.Backup, error) { - ret := _m.Called(ctx, backup, opts) - - var r0 *v1.Backup - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.Backup, metav1.UpdateOptions) (*v1.Backup, error)); ok { - return rf(ctx, backup, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.Backup, metav1.UpdateOptions) *v1.Backup); ok { - r0 = rf(ctx, backup, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Backup) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.Backup, metav1.UpdateOptions) error); ok { - r1 = rf(ctx, backup, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateStatus provides a mock function with given fields: ctx, backup, opts -func (_m *BackupInterface) UpdateStatus(ctx context.Context, backup *v1.Backup, opts metav1.UpdateOptions) (*v1.Backup, error) { - ret := _m.Called(ctx, backup, opts) - - var r0 *v1.Backup - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.Backup, metav1.UpdateOptions) (*v1.Backup, error)); ok { - return rf(ctx, backup, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.Backup, metav1.UpdateOptions) *v1.Backup); ok { - r0 = rf(ctx, backup, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Backup) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.Backup, metav1.UpdateOptions) error); ok { - r1 = rf(ctx, backup, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Watch provides a mock function with given fields: ctx, opts -func (_m *BackupInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - ret := _m.Called(ctx, opts) - - var r0 watch.Interface - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (watch.Interface, error)); ok { - return rf(ctx, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) watch.Interface); ok { - r0 = rf(ctx, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(watch.Interface) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok { - r1 = rf(ctx, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewBackupInterface creates a new instance of BackupInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewBackupInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *BackupInterface { - mock := &BackupInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/BackupsGetter.go b/pkg/generated/clientset/versioned/typed/velero/v1/mocks/BackupsGetter.go deleted file mode 100644 index 6c64af7d0..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/BackupsGetter.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by mockery v2.30.1. DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - v1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1" -) - -// BackupsGetter is an autogenerated mock type for the BackupsGetter type -type BackupsGetter struct { - mock.Mock -} - -// Backups provides a mock function with given fields: namespace -func (_m *BackupsGetter) Backups(namespace string) v1.BackupInterface { - ret := _m.Called(namespace) - - var r0 v1.BackupInterface - if rf, ok := ret.Get(0).(func(string) v1.BackupInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.BackupInterface) - } - } - - return r0 -} - -// NewBackupsGetter creates a new instance of BackupsGetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewBackupsGetter(t interface { - mock.TestingT - Cleanup(func()) -}) *BackupsGetter { - mock := &BackupsGetter{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/DeleteBackupRequestInterface.go b/pkg/generated/clientset/versioned/typed/velero/v1/mocks/DeleteBackupRequestInterface.go deleted file mode 100644 index f26ce4021..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/DeleteBackupRequestInterface.go +++ /dev/null @@ -1,252 +0,0 @@ -// Code generated by mockery v2.30.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - types "k8s.io/apimachinery/pkg/types" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - - watch "k8s.io/apimachinery/pkg/watch" -) - -// DeleteBackupRequestInterface is an autogenerated mock type for the DeleteBackupRequestInterface type -type DeleteBackupRequestInterface struct { - mock.Mock -} - -// Create provides a mock function with given fields: ctx, deleteBackupRequest, opts -func (_m *DeleteBackupRequestInterface) Create(ctx context.Context, deleteBackupRequest *v1.DeleteBackupRequest, opts metav1.CreateOptions) (*v1.DeleteBackupRequest, error) { - ret := _m.Called(ctx, deleteBackupRequest, opts) - - var r0 *v1.DeleteBackupRequest - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteBackupRequest, metav1.CreateOptions) (*v1.DeleteBackupRequest, error)); ok { - return rf(ctx, deleteBackupRequest, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteBackupRequest, metav1.CreateOptions) *v1.DeleteBackupRequest); ok { - r0 = rf(ctx, deleteBackupRequest, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.DeleteBackupRequest) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.DeleteBackupRequest, metav1.CreateOptions) error); ok { - r1 = rf(ctx, deleteBackupRequest, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Delete provides a mock function with given fields: ctx, name, opts -func (_m *DeleteBackupRequestInterface) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - ret := _m.Called(ctx, name, opts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.DeleteOptions) error); ok { - r0 = rf(ctx, name, opts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// DeleteCollection provides a mock function with given fields: ctx, opts, listOpts -func (_m *DeleteBackupRequestInterface) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - ret := _m.Called(ctx, opts, listOpts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.DeleteOptions, metav1.ListOptions) error); ok { - r0 = rf(ctx, opts, listOpts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Get provides a mock function with given fields: ctx, name, opts -func (_m *DeleteBackupRequestInterface) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.DeleteBackupRequest, error) { - ret := _m.Called(ctx, name, opts) - - var r0 *v1.DeleteBackupRequest - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) (*v1.DeleteBackupRequest, error)); ok { - return rf(ctx, name, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) *v1.DeleteBackupRequest); ok { - r0 = rf(ctx, name, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.DeleteBackupRequest) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, metav1.GetOptions) error); ok { - r1 = rf(ctx, name, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// List provides a mock function with given fields: ctx, opts -func (_m *DeleteBackupRequestInterface) List(ctx context.Context, opts metav1.ListOptions) (*v1.DeleteBackupRequestList, error) { - ret := _m.Called(ctx, opts) - - var r0 *v1.DeleteBackupRequestList - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (*v1.DeleteBackupRequestList, error)); ok { - return rf(ctx, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) *v1.DeleteBackupRequestList); ok { - r0 = rf(ctx, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.DeleteBackupRequestList) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok { - r1 = rf(ctx, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Patch provides a mock function with given fields: ctx, name, pt, data, opts, subresources -func (_m *DeleteBackupRequestInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*v1.DeleteBackupRequest, error) { - _va := make([]interface{}, len(subresources)) - for _i := range subresources { - _va[_i] = subresources[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, name, pt, data, opts) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *v1.DeleteBackupRequest - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) (*v1.DeleteBackupRequest, error)); ok { - return rf(ctx, name, pt, data, opts, subresources...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) *v1.DeleteBackupRequest); ok { - r0 = rf(ctx, name, pt, data, opts, subresources...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.DeleteBackupRequest) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) error); ok { - r1 = rf(ctx, name, pt, data, opts, subresources...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Update provides a mock function with given fields: ctx, deleteBackupRequest, opts -func (_m *DeleteBackupRequestInterface) Update(ctx context.Context, deleteBackupRequest *v1.DeleteBackupRequest, opts metav1.UpdateOptions) (*v1.DeleteBackupRequest, error) { - ret := _m.Called(ctx, deleteBackupRequest, opts) - - var r0 *v1.DeleteBackupRequest - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteBackupRequest, metav1.UpdateOptions) (*v1.DeleteBackupRequest, error)); ok { - return rf(ctx, deleteBackupRequest, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteBackupRequest, metav1.UpdateOptions) *v1.DeleteBackupRequest); ok { - r0 = rf(ctx, deleteBackupRequest, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.DeleteBackupRequest) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.DeleteBackupRequest, metav1.UpdateOptions) error); ok { - r1 = rf(ctx, deleteBackupRequest, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateStatus provides a mock function with given fields: ctx, deleteBackupRequest, opts -func (_m *DeleteBackupRequestInterface) UpdateStatus(ctx context.Context, deleteBackupRequest *v1.DeleteBackupRequest, opts metav1.UpdateOptions) (*v1.DeleteBackupRequest, error) { - ret := _m.Called(ctx, deleteBackupRequest, opts) - - var r0 *v1.DeleteBackupRequest - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteBackupRequest, metav1.UpdateOptions) (*v1.DeleteBackupRequest, error)); ok { - return rf(ctx, deleteBackupRequest, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteBackupRequest, metav1.UpdateOptions) *v1.DeleteBackupRequest); ok { - r0 = rf(ctx, deleteBackupRequest, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.DeleteBackupRequest) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.DeleteBackupRequest, metav1.UpdateOptions) error); ok { - r1 = rf(ctx, deleteBackupRequest, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Watch provides a mock function with given fields: ctx, opts -func (_m *DeleteBackupRequestInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - ret := _m.Called(ctx, opts) - - var r0 watch.Interface - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (watch.Interface, error)); ok { - return rf(ctx, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) watch.Interface); ok { - r0 = rf(ctx, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(watch.Interface) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok { - r1 = rf(ctx, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewDeleteBackupRequestInterface creates a new instance of DeleteBackupRequestInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewDeleteBackupRequestInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeleteBackupRequestInterface { - mock := &DeleteBackupRequestInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/DeleteBackupRequestsGetter.go b/pkg/generated/clientset/versioned/typed/velero/v1/mocks/DeleteBackupRequestsGetter.go deleted file mode 100644 index 5ddf8b575..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/DeleteBackupRequestsGetter.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by mockery v2.30.1. DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - v1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1" -) - -// DeleteBackupRequestsGetter is an autogenerated mock type for the DeleteBackupRequestsGetter type -type DeleteBackupRequestsGetter struct { - mock.Mock -} - -// DeleteBackupRequests provides a mock function with given fields: namespace -func (_m *DeleteBackupRequestsGetter) DeleteBackupRequests(namespace string) v1.DeleteBackupRequestInterface { - ret := _m.Called(namespace) - - var r0 v1.DeleteBackupRequestInterface - if rf, ok := ret.Get(0).(func(string) v1.DeleteBackupRequestInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.DeleteBackupRequestInterface) - } - } - - return r0 -} - -// NewDeleteBackupRequestsGetter creates a new instance of DeleteBackupRequestsGetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewDeleteBackupRequestsGetter(t interface { - mock.TestingT - Cleanup(func()) -}) *DeleteBackupRequestsGetter { - mock := &DeleteBackupRequestsGetter{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/PodVolumeBackupInterface.go b/pkg/generated/clientset/versioned/typed/velero/v1/mocks/PodVolumeBackupInterface.go deleted file mode 100644 index 9778ca6bf..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/PodVolumeBackupInterface.go +++ /dev/null @@ -1,252 +0,0 @@ -// Code generated by mockery v2.30.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - types "k8s.io/apimachinery/pkg/types" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - - watch "k8s.io/apimachinery/pkg/watch" -) - -// PodVolumeBackupInterface is an autogenerated mock type for the PodVolumeBackupInterface type -type PodVolumeBackupInterface struct { - mock.Mock -} - -// Create provides a mock function with given fields: ctx, podVolumeBackup, opts -func (_m *PodVolumeBackupInterface) Create(ctx context.Context, podVolumeBackup *v1.PodVolumeBackup, opts metav1.CreateOptions) (*v1.PodVolumeBackup, error) { - ret := _m.Called(ctx, podVolumeBackup, opts) - - var r0 *v1.PodVolumeBackup - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.PodVolumeBackup, metav1.CreateOptions) (*v1.PodVolumeBackup, error)); ok { - return rf(ctx, podVolumeBackup, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.PodVolumeBackup, metav1.CreateOptions) *v1.PodVolumeBackup); ok { - r0 = rf(ctx, podVolumeBackup, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.PodVolumeBackup) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.PodVolumeBackup, metav1.CreateOptions) error); ok { - r1 = rf(ctx, podVolumeBackup, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Delete provides a mock function with given fields: ctx, name, opts -func (_m *PodVolumeBackupInterface) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - ret := _m.Called(ctx, name, opts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.DeleteOptions) error); ok { - r0 = rf(ctx, name, opts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// DeleteCollection provides a mock function with given fields: ctx, opts, listOpts -func (_m *PodVolumeBackupInterface) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - ret := _m.Called(ctx, opts, listOpts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.DeleteOptions, metav1.ListOptions) error); ok { - r0 = rf(ctx, opts, listOpts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Get provides a mock function with given fields: ctx, name, opts -func (_m *PodVolumeBackupInterface) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.PodVolumeBackup, error) { - ret := _m.Called(ctx, name, opts) - - var r0 *v1.PodVolumeBackup - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) (*v1.PodVolumeBackup, error)); ok { - return rf(ctx, name, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) *v1.PodVolumeBackup); ok { - r0 = rf(ctx, name, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.PodVolumeBackup) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, metav1.GetOptions) error); ok { - r1 = rf(ctx, name, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// List provides a mock function with given fields: ctx, opts -func (_m *PodVolumeBackupInterface) List(ctx context.Context, opts metav1.ListOptions) (*v1.PodVolumeBackupList, error) { - ret := _m.Called(ctx, opts) - - var r0 *v1.PodVolumeBackupList - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (*v1.PodVolumeBackupList, error)); ok { - return rf(ctx, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) *v1.PodVolumeBackupList); ok { - r0 = rf(ctx, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.PodVolumeBackupList) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok { - r1 = rf(ctx, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Patch provides a mock function with given fields: ctx, name, pt, data, opts, subresources -func (_m *PodVolumeBackupInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*v1.PodVolumeBackup, error) { - _va := make([]interface{}, len(subresources)) - for _i := range subresources { - _va[_i] = subresources[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, name, pt, data, opts) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *v1.PodVolumeBackup - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) (*v1.PodVolumeBackup, error)); ok { - return rf(ctx, name, pt, data, opts, subresources...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) *v1.PodVolumeBackup); ok { - r0 = rf(ctx, name, pt, data, opts, subresources...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.PodVolumeBackup) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) error); ok { - r1 = rf(ctx, name, pt, data, opts, subresources...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Update provides a mock function with given fields: ctx, podVolumeBackup, opts -func (_m *PodVolumeBackupInterface) Update(ctx context.Context, podVolumeBackup *v1.PodVolumeBackup, opts metav1.UpdateOptions) (*v1.PodVolumeBackup, error) { - ret := _m.Called(ctx, podVolumeBackup, opts) - - var r0 *v1.PodVolumeBackup - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.PodVolumeBackup, metav1.UpdateOptions) (*v1.PodVolumeBackup, error)); ok { - return rf(ctx, podVolumeBackup, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.PodVolumeBackup, metav1.UpdateOptions) *v1.PodVolumeBackup); ok { - r0 = rf(ctx, podVolumeBackup, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.PodVolumeBackup) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.PodVolumeBackup, metav1.UpdateOptions) error); ok { - r1 = rf(ctx, podVolumeBackup, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateStatus provides a mock function with given fields: ctx, podVolumeBackup, opts -func (_m *PodVolumeBackupInterface) UpdateStatus(ctx context.Context, podVolumeBackup *v1.PodVolumeBackup, opts metav1.UpdateOptions) (*v1.PodVolumeBackup, error) { - ret := _m.Called(ctx, podVolumeBackup, opts) - - var r0 *v1.PodVolumeBackup - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.PodVolumeBackup, metav1.UpdateOptions) (*v1.PodVolumeBackup, error)); ok { - return rf(ctx, podVolumeBackup, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.PodVolumeBackup, metav1.UpdateOptions) *v1.PodVolumeBackup); ok { - r0 = rf(ctx, podVolumeBackup, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.PodVolumeBackup) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.PodVolumeBackup, metav1.UpdateOptions) error); ok { - r1 = rf(ctx, podVolumeBackup, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Watch provides a mock function with given fields: ctx, opts -func (_m *PodVolumeBackupInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - ret := _m.Called(ctx, opts) - - var r0 watch.Interface - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (watch.Interface, error)); ok { - return rf(ctx, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) watch.Interface); ok { - r0 = rf(ctx, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(watch.Interface) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok { - r1 = rf(ctx, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewPodVolumeBackupInterface creates a new instance of PodVolumeBackupInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewPodVolumeBackupInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *PodVolumeBackupInterface { - mock := &PodVolumeBackupInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/ScheduleInterface.go b/pkg/generated/clientset/versioned/typed/velero/v1/mocks/ScheduleInterface.go deleted file mode 100644 index 228047f9d..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/ScheduleInterface.go +++ /dev/null @@ -1,252 +0,0 @@ -// Code generated by mockery v2.30.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - types "k8s.io/apimachinery/pkg/types" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - - watch "k8s.io/apimachinery/pkg/watch" -) - -// ScheduleInterface is an autogenerated mock type for the ScheduleInterface type -type ScheduleInterface struct { - mock.Mock -} - -// Create provides a mock function with given fields: ctx, schedule, opts -func (_m *ScheduleInterface) Create(ctx context.Context, schedule *v1.Schedule, opts metav1.CreateOptions) (*v1.Schedule, error) { - ret := _m.Called(ctx, schedule, opts) - - var r0 *v1.Schedule - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.Schedule, metav1.CreateOptions) (*v1.Schedule, error)); ok { - return rf(ctx, schedule, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.Schedule, metav1.CreateOptions) *v1.Schedule); ok { - r0 = rf(ctx, schedule, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Schedule) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.Schedule, metav1.CreateOptions) error); ok { - r1 = rf(ctx, schedule, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Delete provides a mock function with given fields: ctx, name, opts -func (_m *ScheduleInterface) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - ret := _m.Called(ctx, name, opts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.DeleteOptions) error); ok { - r0 = rf(ctx, name, opts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// DeleteCollection provides a mock function with given fields: ctx, opts, listOpts -func (_m *ScheduleInterface) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - ret := _m.Called(ctx, opts, listOpts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.DeleteOptions, metav1.ListOptions) error); ok { - r0 = rf(ctx, opts, listOpts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Get provides a mock function with given fields: ctx, name, opts -func (_m *ScheduleInterface) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Schedule, error) { - ret := _m.Called(ctx, name, opts) - - var r0 *v1.Schedule - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) (*v1.Schedule, error)); ok { - return rf(ctx, name, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) *v1.Schedule); ok { - r0 = rf(ctx, name, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Schedule) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, metav1.GetOptions) error); ok { - r1 = rf(ctx, name, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// List provides a mock function with given fields: ctx, opts -func (_m *ScheduleInterface) List(ctx context.Context, opts metav1.ListOptions) (*v1.ScheduleList, error) { - ret := _m.Called(ctx, opts) - - var r0 *v1.ScheduleList - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (*v1.ScheduleList, error)); ok { - return rf(ctx, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) *v1.ScheduleList); ok { - r0 = rf(ctx, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ScheduleList) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok { - r1 = rf(ctx, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Patch provides a mock function with given fields: ctx, name, pt, data, opts, subresources -func (_m *ScheduleInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*v1.Schedule, error) { - _va := make([]interface{}, len(subresources)) - for _i := range subresources { - _va[_i] = subresources[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, name, pt, data, opts) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *v1.Schedule - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) (*v1.Schedule, error)); ok { - return rf(ctx, name, pt, data, opts, subresources...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) *v1.Schedule); ok { - r0 = rf(ctx, name, pt, data, opts, subresources...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Schedule) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) error); ok { - r1 = rf(ctx, name, pt, data, opts, subresources...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Update provides a mock function with given fields: ctx, schedule, opts -func (_m *ScheduleInterface) Update(ctx context.Context, schedule *v1.Schedule, opts metav1.UpdateOptions) (*v1.Schedule, error) { - ret := _m.Called(ctx, schedule, opts) - - var r0 *v1.Schedule - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.Schedule, metav1.UpdateOptions) (*v1.Schedule, error)); ok { - return rf(ctx, schedule, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.Schedule, metav1.UpdateOptions) *v1.Schedule); ok { - r0 = rf(ctx, schedule, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Schedule) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.Schedule, metav1.UpdateOptions) error); ok { - r1 = rf(ctx, schedule, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateStatus provides a mock function with given fields: ctx, schedule, opts -func (_m *ScheduleInterface) UpdateStatus(ctx context.Context, schedule *v1.Schedule, opts metav1.UpdateOptions) (*v1.Schedule, error) { - ret := _m.Called(ctx, schedule, opts) - - var r0 *v1.Schedule - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.Schedule, metav1.UpdateOptions) (*v1.Schedule, error)); ok { - return rf(ctx, schedule, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.Schedule, metav1.UpdateOptions) *v1.Schedule); ok { - r0 = rf(ctx, schedule, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Schedule) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.Schedule, metav1.UpdateOptions) error); ok { - r1 = rf(ctx, schedule, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Watch provides a mock function with given fields: ctx, opts -func (_m *ScheduleInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - ret := _m.Called(ctx, opts) - - var r0 watch.Interface - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (watch.Interface, error)); ok { - return rf(ctx, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) watch.Interface); ok { - r0 = rf(ctx, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(watch.Interface) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok { - r1 = rf(ctx, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewScheduleInterface creates a new instance of ScheduleInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewScheduleInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *ScheduleInterface { - mock := &ScheduleInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/SchedulesGetter.go b/pkg/generated/clientset/versioned/typed/velero/v1/mocks/SchedulesGetter.go deleted file mode 100644 index dfe9c5844..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/SchedulesGetter.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by mockery v2.30.1. DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - v1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1" -) - -// SchedulesGetter is an autogenerated mock type for the SchedulesGetter type -type SchedulesGetter struct { - mock.Mock -} - -// Schedules provides a mock function with given fields: namespace -func (_m *SchedulesGetter) Schedules(namespace string) v1.ScheduleInterface { - ret := _m.Called(namespace) - - var r0 v1.ScheduleInterface - if rf, ok := ret.Get(0).(func(string) v1.ScheduleInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.ScheduleInterface) - } - } - - return r0 -} - -// NewSchedulesGetter creates a new instance of SchedulesGetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewSchedulesGetter(t interface { - mock.TestingT - Cleanup(func()) -}) *SchedulesGetter { - mock := &SchedulesGetter{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/VeleroV1Interface.go b/pkg/generated/clientset/versioned/typed/velero/v1/mocks/VeleroV1Interface.go deleted file mode 100644 index cf521e619..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/VeleroV1Interface.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by mockery v2.30.1. DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - rest "k8s.io/client-go/rest" - - v1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1" -) - -// VeleroV1Interface is an autogenerated mock type for the VeleroV1Interface type -type VeleroV1Interface struct { - mock.Mock -} - -// BackupRepositories provides a mock function with given fields: namespace -func (_m *VeleroV1Interface) BackupRepositories(namespace string) v1.BackupRepositoryInterface { - ret := _m.Called(namespace) - - var r0 v1.BackupRepositoryInterface - if rf, ok := ret.Get(0).(func(string) v1.BackupRepositoryInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.BackupRepositoryInterface) - } - } - - return r0 -} - -// BackupStorageLocations provides a mock function with given fields: namespace -func (_m *VeleroV1Interface) BackupStorageLocations(namespace string) v1.BackupStorageLocationInterface { - ret := _m.Called(namespace) - - var r0 v1.BackupStorageLocationInterface - if rf, ok := ret.Get(0).(func(string) v1.BackupStorageLocationInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.BackupStorageLocationInterface) - } - } - - return r0 -} - -// Backups provides a mock function with given fields: namespace -func (_m *VeleroV1Interface) Backups(namespace string) v1.BackupInterface { - ret := _m.Called(namespace) - - var r0 v1.BackupInterface - if rf, ok := ret.Get(0).(func(string) v1.BackupInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.BackupInterface) - } - } - - return r0 -} - -// DeleteBackupRequests provides a mock function with given fields: namespace -func (_m *VeleroV1Interface) DeleteBackupRequests(namespace string) v1.DeleteBackupRequestInterface { - ret := _m.Called(namespace) - - var r0 v1.DeleteBackupRequestInterface - if rf, ok := ret.Get(0).(func(string) v1.DeleteBackupRequestInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.DeleteBackupRequestInterface) - } - } - - return r0 -} - -// DownloadRequests provides a mock function with given fields: namespace -func (_m *VeleroV1Interface) DownloadRequests(namespace string) v1.DownloadRequestInterface { - ret := _m.Called(namespace) - - var r0 v1.DownloadRequestInterface - if rf, ok := ret.Get(0).(func(string) v1.DownloadRequestInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.DownloadRequestInterface) - } - } - - return r0 -} - -// PodVolumeBackups provides a mock function with given fields: namespace -func (_m *VeleroV1Interface) PodVolumeBackups(namespace string) v1.PodVolumeBackupInterface { - ret := _m.Called(namespace) - - var r0 v1.PodVolumeBackupInterface - if rf, ok := ret.Get(0).(func(string) v1.PodVolumeBackupInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.PodVolumeBackupInterface) - } - } - - return r0 -} - -// PodVolumeRestores provides a mock function with given fields: namespace -func (_m *VeleroV1Interface) PodVolumeRestores(namespace string) v1.PodVolumeRestoreInterface { - ret := _m.Called(namespace) - - var r0 v1.PodVolumeRestoreInterface - if rf, ok := ret.Get(0).(func(string) v1.PodVolumeRestoreInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.PodVolumeRestoreInterface) - } - } - - return r0 -} - -// RESTClient provides a mock function with given fields: -func (_m *VeleroV1Interface) RESTClient() rest.Interface { - ret := _m.Called() - - var r0 rest.Interface - if rf, ok := ret.Get(0).(func() rest.Interface); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(rest.Interface) - } - } - - return r0 -} - -// Restores provides a mock function with given fields: namespace -func (_m *VeleroV1Interface) Restores(namespace string) v1.RestoreInterface { - ret := _m.Called(namespace) - - var r0 v1.RestoreInterface - if rf, ok := ret.Get(0).(func(string) v1.RestoreInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.RestoreInterface) - } - } - - return r0 -} - -// Schedules provides a mock function with given fields: namespace -func (_m *VeleroV1Interface) Schedules(namespace string) v1.ScheduleInterface { - ret := _m.Called(namespace) - - var r0 v1.ScheduleInterface - if rf, ok := ret.Get(0).(func(string) v1.ScheduleInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.ScheduleInterface) - } - } - - return r0 -} - -// ServerStatusRequests provides a mock function with given fields: namespace -func (_m *VeleroV1Interface) ServerStatusRequests(namespace string) v1.ServerStatusRequestInterface { - ret := _m.Called(namespace) - - var r0 v1.ServerStatusRequestInterface - if rf, ok := ret.Get(0).(func(string) v1.ServerStatusRequestInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.ServerStatusRequestInterface) - } - } - - return r0 -} - -// VolumeSnapshotLocations provides a mock function with given fields: namespace -func (_m *VeleroV1Interface) VolumeSnapshotLocations(namespace string) v1.VolumeSnapshotLocationInterface { - ret := _m.Called(namespace) - - var r0 v1.VolumeSnapshotLocationInterface - if rf, ok := ret.Get(0).(func(string) v1.VolumeSnapshotLocationInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.VolumeSnapshotLocationInterface) - } - } - - return r0 -} - -// NewVeleroV1Interface creates a new instance of VeleroV1Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewVeleroV1Interface(t interface { - mock.TestingT - Cleanup(func()) -}) *VeleroV1Interface { - mock := &VeleroV1Interface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/VolumeSnapshotLocationInterface.go b/pkg/generated/clientset/versioned/typed/velero/v1/mocks/VolumeSnapshotLocationInterface.go deleted file mode 100644 index 3845fda88..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/VolumeSnapshotLocationInterface.go +++ /dev/null @@ -1,252 +0,0 @@ -// Code generated by mockery v2.30.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - types "k8s.io/apimachinery/pkg/types" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - - watch "k8s.io/apimachinery/pkg/watch" -) - -// VolumeSnapshotLocationInterface is an autogenerated mock type for the VolumeSnapshotLocationInterface type -type VolumeSnapshotLocationInterface struct { - mock.Mock -} - -// Create provides a mock function with given fields: ctx, volumeSnapshotLocation, opts -func (_m *VolumeSnapshotLocationInterface) Create(ctx context.Context, volumeSnapshotLocation *v1.VolumeSnapshotLocation, opts metav1.CreateOptions) (*v1.VolumeSnapshotLocation, error) { - ret := _m.Called(ctx, volumeSnapshotLocation, opts) - - var r0 *v1.VolumeSnapshotLocation - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.CreateOptions) (*v1.VolumeSnapshotLocation, error)); ok { - return rf(ctx, volumeSnapshotLocation, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.CreateOptions) *v1.VolumeSnapshotLocation); ok { - r0 = rf(ctx, volumeSnapshotLocation, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.VolumeSnapshotLocation) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.CreateOptions) error); ok { - r1 = rf(ctx, volumeSnapshotLocation, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Delete provides a mock function with given fields: ctx, name, opts -func (_m *VolumeSnapshotLocationInterface) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - ret := _m.Called(ctx, name, opts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.DeleteOptions) error); ok { - r0 = rf(ctx, name, opts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// DeleteCollection provides a mock function with given fields: ctx, opts, listOpts -func (_m *VolumeSnapshotLocationInterface) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - ret := _m.Called(ctx, opts, listOpts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.DeleteOptions, metav1.ListOptions) error); ok { - r0 = rf(ctx, opts, listOpts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Get provides a mock function with given fields: ctx, name, opts -func (_m *VolumeSnapshotLocationInterface) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.VolumeSnapshotLocation, error) { - ret := _m.Called(ctx, name, opts) - - var r0 *v1.VolumeSnapshotLocation - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) (*v1.VolumeSnapshotLocation, error)); ok { - return rf(ctx, name, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, string, metav1.GetOptions) *v1.VolumeSnapshotLocation); ok { - r0 = rf(ctx, name, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.VolumeSnapshotLocation) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, metav1.GetOptions) error); ok { - r1 = rf(ctx, name, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// List provides a mock function with given fields: ctx, opts -func (_m *VolumeSnapshotLocationInterface) List(ctx context.Context, opts metav1.ListOptions) (*v1.VolumeSnapshotLocationList, error) { - ret := _m.Called(ctx, opts) - - var r0 *v1.VolumeSnapshotLocationList - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (*v1.VolumeSnapshotLocationList, error)); ok { - return rf(ctx, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) *v1.VolumeSnapshotLocationList); ok { - r0 = rf(ctx, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.VolumeSnapshotLocationList) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok { - r1 = rf(ctx, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Patch provides a mock function with given fields: ctx, name, pt, data, opts, subresources -func (_m *VolumeSnapshotLocationInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*v1.VolumeSnapshotLocation, error) { - _va := make([]interface{}, len(subresources)) - for _i := range subresources { - _va[_i] = subresources[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, name, pt, data, opts) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *v1.VolumeSnapshotLocation - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) (*v1.VolumeSnapshotLocation, error)); ok { - return rf(ctx, name, pt, data, opts, subresources...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) *v1.VolumeSnapshotLocation); ok { - r0 = rf(ctx, name, pt, data, opts, subresources...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.VolumeSnapshotLocation) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, types.PatchType, []byte, metav1.PatchOptions, ...string) error); ok { - r1 = rf(ctx, name, pt, data, opts, subresources...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Update provides a mock function with given fields: ctx, volumeSnapshotLocation, opts -func (_m *VolumeSnapshotLocationInterface) Update(ctx context.Context, volumeSnapshotLocation *v1.VolumeSnapshotLocation, opts metav1.UpdateOptions) (*v1.VolumeSnapshotLocation, error) { - ret := _m.Called(ctx, volumeSnapshotLocation, opts) - - var r0 *v1.VolumeSnapshotLocation - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.UpdateOptions) (*v1.VolumeSnapshotLocation, error)); ok { - return rf(ctx, volumeSnapshotLocation, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.UpdateOptions) *v1.VolumeSnapshotLocation); ok { - r0 = rf(ctx, volumeSnapshotLocation, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.VolumeSnapshotLocation) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.UpdateOptions) error); ok { - r1 = rf(ctx, volumeSnapshotLocation, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateStatus provides a mock function with given fields: ctx, volumeSnapshotLocation, opts -func (_m *VolumeSnapshotLocationInterface) UpdateStatus(ctx context.Context, volumeSnapshotLocation *v1.VolumeSnapshotLocation, opts metav1.UpdateOptions) (*v1.VolumeSnapshotLocation, error) { - ret := _m.Called(ctx, volumeSnapshotLocation, opts) - - var r0 *v1.VolumeSnapshotLocation - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.UpdateOptions) (*v1.VolumeSnapshotLocation, error)); ok { - return rf(ctx, volumeSnapshotLocation, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.UpdateOptions) *v1.VolumeSnapshotLocation); ok { - r0 = rf(ctx, volumeSnapshotLocation, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.VolumeSnapshotLocation) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.VolumeSnapshotLocation, metav1.UpdateOptions) error); ok { - r1 = rf(ctx, volumeSnapshotLocation, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Watch provides a mock function with given fields: ctx, opts -func (_m *VolumeSnapshotLocationInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - ret := _m.Called(ctx, opts) - - var r0 watch.Interface - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (watch.Interface, error)); ok { - return rf(ctx, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) watch.Interface); ok { - r0 = rf(ctx, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(watch.Interface) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, metav1.ListOptions) error); ok { - r1 = rf(ctx, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewVolumeSnapshotLocationInterface creates a new instance of VolumeSnapshotLocationInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewVolumeSnapshotLocationInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *VolumeSnapshotLocationInterface { - mock := &VolumeSnapshotLocationInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/VolumeSnapshotLocationsGetter.go b/pkg/generated/clientset/versioned/typed/velero/v1/mocks/VolumeSnapshotLocationsGetter.go deleted file mode 100644 index 2ec52368e..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/mocks/VolumeSnapshotLocationsGetter.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by mockery v2.30.1. DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - v1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1" -) - -// VolumeSnapshotLocationsGetter is an autogenerated mock type for the VolumeSnapshotLocationsGetter type -type VolumeSnapshotLocationsGetter struct { - mock.Mock -} - -// VolumeSnapshotLocations provides a mock function with given fields: namespace -func (_m *VolumeSnapshotLocationsGetter) VolumeSnapshotLocations(namespace string) v1.VolumeSnapshotLocationInterface { - ret := _m.Called(namespace) - - var r0 v1.VolumeSnapshotLocationInterface - if rf, ok := ret.Get(0).(func(string) v1.VolumeSnapshotLocationInterface); ok { - r0 = rf(namespace) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(v1.VolumeSnapshotLocationInterface) - } - } - - return r0 -} - -// NewVolumeSnapshotLocationsGetter creates a new instance of VolumeSnapshotLocationsGetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewVolumeSnapshotLocationsGetter(t interface { - mock.TestingT - Cleanup(func()) -}) *VolumeSnapshotLocationsGetter { - mock := &VolumeSnapshotLocationsGetter{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/podvolumebackup.go b/pkg/generated/clientset/versioned/typed/velero/v1/podvolumebackup.go deleted file mode 100644 index 836d78b58..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/podvolumebackup.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - scheme "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// PodVolumeBackupsGetter has a method to return a PodVolumeBackupInterface. -// A group's client should implement this interface. -type PodVolumeBackupsGetter interface { - PodVolumeBackups(namespace string) PodVolumeBackupInterface -} - -// PodVolumeBackupInterface has methods to work with PodVolumeBackup resources. -type PodVolumeBackupInterface interface { - Create(ctx context.Context, podVolumeBackup *v1.PodVolumeBackup, opts metav1.CreateOptions) (*v1.PodVolumeBackup, error) - Update(ctx context.Context, podVolumeBackup *v1.PodVolumeBackup, opts metav1.UpdateOptions) (*v1.PodVolumeBackup, error) - UpdateStatus(ctx context.Context, podVolumeBackup *v1.PodVolumeBackup, opts metav1.UpdateOptions) (*v1.PodVolumeBackup, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.PodVolumeBackup, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.PodVolumeBackupList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PodVolumeBackup, err error) - PodVolumeBackupExpansion -} - -// podVolumeBackups implements PodVolumeBackupInterface -type podVolumeBackups struct { - client rest.Interface - ns string -} - -// newPodVolumeBackups returns a PodVolumeBackups -func newPodVolumeBackups(c *VeleroV1Client, namespace string) *podVolumeBackups { - return &podVolumeBackups{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the podVolumeBackup, and returns the corresponding podVolumeBackup object, and an error if there is any. -func (c *podVolumeBackups) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PodVolumeBackup, err error) { - result = &v1.PodVolumeBackup{} - err = c.client.Get(). - Namespace(c.ns). - Resource("podvolumebackups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of PodVolumeBackups that match those selectors. -func (c *podVolumeBackups) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PodVolumeBackupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.PodVolumeBackupList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("podvolumebackups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested podVolumeBackups. -func (c *podVolumeBackups) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("podvolumebackups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a podVolumeBackup and creates it. Returns the server's representation of the podVolumeBackup, and an error, if there is any. -func (c *podVolumeBackups) Create(ctx context.Context, podVolumeBackup *v1.PodVolumeBackup, opts metav1.CreateOptions) (result *v1.PodVolumeBackup, err error) { - result = &v1.PodVolumeBackup{} - err = c.client.Post(). - Namespace(c.ns). - Resource("podvolumebackups"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(podVolumeBackup). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a podVolumeBackup and updates it. Returns the server's representation of the podVolumeBackup, and an error, if there is any. -func (c *podVolumeBackups) Update(ctx context.Context, podVolumeBackup *v1.PodVolumeBackup, opts metav1.UpdateOptions) (result *v1.PodVolumeBackup, err error) { - result = &v1.PodVolumeBackup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("podvolumebackups"). - Name(podVolumeBackup.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(podVolumeBackup). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *podVolumeBackups) UpdateStatus(ctx context.Context, podVolumeBackup *v1.PodVolumeBackup, opts metav1.UpdateOptions) (result *v1.PodVolumeBackup, err error) { - result = &v1.PodVolumeBackup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("podvolumebackups"). - Name(podVolumeBackup.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(podVolumeBackup). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the podVolumeBackup and deletes it. Returns an error if one occurs. -func (c *podVolumeBackups) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("podvolumebackups"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *podVolumeBackups) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("podvolumebackups"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched podVolumeBackup. -func (c *podVolumeBackups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PodVolumeBackup, err error) { - result = &v1.PodVolumeBackup{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("podvolumebackups"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/podvolumerestore.go b/pkg/generated/clientset/versioned/typed/velero/v1/podvolumerestore.go deleted file mode 100644 index dffd51b1b..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/podvolumerestore.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - scheme "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// PodVolumeRestoresGetter has a method to return a PodVolumeRestoreInterface. -// A group's client should implement this interface. -type PodVolumeRestoresGetter interface { - PodVolumeRestores(namespace string) PodVolumeRestoreInterface -} - -// PodVolumeRestoreInterface has methods to work with PodVolumeRestore resources. -type PodVolumeRestoreInterface interface { - Create(ctx context.Context, podVolumeRestore *v1.PodVolumeRestore, opts metav1.CreateOptions) (*v1.PodVolumeRestore, error) - Update(ctx context.Context, podVolumeRestore *v1.PodVolumeRestore, opts metav1.UpdateOptions) (*v1.PodVolumeRestore, error) - UpdateStatus(ctx context.Context, podVolumeRestore *v1.PodVolumeRestore, opts metav1.UpdateOptions) (*v1.PodVolumeRestore, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.PodVolumeRestore, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.PodVolumeRestoreList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PodVolumeRestore, err error) - PodVolumeRestoreExpansion -} - -// podVolumeRestores implements PodVolumeRestoreInterface -type podVolumeRestores struct { - client rest.Interface - ns string -} - -// newPodVolumeRestores returns a PodVolumeRestores -func newPodVolumeRestores(c *VeleroV1Client, namespace string) *podVolumeRestores { - return &podVolumeRestores{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the podVolumeRestore, and returns the corresponding podVolumeRestore object, and an error if there is any. -func (c *podVolumeRestores) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PodVolumeRestore, err error) { - result = &v1.PodVolumeRestore{} - err = c.client.Get(). - Namespace(c.ns). - Resource("podvolumerestores"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of PodVolumeRestores that match those selectors. -func (c *podVolumeRestores) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PodVolumeRestoreList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.PodVolumeRestoreList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("podvolumerestores"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested podVolumeRestores. -func (c *podVolumeRestores) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("podvolumerestores"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a podVolumeRestore and creates it. Returns the server's representation of the podVolumeRestore, and an error, if there is any. -func (c *podVolumeRestores) Create(ctx context.Context, podVolumeRestore *v1.PodVolumeRestore, opts metav1.CreateOptions) (result *v1.PodVolumeRestore, err error) { - result = &v1.PodVolumeRestore{} - err = c.client.Post(). - Namespace(c.ns). - Resource("podvolumerestores"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(podVolumeRestore). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a podVolumeRestore and updates it. Returns the server's representation of the podVolumeRestore, and an error, if there is any. -func (c *podVolumeRestores) Update(ctx context.Context, podVolumeRestore *v1.PodVolumeRestore, opts metav1.UpdateOptions) (result *v1.PodVolumeRestore, err error) { - result = &v1.PodVolumeRestore{} - err = c.client.Put(). - Namespace(c.ns). - Resource("podvolumerestores"). - Name(podVolumeRestore.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(podVolumeRestore). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *podVolumeRestores) UpdateStatus(ctx context.Context, podVolumeRestore *v1.PodVolumeRestore, opts metav1.UpdateOptions) (result *v1.PodVolumeRestore, err error) { - result = &v1.PodVolumeRestore{} - err = c.client.Put(). - Namespace(c.ns). - Resource("podvolumerestores"). - Name(podVolumeRestore.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(podVolumeRestore). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the podVolumeRestore and deletes it. Returns an error if one occurs. -func (c *podVolumeRestores) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("podvolumerestores"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *podVolumeRestores) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("podvolumerestores"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched podVolumeRestore. -func (c *podVolumeRestores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PodVolumeRestore, err error) { - result = &v1.PodVolumeRestore{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("podvolumerestores"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/restore.go b/pkg/generated/clientset/versioned/typed/velero/v1/restore.go deleted file mode 100644 index a43b823a6..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/restore.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - scheme "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// RestoresGetter has a method to return a RestoreInterface. -// A group's client should implement this interface. -type RestoresGetter interface { - Restores(namespace string) RestoreInterface -} - -// RestoreInterface has methods to work with Restore resources. -type RestoreInterface interface { - Create(ctx context.Context, restore *v1.Restore, opts metav1.CreateOptions) (*v1.Restore, error) - Update(ctx context.Context, restore *v1.Restore, opts metav1.UpdateOptions) (*v1.Restore, error) - UpdateStatus(ctx context.Context, restore *v1.Restore, opts metav1.UpdateOptions) (*v1.Restore, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Restore, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.RestoreList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Restore, err error) - RestoreExpansion -} - -// restores implements RestoreInterface -type restores struct { - client rest.Interface - ns string -} - -// newRestores returns a Restores -func newRestores(c *VeleroV1Client, namespace string) *restores { - return &restores{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the restore, and returns the corresponding restore object, and an error if there is any. -func (c *restores) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Restore, err error) { - result = &v1.Restore{} - err = c.client.Get(). - Namespace(c.ns). - Resource("restores"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Restores that match those selectors. -func (c *restores) List(ctx context.Context, opts metav1.ListOptions) (result *v1.RestoreList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.RestoreList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("restores"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested restores. -func (c *restores) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("restores"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a restore and creates it. Returns the server's representation of the restore, and an error, if there is any. -func (c *restores) Create(ctx context.Context, restore *v1.Restore, opts metav1.CreateOptions) (result *v1.Restore, err error) { - result = &v1.Restore{} - err = c.client.Post(). - Namespace(c.ns). - Resource("restores"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(restore). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a restore and updates it. Returns the server's representation of the restore, and an error, if there is any. -func (c *restores) Update(ctx context.Context, restore *v1.Restore, opts metav1.UpdateOptions) (result *v1.Restore, err error) { - result = &v1.Restore{} - err = c.client.Put(). - Namespace(c.ns). - Resource("restores"). - Name(restore.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(restore). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *restores) UpdateStatus(ctx context.Context, restore *v1.Restore, opts metav1.UpdateOptions) (result *v1.Restore, err error) { - result = &v1.Restore{} - err = c.client.Put(). - Namespace(c.ns). - Resource("restores"). - Name(restore.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(restore). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the restore and deletes it. Returns an error if one occurs. -func (c *restores) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("restores"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *restores) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("restores"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched restore. -func (c *restores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Restore, err error) { - result = &v1.Restore{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("restores"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/schedule.go b/pkg/generated/clientset/versioned/typed/velero/v1/schedule.go deleted file mode 100644 index 8a003b008..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/schedule.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - scheme "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// SchedulesGetter has a method to return a ScheduleInterface. -// A group's client should implement this interface. -type SchedulesGetter interface { - Schedules(namespace string) ScheduleInterface -} - -// ScheduleInterface has methods to work with Schedule resources. -type ScheduleInterface interface { - Create(ctx context.Context, schedule *v1.Schedule, opts metav1.CreateOptions) (*v1.Schedule, error) - Update(ctx context.Context, schedule *v1.Schedule, opts metav1.UpdateOptions) (*v1.Schedule, error) - UpdateStatus(ctx context.Context, schedule *v1.Schedule, opts metav1.UpdateOptions) (*v1.Schedule, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Schedule, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.ScheduleList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Schedule, err error) - ScheduleExpansion -} - -// schedules implements ScheduleInterface -type schedules struct { - client rest.Interface - ns string -} - -// newSchedules returns a Schedules -func newSchedules(c *VeleroV1Client, namespace string) *schedules { - return &schedules{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the schedule, and returns the corresponding schedule object, and an error if there is any. -func (c *schedules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Schedule, err error) { - result = &v1.Schedule{} - err = c.client.Get(). - Namespace(c.ns). - Resource("schedules"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Schedules that match those selectors. -func (c *schedules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ScheduleList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.ScheduleList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("schedules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested schedules. -func (c *schedules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("schedules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a schedule and creates it. Returns the server's representation of the schedule, and an error, if there is any. -func (c *schedules) Create(ctx context.Context, schedule *v1.Schedule, opts metav1.CreateOptions) (result *v1.Schedule, err error) { - result = &v1.Schedule{} - err = c.client.Post(). - Namespace(c.ns). - Resource("schedules"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(schedule). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a schedule and updates it. Returns the server's representation of the schedule, and an error, if there is any. -func (c *schedules) Update(ctx context.Context, schedule *v1.Schedule, opts metav1.UpdateOptions) (result *v1.Schedule, err error) { - result = &v1.Schedule{} - err = c.client.Put(). - Namespace(c.ns). - Resource("schedules"). - Name(schedule.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(schedule). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *schedules) UpdateStatus(ctx context.Context, schedule *v1.Schedule, opts metav1.UpdateOptions) (result *v1.Schedule, err error) { - result = &v1.Schedule{} - err = c.client.Put(). - Namespace(c.ns). - Resource("schedules"). - Name(schedule.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(schedule). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the schedule and deletes it. Returns an error if one occurs. -func (c *schedules) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("schedules"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *schedules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("schedules"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched schedule. -func (c *schedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Schedule, err error) { - result = &v1.Schedule{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("schedules"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/serverstatusrequest.go b/pkg/generated/clientset/versioned/typed/velero/v1/serverstatusrequest.go deleted file mode 100644 index c8a16d80f..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/serverstatusrequest.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - scheme "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// ServerStatusRequestsGetter has a method to return a ServerStatusRequestInterface. -// A group's client should implement this interface. -type ServerStatusRequestsGetter interface { - ServerStatusRequests(namespace string) ServerStatusRequestInterface -} - -// ServerStatusRequestInterface has methods to work with ServerStatusRequest resources. -type ServerStatusRequestInterface interface { - Create(ctx context.Context, serverStatusRequest *v1.ServerStatusRequest, opts metav1.CreateOptions) (*v1.ServerStatusRequest, error) - Update(ctx context.Context, serverStatusRequest *v1.ServerStatusRequest, opts metav1.UpdateOptions) (*v1.ServerStatusRequest, error) - UpdateStatus(ctx context.Context, serverStatusRequest *v1.ServerStatusRequest, opts metav1.UpdateOptions) (*v1.ServerStatusRequest, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ServerStatusRequest, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.ServerStatusRequestList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ServerStatusRequest, err error) - ServerStatusRequestExpansion -} - -// serverStatusRequests implements ServerStatusRequestInterface -type serverStatusRequests struct { - client rest.Interface - ns string -} - -// newServerStatusRequests returns a ServerStatusRequests -func newServerStatusRequests(c *VeleroV1Client, namespace string) *serverStatusRequests { - return &serverStatusRequests{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the serverStatusRequest, and returns the corresponding serverStatusRequest object, and an error if there is any. -func (c *serverStatusRequests) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ServerStatusRequest, err error) { - result = &v1.ServerStatusRequest{} - err = c.client.Get(). - Namespace(c.ns). - Resource("serverstatusrequests"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ServerStatusRequests that match those selectors. -func (c *serverStatusRequests) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ServerStatusRequestList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.ServerStatusRequestList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("serverstatusrequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested serverStatusRequests. -func (c *serverStatusRequests) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("serverstatusrequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a serverStatusRequest and creates it. Returns the server's representation of the serverStatusRequest, and an error, if there is any. -func (c *serverStatusRequests) Create(ctx context.Context, serverStatusRequest *v1.ServerStatusRequest, opts metav1.CreateOptions) (result *v1.ServerStatusRequest, err error) { - result = &v1.ServerStatusRequest{} - err = c.client.Post(). - Namespace(c.ns). - Resource("serverstatusrequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(serverStatusRequest). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a serverStatusRequest and updates it. Returns the server's representation of the serverStatusRequest, and an error, if there is any. -func (c *serverStatusRequests) Update(ctx context.Context, serverStatusRequest *v1.ServerStatusRequest, opts metav1.UpdateOptions) (result *v1.ServerStatusRequest, err error) { - result = &v1.ServerStatusRequest{} - err = c.client.Put(). - Namespace(c.ns). - Resource("serverstatusrequests"). - Name(serverStatusRequest.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(serverStatusRequest). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *serverStatusRequests) UpdateStatus(ctx context.Context, serverStatusRequest *v1.ServerStatusRequest, opts metav1.UpdateOptions) (result *v1.ServerStatusRequest, err error) { - result = &v1.ServerStatusRequest{} - err = c.client.Put(). - Namespace(c.ns). - Resource("serverstatusrequests"). - Name(serverStatusRequest.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(serverStatusRequest). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the serverStatusRequest and deletes it. Returns an error if one occurs. -func (c *serverStatusRequests) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("serverstatusrequests"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *serverStatusRequests) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("serverstatusrequests"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched serverStatusRequest. -func (c *serverStatusRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ServerStatusRequest, err error) { - result = &v1.ServerStatusRequest{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("serverstatusrequests"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/velero_client.go b/pkg/generated/clientset/versioned/typed/velero/v1/velero_client.go deleted file mode 100644 index 39f85628c..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/velero_client.go +++ /dev/null @@ -1,139 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type VeleroV1Interface interface { - RESTClient() rest.Interface - BackupsGetter - BackupRepositoriesGetter - BackupStorageLocationsGetter - DeleteBackupRequestsGetter - DownloadRequestsGetter - PodVolumeBackupsGetter - PodVolumeRestoresGetter - RestoresGetter - SchedulesGetter - ServerStatusRequestsGetter - VolumeSnapshotLocationsGetter -} - -// VeleroV1Client is used to interact with features provided by the velero.io group. -type VeleroV1Client struct { - restClient rest.Interface -} - -func (c *VeleroV1Client) Backups(namespace string) BackupInterface { - return newBackups(c, namespace) -} - -func (c *VeleroV1Client) BackupRepositories(namespace string) BackupRepositoryInterface { - return newBackupRepositories(c, namespace) -} - -func (c *VeleroV1Client) BackupStorageLocations(namespace string) BackupStorageLocationInterface { - return newBackupStorageLocations(c, namespace) -} - -func (c *VeleroV1Client) DeleteBackupRequests(namespace string) DeleteBackupRequestInterface { - return newDeleteBackupRequests(c, namespace) -} - -func (c *VeleroV1Client) DownloadRequests(namespace string) DownloadRequestInterface { - return newDownloadRequests(c, namespace) -} - -func (c *VeleroV1Client) PodVolumeBackups(namespace string) PodVolumeBackupInterface { - return newPodVolumeBackups(c, namespace) -} - -func (c *VeleroV1Client) PodVolumeRestores(namespace string) PodVolumeRestoreInterface { - return newPodVolumeRestores(c, namespace) -} - -func (c *VeleroV1Client) Restores(namespace string) RestoreInterface { - return newRestores(c, namespace) -} - -func (c *VeleroV1Client) Schedules(namespace string) ScheduleInterface { - return newSchedules(c, namespace) -} - -func (c *VeleroV1Client) ServerStatusRequests(namespace string) ServerStatusRequestInterface { - return newServerStatusRequests(c, namespace) -} - -func (c *VeleroV1Client) VolumeSnapshotLocations(namespace string) VolumeSnapshotLocationInterface { - return newVolumeSnapshotLocations(c, namespace) -} - -// NewForConfig creates a new VeleroV1Client for the given config. -func NewForConfig(c *rest.Config) (*VeleroV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &VeleroV1Client{client}, nil -} - -// NewForConfigOrDie creates a new VeleroV1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *VeleroV1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new VeleroV1Client for the given RESTClient. -func New(c rest.Interface) *VeleroV1Client { - return &VeleroV1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *VeleroV1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v1/volumesnapshotlocation.go b/pkg/generated/clientset/versioned/typed/velero/v1/volumesnapshotlocation.go deleted file mode 100644 index a4c11e93a..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v1/volumesnapshotlocation.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - scheme "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// VolumeSnapshotLocationsGetter has a method to return a VolumeSnapshotLocationInterface. -// A group's client should implement this interface. -type VolumeSnapshotLocationsGetter interface { - VolumeSnapshotLocations(namespace string) VolumeSnapshotLocationInterface -} - -// VolumeSnapshotLocationInterface has methods to work with VolumeSnapshotLocation resources. -type VolumeSnapshotLocationInterface interface { - Create(ctx context.Context, volumeSnapshotLocation *v1.VolumeSnapshotLocation, opts metav1.CreateOptions) (*v1.VolumeSnapshotLocation, error) - Update(ctx context.Context, volumeSnapshotLocation *v1.VolumeSnapshotLocation, opts metav1.UpdateOptions) (*v1.VolumeSnapshotLocation, error) - UpdateStatus(ctx context.Context, volumeSnapshotLocation *v1.VolumeSnapshotLocation, opts metav1.UpdateOptions) (*v1.VolumeSnapshotLocation, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.VolumeSnapshotLocation, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.VolumeSnapshotLocationList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VolumeSnapshotLocation, err error) - VolumeSnapshotLocationExpansion -} - -// volumeSnapshotLocations implements VolumeSnapshotLocationInterface -type volumeSnapshotLocations struct { - client rest.Interface - ns string -} - -// newVolumeSnapshotLocations returns a VolumeSnapshotLocations -func newVolumeSnapshotLocations(c *VeleroV1Client, namespace string) *volumeSnapshotLocations { - return &volumeSnapshotLocations{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the volumeSnapshotLocation, and returns the corresponding volumeSnapshotLocation object, and an error if there is any. -func (c *volumeSnapshotLocations) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.VolumeSnapshotLocation, err error) { - result = &v1.VolumeSnapshotLocation{} - err = c.client.Get(). - Namespace(c.ns). - Resource("volumesnapshotlocations"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VolumeSnapshotLocations that match those selectors. -func (c *volumeSnapshotLocations) List(ctx context.Context, opts metav1.ListOptions) (result *v1.VolumeSnapshotLocationList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.VolumeSnapshotLocationList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("volumesnapshotlocations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested volumeSnapshotLocations. -func (c *volumeSnapshotLocations) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("volumesnapshotlocations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a volumeSnapshotLocation and creates it. Returns the server's representation of the volumeSnapshotLocation, and an error, if there is any. -func (c *volumeSnapshotLocations) Create(ctx context.Context, volumeSnapshotLocation *v1.VolumeSnapshotLocation, opts metav1.CreateOptions) (result *v1.VolumeSnapshotLocation, err error) { - result = &v1.VolumeSnapshotLocation{} - err = c.client.Post(). - Namespace(c.ns). - Resource("volumesnapshotlocations"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshotLocation). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a volumeSnapshotLocation and updates it. Returns the server's representation of the volumeSnapshotLocation, and an error, if there is any. -func (c *volumeSnapshotLocations) Update(ctx context.Context, volumeSnapshotLocation *v1.VolumeSnapshotLocation, opts metav1.UpdateOptions) (result *v1.VolumeSnapshotLocation, err error) { - result = &v1.VolumeSnapshotLocation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("volumesnapshotlocations"). - Name(volumeSnapshotLocation.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshotLocation). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *volumeSnapshotLocations) UpdateStatus(ctx context.Context, volumeSnapshotLocation *v1.VolumeSnapshotLocation, opts metav1.UpdateOptions) (result *v1.VolumeSnapshotLocation, err error) { - result = &v1.VolumeSnapshotLocation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("volumesnapshotlocations"). - Name(volumeSnapshotLocation.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(volumeSnapshotLocation). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the volumeSnapshotLocation and deletes it. Returns an error if one occurs. -func (c *volumeSnapshotLocations) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("volumesnapshotlocations"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *volumeSnapshotLocations) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("volumesnapshotlocations"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched volumeSnapshotLocation. -func (c *volumeSnapshotLocations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VolumeSnapshotLocation, err error) { - result = &v1.VolumeSnapshotLocation{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("volumesnapshotlocations"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/datadownload.go b/pkg/generated/clientset/versioned/typed/velero/v2alpha1/datadownload.go deleted file mode 100644 index 511677675..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/datadownload.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" - scheme "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// DataDownloadsGetter has a method to return a DataDownloadInterface. -// A group's client should implement this interface. -type DataDownloadsGetter interface { - DataDownloads(namespace string) DataDownloadInterface -} - -// DataDownloadInterface has methods to work with DataDownload resources. -type DataDownloadInterface interface { - Create(ctx context.Context, dataDownload *v2alpha1.DataDownload, opts v1.CreateOptions) (*v2alpha1.DataDownload, error) - Update(ctx context.Context, dataDownload *v2alpha1.DataDownload, opts v1.UpdateOptions) (*v2alpha1.DataDownload, error) - UpdateStatus(ctx context.Context, dataDownload *v2alpha1.DataDownload, opts v1.UpdateOptions) (*v2alpha1.DataDownload, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.DataDownload, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.DataDownloadList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DataDownload, err error) - DataDownloadExpansion -} - -// dataDownloads implements DataDownloadInterface -type dataDownloads struct { - client rest.Interface - ns string -} - -// newDataDownloads returns a DataDownloads -func newDataDownloads(c *VeleroV2alpha1Client, namespace string) *dataDownloads { - return &dataDownloads{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the dataDownload, and returns the corresponding dataDownload object, and an error if there is any. -func (c *dataDownloads) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.DataDownload, err error) { - result = &v2alpha1.DataDownload{} - err = c.client.Get(). - Namespace(c.ns). - Resource("datadownloads"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DataDownloads that match those selectors. -func (c *dataDownloads) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.DataDownloadList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.DataDownloadList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("datadownloads"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested dataDownloads. -func (c *dataDownloads) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("datadownloads"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a dataDownload and creates it. Returns the server's representation of the dataDownload, and an error, if there is any. -func (c *dataDownloads) Create(ctx context.Context, dataDownload *v2alpha1.DataDownload, opts v1.CreateOptions) (result *v2alpha1.DataDownload, err error) { - result = &v2alpha1.DataDownload{} - err = c.client.Post(). - Namespace(c.ns). - Resource("datadownloads"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataDownload). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a dataDownload and updates it. Returns the server's representation of the dataDownload, and an error, if there is any. -func (c *dataDownloads) Update(ctx context.Context, dataDownload *v2alpha1.DataDownload, opts v1.UpdateOptions) (result *v2alpha1.DataDownload, err error) { - result = &v2alpha1.DataDownload{} - err = c.client.Put(). - Namespace(c.ns). - Resource("datadownloads"). - Name(dataDownload.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataDownload). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *dataDownloads) UpdateStatus(ctx context.Context, dataDownload *v2alpha1.DataDownload, opts v1.UpdateOptions) (result *v2alpha1.DataDownload, err error) { - result = &v2alpha1.DataDownload{} - err = c.client.Put(). - Namespace(c.ns). - Resource("datadownloads"). - Name(dataDownload.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataDownload). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the dataDownload and deletes it. Returns an error if one occurs. -func (c *dataDownloads) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("datadownloads"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *dataDownloads) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("datadownloads"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched dataDownload. -func (c *dataDownloads) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DataDownload, err error) { - result = &v2alpha1.DataDownload{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("datadownloads"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/dataupload.go b/pkg/generated/clientset/versioned/typed/velero/v2alpha1/dataupload.go deleted file mode 100644 index 4da27d527..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/dataupload.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" - scheme "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// DataUploadsGetter has a method to return a DataUploadInterface. -// A group's client should implement this interface. -type DataUploadsGetter interface { - DataUploads(namespace string) DataUploadInterface -} - -// DataUploadInterface has methods to work with DataUpload resources. -type DataUploadInterface interface { - Create(ctx context.Context, dataUpload *v2alpha1.DataUpload, opts v1.CreateOptions) (*v2alpha1.DataUpload, error) - Update(ctx context.Context, dataUpload *v2alpha1.DataUpload, opts v1.UpdateOptions) (*v2alpha1.DataUpload, error) - UpdateStatus(ctx context.Context, dataUpload *v2alpha1.DataUpload, opts v1.UpdateOptions) (*v2alpha1.DataUpload, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.DataUpload, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.DataUploadList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DataUpload, err error) - DataUploadExpansion -} - -// dataUploads implements DataUploadInterface -type dataUploads struct { - client rest.Interface - ns string -} - -// newDataUploads returns a DataUploads -func newDataUploads(c *VeleroV2alpha1Client, namespace string) *dataUploads { - return &dataUploads{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the dataUpload, and returns the corresponding dataUpload object, and an error if there is any. -func (c *dataUploads) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.DataUpload, err error) { - result = &v2alpha1.DataUpload{} - err = c.client.Get(). - Namespace(c.ns). - Resource("datauploads"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DataUploads that match those selectors. -func (c *dataUploads) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.DataUploadList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.DataUploadList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("datauploads"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested dataUploads. -func (c *dataUploads) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("datauploads"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a dataUpload and creates it. Returns the server's representation of the dataUpload, and an error, if there is any. -func (c *dataUploads) Create(ctx context.Context, dataUpload *v2alpha1.DataUpload, opts v1.CreateOptions) (result *v2alpha1.DataUpload, err error) { - result = &v2alpha1.DataUpload{} - err = c.client.Post(). - Namespace(c.ns). - Resource("datauploads"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataUpload). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a dataUpload and updates it. Returns the server's representation of the dataUpload, and an error, if there is any. -func (c *dataUploads) Update(ctx context.Context, dataUpload *v2alpha1.DataUpload, opts v1.UpdateOptions) (result *v2alpha1.DataUpload, err error) { - result = &v2alpha1.DataUpload{} - err = c.client.Put(). - Namespace(c.ns). - Resource("datauploads"). - Name(dataUpload.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataUpload). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *dataUploads) UpdateStatus(ctx context.Context, dataUpload *v2alpha1.DataUpload, opts v1.UpdateOptions) (result *v2alpha1.DataUpload, err error) { - result = &v2alpha1.DataUpload{} - err = c.client.Put(). - Namespace(c.ns). - Resource("datauploads"). - Name(dataUpload.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataUpload). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the dataUpload and deletes it. Returns an error if one occurs. -func (c *dataUploads) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("datauploads"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *dataUploads) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("datauploads"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched dataUpload. -func (c *dataUploads) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DataUpload, err error) { - result = &v2alpha1.DataUpload{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("datauploads"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/doc.go b/pkg/generated/clientset/versioned/typed/velero/v2alpha1/doc.go deleted file mode 100644 index 18b5cb4d4..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v2alpha1 diff --git a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/doc.go b/pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/doc.go deleted file mode 100644 index de930591e..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/fake_datadownload.go b/pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/fake_datadownload.go deleted file mode 100644 index 40db6018b..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/fake_datadownload.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeDataDownloads implements DataDownloadInterface -type FakeDataDownloads struct { - Fake *FakeVeleroV2alpha1 - ns string -} - -var datadownloadsResource = schema.GroupVersionResource{Group: "velero.io", Version: "v2alpha1", Resource: "datadownloads"} - -var datadownloadsKind = schema.GroupVersionKind{Group: "velero.io", Version: "v2alpha1", Kind: "DataDownload"} - -// Get takes name of the dataDownload, and returns the corresponding dataDownload object, and an error if there is any. -func (c *FakeDataDownloads) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.DataDownload, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(datadownloadsResource, c.ns, name), &v2alpha1.DataDownload{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DataDownload), err -} - -// List takes label and field selectors, and returns the list of DataDownloads that match those selectors. -func (c *FakeDataDownloads) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.DataDownloadList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(datadownloadsResource, datadownloadsKind, c.ns, opts), &v2alpha1.DataDownloadList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.DataDownloadList{ListMeta: obj.(*v2alpha1.DataDownloadList).ListMeta} - for _, item := range obj.(*v2alpha1.DataDownloadList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested dataDownloads. -func (c *FakeDataDownloads) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(datadownloadsResource, c.ns, opts)) - -} - -// Create takes the representation of a dataDownload and creates it. Returns the server's representation of the dataDownload, and an error, if there is any. -func (c *FakeDataDownloads) Create(ctx context.Context, dataDownload *v2alpha1.DataDownload, opts v1.CreateOptions) (result *v2alpha1.DataDownload, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(datadownloadsResource, c.ns, dataDownload), &v2alpha1.DataDownload{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DataDownload), err -} - -// Update takes the representation of a dataDownload and updates it. Returns the server's representation of the dataDownload, and an error, if there is any. -func (c *FakeDataDownloads) Update(ctx context.Context, dataDownload *v2alpha1.DataDownload, opts v1.UpdateOptions) (result *v2alpha1.DataDownload, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(datadownloadsResource, c.ns, dataDownload), &v2alpha1.DataDownload{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DataDownload), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDataDownloads) UpdateStatus(ctx context.Context, dataDownload *v2alpha1.DataDownload, opts v1.UpdateOptions) (*v2alpha1.DataDownload, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(datadownloadsResource, "status", c.ns, dataDownload), &v2alpha1.DataDownload{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DataDownload), err -} - -// Delete takes name of the dataDownload and deletes it. Returns an error if one occurs. -func (c *FakeDataDownloads) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(datadownloadsResource, c.ns, name), &v2alpha1.DataDownload{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeDataDownloads) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(datadownloadsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.DataDownloadList{}) - return err -} - -// Patch applies the patch and returns the patched dataDownload. -func (c *FakeDataDownloads) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DataDownload, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(datadownloadsResource, c.ns, name, pt, data, subresources...), &v2alpha1.DataDownload{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DataDownload), err -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/fake_dataupload.go b/pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/fake_dataupload.go deleted file mode 100644 index d40b50874..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/fake_dataupload.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeDataUploads implements DataUploadInterface -type FakeDataUploads struct { - Fake *FakeVeleroV2alpha1 - ns string -} - -var datauploadsResource = schema.GroupVersionResource{Group: "velero.io", Version: "v2alpha1", Resource: "datauploads"} - -var datauploadsKind = schema.GroupVersionKind{Group: "velero.io", Version: "v2alpha1", Kind: "DataUpload"} - -// Get takes name of the dataUpload, and returns the corresponding dataUpload object, and an error if there is any. -func (c *FakeDataUploads) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.DataUpload, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(datauploadsResource, c.ns, name), &v2alpha1.DataUpload{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DataUpload), err -} - -// List takes label and field selectors, and returns the list of DataUploads that match those selectors. -func (c *FakeDataUploads) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.DataUploadList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(datauploadsResource, datauploadsKind, c.ns, opts), &v2alpha1.DataUploadList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.DataUploadList{ListMeta: obj.(*v2alpha1.DataUploadList).ListMeta} - for _, item := range obj.(*v2alpha1.DataUploadList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested dataUploads. -func (c *FakeDataUploads) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(datauploadsResource, c.ns, opts)) - -} - -// Create takes the representation of a dataUpload and creates it. Returns the server's representation of the dataUpload, and an error, if there is any. -func (c *FakeDataUploads) Create(ctx context.Context, dataUpload *v2alpha1.DataUpload, opts v1.CreateOptions) (result *v2alpha1.DataUpload, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(datauploadsResource, c.ns, dataUpload), &v2alpha1.DataUpload{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DataUpload), err -} - -// Update takes the representation of a dataUpload and updates it. Returns the server's representation of the dataUpload, and an error, if there is any. -func (c *FakeDataUploads) Update(ctx context.Context, dataUpload *v2alpha1.DataUpload, opts v1.UpdateOptions) (result *v2alpha1.DataUpload, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(datauploadsResource, c.ns, dataUpload), &v2alpha1.DataUpload{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DataUpload), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDataUploads) UpdateStatus(ctx context.Context, dataUpload *v2alpha1.DataUpload, opts v1.UpdateOptions) (*v2alpha1.DataUpload, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(datauploadsResource, "status", c.ns, dataUpload), &v2alpha1.DataUpload{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DataUpload), err -} - -// Delete takes name of the dataUpload and deletes it. Returns an error if one occurs. -func (c *FakeDataUploads) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(datauploadsResource, c.ns, name), &v2alpha1.DataUpload{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeDataUploads) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(datauploadsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.DataUploadList{}) - return err -} - -// Patch applies the patch and returns the patched dataUpload. -func (c *FakeDataUploads) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DataUpload, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(datauploadsResource, c.ns, name, pt, data, subresources...), &v2alpha1.DataUpload{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DataUpload), err -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/fake_velero_client.go b/pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/fake_velero_client.go deleted file mode 100644 index 25fee2e7a..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/fake/fake_velero_client.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v2alpha1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v2alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeVeleroV2alpha1 struct { - *testing.Fake -} - -func (c *FakeVeleroV2alpha1) DataDownloads(namespace string) v2alpha1.DataDownloadInterface { - return &FakeDataDownloads{c, namespace} -} - -func (c *FakeVeleroV2alpha1) DataUploads(namespace string) v2alpha1.DataUploadInterface { - return &FakeDataUploads{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeVeleroV2alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/velero/v2alpha1/generated_expansion.go deleted file mode 100644 index 1ea0b5ae2..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/generated_expansion.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -type DataDownloadExpansion interface{} - -type DataUploadExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/velero_client.go b/pkg/generated/clientset/versioned/typed/velero/v2alpha1/velero_client.go deleted file mode 100644 index 6b2ea0980..000000000 --- a/pkg/generated/clientset/versioned/typed/velero/v2alpha1/velero_client.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - v2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" - "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type VeleroV2alpha1Interface interface { - RESTClient() rest.Interface - DataDownloadsGetter - DataUploadsGetter -} - -// VeleroV2alpha1Client is used to interact with features provided by the velero.io group. -type VeleroV2alpha1Client struct { - restClient rest.Interface -} - -func (c *VeleroV2alpha1Client) DataDownloads(namespace string) DataDownloadInterface { - return newDataDownloads(c, namespace) -} - -func (c *VeleroV2alpha1Client) DataUploads(namespace string) DataUploadInterface { - return newDataUploads(c, namespace) -} - -// NewForConfig creates a new VeleroV2alpha1Client for the given config. -func NewForConfig(c *rest.Config) (*VeleroV2alpha1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &VeleroV2alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new VeleroV2alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *VeleroV2alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new VeleroV2alpha1Client for the given RESTClient. -func New(c rest.Interface) *VeleroV2alpha1Client { - return &VeleroV2alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v2alpha1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *VeleroV2alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go deleted file mode 100644 index d90132add..000000000 --- a/pkg/generated/informers/externalversions/factory.go +++ /dev/null @@ -1,180 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package externalversions - -import ( - reflect "reflect" - sync "sync" - time "time" - - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - velero "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/velero" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" -) - -// SharedInformerOption defines the functional option type for SharedInformerFactory. -type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory - -type sharedInformerFactory struct { - client versioned.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - - informers map[reflect.Type]cache.SharedIndexInformer - // startedInformers is used for tracking which informers have been started. - // This allows Start() to be called multiple times safely. - startedInformers map[reflect.Type]bool -} - -// WithCustomResyncConfig sets a custom resync period for the specified informer types. -func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - for k, v := range resyncConfig { - factory.customResync[reflect.TypeOf(k)] = v - } - return factory - } -} - -// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. -func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.tweakListOptions = tweakListOptions - return factory - } -} - -// WithNamespace limits the SharedInformerFactory to the specified namespace. -func WithNamespace(namespace string) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.namespace = namespace - return factory - } -} - -// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. -func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { - return NewSharedInformerFactoryWithOptions(client, defaultResync) -} - -// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. -// Listers obtained via this SharedInformerFactory will be subject to the same filters -// as specified here. -// Deprecated: Please use NewSharedInformerFactoryWithOptions instead -func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { - return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) -} - -// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. -func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { - factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - } - - // Apply all options - for _, opt := range options { - factory = opt(factory) - } - - return factory -} - -// Start initializes all requested informers. -func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { - f.lock.Lock() - defer f.lock.Unlock() - - for informerType, informer := range f.informers { - if !f.startedInformers[informerType] { - go informer.Run(stopCh) - f.startedInformers[informerType] = true - } - } -} - -// WaitForCacheSync waits for all started informers' cache were synced. -func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { - informers := func() map[reflect.Type]cache.SharedIndexInformer { - f.lock.Lock() - defer f.lock.Unlock() - - informers := map[reflect.Type]cache.SharedIndexInformer{} - for informerType, informer := range f.informers { - if f.startedInformers[informerType] { - informers[informerType] = informer - } - } - return informers - }() - - res := map[reflect.Type]bool{} - for informType, informer := range informers { - res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) - } - return res -} - -// InternalInformerFor returns the SharedIndexInformer for obj using an internal -// client. -func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { - f.lock.Lock() - defer f.lock.Unlock() - - informerType := reflect.TypeOf(obj) - informer, exists := f.informers[informerType] - if exists { - return informer - } - - resyncPeriod, exists := f.customResync[informerType] - if !exists { - resyncPeriod = f.defaultResync - } - - informer = newFunc(f.client, resyncPeriod) - f.informers[informerType] = informer - - return informer -} - -// SharedInformerFactory provides shared informers for resources in all known -// API group versions. -type SharedInformerFactory interface { - internalinterfaces.SharedInformerFactory - ForResource(resource schema.GroupVersionResource) (GenericInformer, error) - WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - - Velero() velero.Interface -} - -func (f *sharedInformerFactory) Velero() velero.Interface { - return velero.New(f, f.namespace, f.tweakListOptions) -} diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go deleted file mode 100644 index 7e0533afc..000000000 --- a/pkg/generated/informers/externalversions/generic.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package externalversions - -import ( - "fmt" - - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - v2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" -) - -// GenericInformer is type of SharedIndexInformer which will locate and delegate to other -// sharedInformers based on type -type GenericInformer interface { - Informer() cache.SharedIndexInformer - Lister() cache.GenericLister -} - -type genericInformer struct { - informer cache.SharedIndexInformer - resource schema.GroupResource -} - -// Informer returns the SharedIndexInformer. -func (f *genericInformer) Informer() cache.SharedIndexInformer { - return f.informer -} - -// Lister returns the GenericLister. -func (f *genericInformer) Lister() cache.GenericLister { - return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) -} - -// ForResource gives generic access to a shared informer of the matching type -// TODO extend this to unknown resources with a client pool -func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { - switch resource { - // Group=velero.io, Version=v1 - case v1.SchemeGroupVersion.WithResource("backups"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Velero().V1().Backups().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("backuprepositories"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Velero().V1().BackupRepositories().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("backupstoragelocations"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Velero().V1().BackupStorageLocations().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("deletebackuprequests"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Velero().V1().DeleteBackupRequests().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("downloadrequests"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Velero().V1().DownloadRequests().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("podvolumebackups"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Velero().V1().PodVolumeBackups().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("podvolumerestores"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Velero().V1().PodVolumeRestores().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("restores"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Velero().V1().Restores().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("schedules"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Velero().V1().Schedules().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("serverstatusrequests"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Velero().V1().ServerStatusRequests().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("volumesnapshotlocations"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Velero().V1().VolumeSnapshotLocations().Informer()}, nil - - // Group=velero.io, Version=v2alpha1 - case v2alpha1.SchemeGroupVersion.WithResource("datadownloads"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Velero().V2alpha1().DataDownloads().Informer()}, nil - case v2alpha1.SchemeGroupVersion.WithResource("datauploads"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Velero().V2alpha1().DataUploads().Informer()}, nil - - } - - return nil, fmt.Errorf("no informer found for %v", resource) -} diff --git a/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go deleted file mode 100644 index 4e78062c9..000000000 --- a/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package internalinterfaces - -import ( - time "time" - - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - cache "k8s.io/client-go/tools/cache" -) - -// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. -type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer - -// SharedInformerFactory a small interface to allow for adding an informer without an import cycle -type SharedInformerFactory interface { - Start(stopCh <-chan struct{}) - InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer -} - -// TweakListOptionsFunc is a function that transforms a v1.ListOptions. -type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/pkg/generated/informers/externalversions/velero/interface.go b/pkg/generated/informers/externalversions/velero/interface.go deleted file mode 100644 index 87fc652e6..000000000 --- a/pkg/generated/informers/externalversions/velero/interface.go +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package velero - -import ( - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/velero/v1" - v2alpha1 "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/velero/v2alpha1" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1 provides access to shared informers for resources in V1. - V1() v1.Interface - // V2alpha1 provides access to shared informers for resources in V2alpha1. - V2alpha1() v2alpha1.Interface -} - -type group struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1 returns a new v1.Interface. -func (g *group) V1() v1.Interface { - return v1.New(g.factory, g.namespace, g.tweakListOptions) -} - -// V2alpha1 returns a new v2alpha1.Interface. -func (g *group) V2alpha1() v2alpha1.Interface { - return v2alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/pkg/generated/informers/externalversions/velero/v1/backup.go b/pkg/generated/informers/externalversions/velero/v1/backup.go deleted file mode 100644 index f874a2090..000000000 --- a/pkg/generated/informers/externalversions/velero/v1/backup.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/vmware-tanzu/velero/pkg/generated/listers/velero/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// BackupInformer provides access to a shared informer and lister for -// Backups. -type BackupInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.BackupLister -} - -type backupInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewBackupInformer constructs a new informer for Backup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewBackupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredBackupInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredBackupInformer constructs a new informer for Backup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredBackupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().Backups(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().Backups(namespace).Watch(context.TODO(), options) - }, - }, - &velerov1.Backup{}, - resyncPeriod, - indexers, - ) -} - -func (f *backupInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredBackupInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *backupInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&velerov1.Backup{}, f.defaultInformer) -} - -func (f *backupInformer) Lister() v1.BackupLister { - return v1.NewBackupLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/informers/externalversions/velero/v1/backuprepository.go b/pkg/generated/informers/externalversions/velero/v1/backuprepository.go deleted file mode 100644 index 59865c894..000000000 --- a/pkg/generated/informers/externalversions/velero/v1/backuprepository.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/vmware-tanzu/velero/pkg/generated/listers/velero/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// BackupRepositoryInformer provides access to a shared informer and lister for -// BackupRepositories. -type BackupRepositoryInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.BackupRepositoryLister -} - -type backupRepositoryInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewBackupRepositoryInformer constructs a new informer for BackupRepository type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewBackupRepositoryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredBackupRepositoryInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredBackupRepositoryInformer constructs a new informer for BackupRepository type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredBackupRepositoryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().BackupRepositories(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().BackupRepositories(namespace).Watch(context.TODO(), options) - }, - }, - &velerov1.BackupRepository{}, - resyncPeriod, - indexers, - ) -} - -func (f *backupRepositoryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredBackupRepositoryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *backupRepositoryInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&velerov1.BackupRepository{}, f.defaultInformer) -} - -func (f *backupRepositoryInformer) Lister() v1.BackupRepositoryLister { - return v1.NewBackupRepositoryLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/informers/externalversions/velero/v1/backupstoragelocation.go b/pkg/generated/informers/externalversions/velero/v1/backupstoragelocation.go deleted file mode 100644 index 4c732c8e6..000000000 --- a/pkg/generated/informers/externalversions/velero/v1/backupstoragelocation.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/vmware-tanzu/velero/pkg/generated/listers/velero/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// BackupStorageLocationInformer provides access to a shared informer and lister for -// BackupStorageLocations. -type BackupStorageLocationInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.BackupStorageLocationLister -} - -type backupStorageLocationInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewBackupStorageLocationInformer constructs a new informer for BackupStorageLocation type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewBackupStorageLocationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredBackupStorageLocationInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredBackupStorageLocationInformer constructs a new informer for BackupStorageLocation type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredBackupStorageLocationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().BackupStorageLocations(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().BackupStorageLocations(namespace).Watch(context.TODO(), options) - }, - }, - &velerov1.BackupStorageLocation{}, - resyncPeriod, - indexers, - ) -} - -func (f *backupStorageLocationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredBackupStorageLocationInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *backupStorageLocationInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&velerov1.BackupStorageLocation{}, f.defaultInformer) -} - -func (f *backupStorageLocationInformer) Lister() v1.BackupStorageLocationLister { - return v1.NewBackupStorageLocationLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/informers/externalversions/velero/v1/deletebackuprequest.go b/pkg/generated/informers/externalversions/velero/v1/deletebackuprequest.go deleted file mode 100644 index 7019d3bff..000000000 --- a/pkg/generated/informers/externalversions/velero/v1/deletebackuprequest.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/vmware-tanzu/velero/pkg/generated/listers/velero/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// DeleteBackupRequestInformer provides access to a shared informer and lister for -// DeleteBackupRequests. -type DeleteBackupRequestInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.DeleteBackupRequestLister -} - -type deleteBackupRequestInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewDeleteBackupRequestInformer constructs a new informer for DeleteBackupRequest type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewDeleteBackupRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDeleteBackupRequestInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredDeleteBackupRequestInformer constructs a new informer for DeleteBackupRequest type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredDeleteBackupRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().DeleteBackupRequests(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().DeleteBackupRequests(namespace).Watch(context.TODO(), options) - }, - }, - &velerov1.DeleteBackupRequest{}, - resyncPeriod, - indexers, - ) -} - -func (f *deleteBackupRequestInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDeleteBackupRequestInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *deleteBackupRequestInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&velerov1.DeleteBackupRequest{}, f.defaultInformer) -} - -func (f *deleteBackupRequestInformer) Lister() v1.DeleteBackupRequestLister { - return v1.NewDeleteBackupRequestLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/informers/externalversions/velero/v1/downloadrequest.go b/pkg/generated/informers/externalversions/velero/v1/downloadrequest.go deleted file mode 100644 index 23d91e399..000000000 --- a/pkg/generated/informers/externalversions/velero/v1/downloadrequest.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/vmware-tanzu/velero/pkg/generated/listers/velero/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// DownloadRequestInformer provides access to a shared informer and lister for -// DownloadRequests. -type DownloadRequestInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.DownloadRequestLister -} - -type downloadRequestInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewDownloadRequestInformer constructs a new informer for DownloadRequest type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewDownloadRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDownloadRequestInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredDownloadRequestInformer constructs a new informer for DownloadRequest type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredDownloadRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().DownloadRequests(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().DownloadRequests(namespace).Watch(context.TODO(), options) - }, - }, - &velerov1.DownloadRequest{}, - resyncPeriod, - indexers, - ) -} - -func (f *downloadRequestInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDownloadRequestInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *downloadRequestInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&velerov1.DownloadRequest{}, f.defaultInformer) -} - -func (f *downloadRequestInformer) Lister() v1.DownloadRequestLister { - return v1.NewDownloadRequestLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/informers/externalversions/velero/v1/interface.go b/pkg/generated/informers/externalversions/velero/v1/interface.go deleted file mode 100644 index 087dd3356..000000000 --- a/pkg/generated/informers/externalversions/velero/v1/interface.go +++ /dev/null @@ -1,115 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // Backups returns a BackupInformer. - Backups() BackupInformer - // BackupRepositories returns a BackupRepositoryInformer. - BackupRepositories() BackupRepositoryInformer - // BackupStorageLocations returns a BackupStorageLocationInformer. - BackupStorageLocations() BackupStorageLocationInformer - // DeleteBackupRequests returns a DeleteBackupRequestInformer. - DeleteBackupRequests() DeleteBackupRequestInformer - // DownloadRequests returns a DownloadRequestInformer. - DownloadRequests() DownloadRequestInformer - // PodVolumeBackups returns a PodVolumeBackupInformer. - PodVolumeBackups() PodVolumeBackupInformer - // PodVolumeRestores returns a PodVolumeRestoreInformer. - PodVolumeRestores() PodVolumeRestoreInformer - // Restores returns a RestoreInformer. - Restores() RestoreInformer - // Schedules returns a ScheduleInformer. - Schedules() ScheduleInformer - // ServerStatusRequests returns a ServerStatusRequestInformer. - ServerStatusRequests() ServerStatusRequestInformer - // VolumeSnapshotLocations returns a VolumeSnapshotLocationInformer. - VolumeSnapshotLocations() VolumeSnapshotLocationInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// Backups returns a BackupInformer. -func (v *version) Backups() BackupInformer { - return &backupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// BackupRepositories returns a BackupRepositoryInformer. -func (v *version) BackupRepositories() BackupRepositoryInformer { - return &backupRepositoryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// BackupStorageLocations returns a BackupStorageLocationInformer. -func (v *version) BackupStorageLocations() BackupStorageLocationInformer { - return &backupStorageLocationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// DeleteBackupRequests returns a DeleteBackupRequestInformer. -func (v *version) DeleteBackupRequests() DeleteBackupRequestInformer { - return &deleteBackupRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// DownloadRequests returns a DownloadRequestInformer. -func (v *version) DownloadRequests() DownloadRequestInformer { - return &downloadRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// PodVolumeBackups returns a PodVolumeBackupInformer. -func (v *version) PodVolumeBackups() PodVolumeBackupInformer { - return &podVolumeBackupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// PodVolumeRestores returns a PodVolumeRestoreInformer. -func (v *version) PodVolumeRestores() PodVolumeRestoreInformer { - return &podVolumeRestoreInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Restores returns a RestoreInformer. -func (v *version) Restores() RestoreInformer { - return &restoreInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Schedules returns a ScheduleInformer. -func (v *version) Schedules() ScheduleInformer { - return &scheduleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// ServerStatusRequests returns a ServerStatusRequestInformer. -func (v *version) ServerStatusRequests() ServerStatusRequestInformer { - return &serverStatusRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// VolumeSnapshotLocations returns a VolumeSnapshotLocationInformer. -func (v *version) VolumeSnapshotLocations() VolumeSnapshotLocationInformer { - return &volumeSnapshotLocationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/pkg/generated/informers/externalversions/velero/v1/podvolumebackup.go b/pkg/generated/informers/externalversions/velero/v1/podvolumebackup.go deleted file mode 100644 index d2835b2ea..000000000 --- a/pkg/generated/informers/externalversions/velero/v1/podvolumebackup.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/vmware-tanzu/velero/pkg/generated/listers/velero/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// PodVolumeBackupInformer provides access to a shared informer and lister for -// PodVolumeBackups. -type PodVolumeBackupInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.PodVolumeBackupLister -} - -type podVolumeBackupInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewPodVolumeBackupInformer constructs a new informer for PodVolumeBackup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewPodVolumeBackupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPodVolumeBackupInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredPodVolumeBackupInformer constructs a new informer for PodVolumeBackup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredPodVolumeBackupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().PodVolumeBackups(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().PodVolumeBackups(namespace).Watch(context.TODO(), options) - }, - }, - &velerov1.PodVolumeBackup{}, - resyncPeriod, - indexers, - ) -} - -func (f *podVolumeBackupInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPodVolumeBackupInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *podVolumeBackupInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&velerov1.PodVolumeBackup{}, f.defaultInformer) -} - -func (f *podVolumeBackupInformer) Lister() v1.PodVolumeBackupLister { - return v1.NewPodVolumeBackupLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/informers/externalversions/velero/v1/podvolumerestore.go b/pkg/generated/informers/externalversions/velero/v1/podvolumerestore.go deleted file mode 100644 index eccad43b2..000000000 --- a/pkg/generated/informers/externalversions/velero/v1/podvolumerestore.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/vmware-tanzu/velero/pkg/generated/listers/velero/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// PodVolumeRestoreInformer provides access to a shared informer and lister for -// PodVolumeRestores. -type PodVolumeRestoreInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.PodVolumeRestoreLister -} - -type podVolumeRestoreInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewPodVolumeRestoreInformer constructs a new informer for PodVolumeRestore type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewPodVolumeRestoreInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPodVolumeRestoreInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredPodVolumeRestoreInformer constructs a new informer for PodVolumeRestore type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredPodVolumeRestoreInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().PodVolumeRestores(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().PodVolumeRestores(namespace).Watch(context.TODO(), options) - }, - }, - &velerov1.PodVolumeRestore{}, - resyncPeriod, - indexers, - ) -} - -func (f *podVolumeRestoreInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPodVolumeRestoreInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *podVolumeRestoreInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&velerov1.PodVolumeRestore{}, f.defaultInformer) -} - -func (f *podVolumeRestoreInformer) Lister() v1.PodVolumeRestoreLister { - return v1.NewPodVolumeRestoreLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/informers/externalversions/velero/v1/restore.go b/pkg/generated/informers/externalversions/velero/v1/restore.go deleted file mode 100644 index 691d1b7e8..000000000 --- a/pkg/generated/informers/externalversions/velero/v1/restore.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/vmware-tanzu/velero/pkg/generated/listers/velero/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// RestoreInformer provides access to a shared informer and lister for -// Restores. -type RestoreInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.RestoreLister -} - -type restoreInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewRestoreInformer constructs a new informer for Restore type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewRestoreInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRestoreInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredRestoreInformer constructs a new informer for Restore type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredRestoreInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().Restores(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().Restores(namespace).Watch(context.TODO(), options) - }, - }, - &velerov1.Restore{}, - resyncPeriod, - indexers, - ) -} - -func (f *restoreInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRestoreInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *restoreInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&velerov1.Restore{}, f.defaultInformer) -} - -func (f *restoreInformer) Lister() v1.RestoreLister { - return v1.NewRestoreLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/informers/externalversions/velero/v1/schedule.go b/pkg/generated/informers/externalversions/velero/v1/schedule.go deleted file mode 100644 index 31114d809..000000000 --- a/pkg/generated/informers/externalversions/velero/v1/schedule.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/vmware-tanzu/velero/pkg/generated/listers/velero/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// ScheduleInformer provides access to a shared informer and lister for -// Schedules. -type ScheduleInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.ScheduleLister -} - -type scheduleInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewScheduleInformer constructs a new informer for Schedule type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewScheduleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredScheduleInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredScheduleInformer constructs a new informer for Schedule type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredScheduleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().Schedules(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().Schedules(namespace).Watch(context.TODO(), options) - }, - }, - &velerov1.Schedule{}, - resyncPeriod, - indexers, - ) -} - -func (f *scheduleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredScheduleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *scheduleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&velerov1.Schedule{}, f.defaultInformer) -} - -func (f *scheduleInformer) Lister() v1.ScheduleLister { - return v1.NewScheduleLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/informers/externalversions/velero/v1/serverstatusrequest.go b/pkg/generated/informers/externalversions/velero/v1/serverstatusrequest.go deleted file mode 100644 index 53290d408..000000000 --- a/pkg/generated/informers/externalversions/velero/v1/serverstatusrequest.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/vmware-tanzu/velero/pkg/generated/listers/velero/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// ServerStatusRequestInformer provides access to a shared informer and lister for -// ServerStatusRequests. -type ServerStatusRequestInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.ServerStatusRequestLister -} - -type serverStatusRequestInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewServerStatusRequestInformer constructs a new informer for ServerStatusRequest type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewServerStatusRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredServerStatusRequestInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredServerStatusRequestInformer constructs a new informer for ServerStatusRequest type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredServerStatusRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().ServerStatusRequests(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().ServerStatusRequests(namespace).Watch(context.TODO(), options) - }, - }, - &velerov1.ServerStatusRequest{}, - resyncPeriod, - indexers, - ) -} - -func (f *serverStatusRequestInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredServerStatusRequestInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *serverStatusRequestInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&velerov1.ServerStatusRequest{}, f.defaultInformer) -} - -func (f *serverStatusRequestInformer) Lister() v1.ServerStatusRequestLister { - return v1.NewServerStatusRequestLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/informers/externalversions/velero/v1/volumesnapshotlocation.go b/pkg/generated/informers/externalversions/velero/v1/volumesnapshotlocation.go deleted file mode 100644 index 3b6c1eca1..000000000 --- a/pkg/generated/informers/externalversions/velero/v1/volumesnapshotlocation.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/vmware-tanzu/velero/pkg/generated/listers/velero/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotLocationInformer provides access to a shared informer and lister for -// VolumeSnapshotLocations. -type VolumeSnapshotLocationInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.VolumeSnapshotLocationLister -} - -type volumeSnapshotLocationInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewVolumeSnapshotLocationInformer constructs a new informer for VolumeSnapshotLocation type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVolumeSnapshotLocationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotLocationInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredVolumeSnapshotLocationInformer constructs a new informer for VolumeSnapshotLocation type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVolumeSnapshotLocationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().VolumeSnapshotLocations(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV1().VolumeSnapshotLocations(namespace).Watch(context.TODO(), options) - }, - }, - &velerov1.VolumeSnapshotLocation{}, - resyncPeriod, - indexers, - ) -} - -func (f *volumeSnapshotLocationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVolumeSnapshotLocationInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *volumeSnapshotLocationInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&velerov1.VolumeSnapshotLocation{}, f.defaultInformer) -} - -func (f *volumeSnapshotLocationInformer) Lister() v1.VolumeSnapshotLocationLister { - return v1.NewVolumeSnapshotLocationLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/informers/externalversions/velero/v2alpha1/datadownload.go b/pkg/generated/informers/externalversions/velero/v2alpha1/datadownload.go deleted file mode 100644 index 3b539b332..000000000 --- a/pkg/generated/informers/externalversions/velero/v2alpha1/datadownload.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - time "time" - - velerov2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v2alpha1 "github.com/vmware-tanzu/velero/pkg/generated/listers/velero/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// DataDownloadInformer provides access to a shared informer and lister for -// DataDownloads. -type DataDownloadInformer interface { - Informer() cache.SharedIndexInformer - Lister() v2alpha1.DataDownloadLister -} - -type dataDownloadInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewDataDownloadInformer constructs a new informer for DataDownload type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewDataDownloadInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDataDownloadInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredDataDownloadInformer constructs a new informer for DataDownload type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredDataDownloadInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV2alpha1().DataDownloads(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV2alpha1().DataDownloads(namespace).Watch(context.TODO(), options) - }, - }, - &velerov2alpha1.DataDownload{}, - resyncPeriod, - indexers, - ) -} - -func (f *dataDownloadInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDataDownloadInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *dataDownloadInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&velerov2alpha1.DataDownload{}, f.defaultInformer) -} - -func (f *dataDownloadInformer) Lister() v2alpha1.DataDownloadLister { - return v2alpha1.NewDataDownloadLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/informers/externalversions/velero/v2alpha1/dataupload.go b/pkg/generated/informers/externalversions/velero/v2alpha1/dataupload.go deleted file mode 100644 index f7e8f8d07..000000000 --- a/pkg/generated/informers/externalversions/velero/v2alpha1/dataupload.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - time "time" - - velerov2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" - versioned "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned" - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" - v2alpha1 "github.com/vmware-tanzu/velero/pkg/generated/listers/velero/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// DataUploadInformer provides access to a shared informer and lister for -// DataUploads. -type DataUploadInformer interface { - Informer() cache.SharedIndexInformer - Lister() v2alpha1.DataUploadLister -} - -type dataUploadInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewDataUploadInformer constructs a new informer for DataUpload type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewDataUploadInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDataUploadInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredDataUploadInformer constructs a new informer for DataUpload type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredDataUploadInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV2alpha1().DataUploads(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VeleroV2alpha1().DataUploads(namespace).Watch(context.TODO(), options) - }, - }, - &velerov2alpha1.DataUpload{}, - resyncPeriod, - indexers, - ) -} - -func (f *dataUploadInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDataUploadInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *dataUploadInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&velerov2alpha1.DataUpload{}, f.defaultInformer) -} - -func (f *dataUploadInformer) Lister() v2alpha1.DataUploadLister { - return v2alpha1.NewDataUploadLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/informers/externalversions/velero/v2alpha1/interface.go b/pkg/generated/informers/externalversions/velero/v2alpha1/interface.go deleted file mode 100644 index 41f8edabf..000000000 --- a/pkg/generated/informers/externalversions/velero/v2alpha1/interface.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - internalinterfaces "github.com/vmware-tanzu/velero/pkg/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // DataDownloads returns a DataDownloadInformer. - DataDownloads() DataDownloadInformer - // DataUploads returns a DataUploadInformer. - DataUploads() DataUploadInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// DataDownloads returns a DataDownloadInformer. -func (v *version) DataDownloads() DataDownloadInformer { - return &dataDownloadInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// DataUploads returns a DataUploadInformer. -func (v *version) DataUploads() DataUploadInformer { - return &dataUploadInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/pkg/generated/listers/velero/v1/backup.go b/pkg/generated/listers/velero/v1/backup.go deleted file mode 100644 index fa3f5cb6f..000000000 --- a/pkg/generated/listers/velero/v1/backup.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// BackupLister helps list Backups. -// All objects returned here must be treated as read-only. -type BackupLister interface { - // List lists all Backups in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Backup, err error) - // Backups returns an object that can list and get Backups. - Backups(namespace string) BackupNamespaceLister - BackupListerExpansion -} - -// backupLister implements the BackupLister interface. -type backupLister struct { - indexer cache.Indexer -} - -// NewBackupLister returns a new BackupLister. -func NewBackupLister(indexer cache.Indexer) BackupLister { - return &backupLister{indexer: indexer} -} - -// List lists all Backups in the indexer. -func (s *backupLister) List(selector labels.Selector) (ret []*v1.Backup, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Backup)) - }) - return ret, err -} - -// Backups returns an object that can list and get Backups. -func (s *backupLister) Backups(namespace string) BackupNamespaceLister { - return backupNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// BackupNamespaceLister helps list and get Backups. -// All objects returned here must be treated as read-only. -type BackupNamespaceLister interface { - // List lists all Backups in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Backup, err error) - // Get retrieves the Backup from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.Backup, error) - BackupNamespaceListerExpansion -} - -// backupNamespaceLister implements the BackupNamespaceLister -// interface. -type backupNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Backups in the indexer for a given namespace. -func (s backupNamespaceLister) List(selector labels.Selector) (ret []*v1.Backup, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Backup)) - }) - return ret, err -} - -// Get retrieves the Backup from the indexer for a given namespace and name. -func (s backupNamespaceLister) Get(name string) (*v1.Backup, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("backup"), name) - } - return obj.(*v1.Backup), nil -} diff --git a/pkg/generated/listers/velero/v1/backuprepository.go b/pkg/generated/listers/velero/v1/backuprepository.go deleted file mode 100644 index ef619baf1..000000000 --- a/pkg/generated/listers/velero/v1/backuprepository.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// BackupRepositoryLister helps list BackupRepositories. -// All objects returned here must be treated as read-only. -type BackupRepositoryLister interface { - // List lists all BackupRepositories in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.BackupRepository, err error) - // BackupRepositories returns an object that can list and get BackupRepositories. - BackupRepositories(namespace string) BackupRepositoryNamespaceLister - BackupRepositoryListerExpansion -} - -// backupRepositoryLister implements the BackupRepositoryLister interface. -type backupRepositoryLister struct { - indexer cache.Indexer -} - -// NewBackupRepositoryLister returns a new BackupRepositoryLister. -func NewBackupRepositoryLister(indexer cache.Indexer) BackupRepositoryLister { - return &backupRepositoryLister{indexer: indexer} -} - -// List lists all BackupRepositories in the indexer. -func (s *backupRepositoryLister) List(selector labels.Selector) (ret []*v1.BackupRepository, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.BackupRepository)) - }) - return ret, err -} - -// BackupRepositories returns an object that can list and get BackupRepositories. -func (s *backupRepositoryLister) BackupRepositories(namespace string) BackupRepositoryNamespaceLister { - return backupRepositoryNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// BackupRepositoryNamespaceLister helps list and get BackupRepositories. -// All objects returned here must be treated as read-only. -type BackupRepositoryNamespaceLister interface { - // List lists all BackupRepositories in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.BackupRepository, err error) - // Get retrieves the BackupRepository from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.BackupRepository, error) - BackupRepositoryNamespaceListerExpansion -} - -// backupRepositoryNamespaceLister implements the BackupRepositoryNamespaceLister -// interface. -type backupRepositoryNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all BackupRepositories in the indexer for a given namespace. -func (s backupRepositoryNamespaceLister) List(selector labels.Selector) (ret []*v1.BackupRepository, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.BackupRepository)) - }) - return ret, err -} - -// Get retrieves the BackupRepository from the indexer for a given namespace and name. -func (s backupRepositoryNamespaceLister) Get(name string) (*v1.BackupRepository, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("backuprepository"), name) - } - return obj.(*v1.BackupRepository), nil -} diff --git a/pkg/generated/listers/velero/v1/backupstoragelocation.go b/pkg/generated/listers/velero/v1/backupstoragelocation.go deleted file mode 100644 index 74daf16dc..000000000 --- a/pkg/generated/listers/velero/v1/backupstoragelocation.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// BackupStorageLocationLister helps list BackupStorageLocations. -// All objects returned here must be treated as read-only. -type BackupStorageLocationLister interface { - // List lists all BackupStorageLocations in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.BackupStorageLocation, err error) - // BackupStorageLocations returns an object that can list and get BackupStorageLocations. - BackupStorageLocations(namespace string) BackupStorageLocationNamespaceLister - BackupStorageLocationListerExpansion -} - -// backupStorageLocationLister implements the BackupStorageLocationLister interface. -type backupStorageLocationLister struct { - indexer cache.Indexer -} - -// NewBackupStorageLocationLister returns a new BackupStorageLocationLister. -func NewBackupStorageLocationLister(indexer cache.Indexer) BackupStorageLocationLister { - return &backupStorageLocationLister{indexer: indexer} -} - -// List lists all BackupStorageLocations in the indexer. -func (s *backupStorageLocationLister) List(selector labels.Selector) (ret []*v1.BackupStorageLocation, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.BackupStorageLocation)) - }) - return ret, err -} - -// BackupStorageLocations returns an object that can list and get BackupStorageLocations. -func (s *backupStorageLocationLister) BackupStorageLocations(namespace string) BackupStorageLocationNamespaceLister { - return backupStorageLocationNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// BackupStorageLocationNamespaceLister helps list and get BackupStorageLocations. -// All objects returned here must be treated as read-only. -type BackupStorageLocationNamespaceLister interface { - // List lists all BackupStorageLocations in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.BackupStorageLocation, err error) - // Get retrieves the BackupStorageLocation from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.BackupStorageLocation, error) - BackupStorageLocationNamespaceListerExpansion -} - -// backupStorageLocationNamespaceLister implements the BackupStorageLocationNamespaceLister -// interface. -type backupStorageLocationNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all BackupStorageLocations in the indexer for a given namespace. -func (s backupStorageLocationNamespaceLister) List(selector labels.Selector) (ret []*v1.BackupStorageLocation, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.BackupStorageLocation)) - }) - return ret, err -} - -// Get retrieves the BackupStorageLocation from the indexer for a given namespace and name. -func (s backupStorageLocationNamespaceLister) Get(name string) (*v1.BackupStorageLocation, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("backupstoragelocation"), name) - } - return obj.(*v1.BackupStorageLocation), nil -} diff --git a/pkg/generated/listers/velero/v1/deletebackuprequest.go b/pkg/generated/listers/velero/v1/deletebackuprequest.go deleted file mode 100644 index 954e9aaf8..000000000 --- a/pkg/generated/listers/velero/v1/deletebackuprequest.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// DeleteBackupRequestLister helps list DeleteBackupRequests. -// All objects returned here must be treated as read-only. -type DeleteBackupRequestLister interface { - // List lists all DeleteBackupRequests in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.DeleteBackupRequest, err error) - // DeleteBackupRequests returns an object that can list and get DeleteBackupRequests. - DeleteBackupRequests(namespace string) DeleteBackupRequestNamespaceLister - DeleteBackupRequestListerExpansion -} - -// deleteBackupRequestLister implements the DeleteBackupRequestLister interface. -type deleteBackupRequestLister struct { - indexer cache.Indexer -} - -// NewDeleteBackupRequestLister returns a new DeleteBackupRequestLister. -func NewDeleteBackupRequestLister(indexer cache.Indexer) DeleteBackupRequestLister { - return &deleteBackupRequestLister{indexer: indexer} -} - -// List lists all DeleteBackupRequests in the indexer. -func (s *deleteBackupRequestLister) List(selector labels.Selector) (ret []*v1.DeleteBackupRequest, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.DeleteBackupRequest)) - }) - return ret, err -} - -// DeleteBackupRequests returns an object that can list and get DeleteBackupRequests. -func (s *deleteBackupRequestLister) DeleteBackupRequests(namespace string) DeleteBackupRequestNamespaceLister { - return deleteBackupRequestNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// DeleteBackupRequestNamespaceLister helps list and get DeleteBackupRequests. -// All objects returned here must be treated as read-only. -type DeleteBackupRequestNamespaceLister interface { - // List lists all DeleteBackupRequests in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.DeleteBackupRequest, err error) - // Get retrieves the DeleteBackupRequest from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.DeleteBackupRequest, error) - DeleteBackupRequestNamespaceListerExpansion -} - -// deleteBackupRequestNamespaceLister implements the DeleteBackupRequestNamespaceLister -// interface. -type deleteBackupRequestNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all DeleteBackupRequests in the indexer for a given namespace. -func (s deleteBackupRequestNamespaceLister) List(selector labels.Selector) (ret []*v1.DeleteBackupRequest, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.DeleteBackupRequest)) - }) - return ret, err -} - -// Get retrieves the DeleteBackupRequest from the indexer for a given namespace and name. -func (s deleteBackupRequestNamespaceLister) Get(name string) (*v1.DeleteBackupRequest, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("deletebackuprequest"), name) - } - return obj.(*v1.DeleteBackupRequest), nil -} diff --git a/pkg/generated/listers/velero/v1/downloadrequest.go b/pkg/generated/listers/velero/v1/downloadrequest.go deleted file mode 100644 index 6552cf02d..000000000 --- a/pkg/generated/listers/velero/v1/downloadrequest.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// DownloadRequestLister helps list DownloadRequests. -// All objects returned here must be treated as read-only. -type DownloadRequestLister interface { - // List lists all DownloadRequests in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.DownloadRequest, err error) - // DownloadRequests returns an object that can list and get DownloadRequests. - DownloadRequests(namespace string) DownloadRequestNamespaceLister - DownloadRequestListerExpansion -} - -// downloadRequestLister implements the DownloadRequestLister interface. -type downloadRequestLister struct { - indexer cache.Indexer -} - -// NewDownloadRequestLister returns a new DownloadRequestLister. -func NewDownloadRequestLister(indexer cache.Indexer) DownloadRequestLister { - return &downloadRequestLister{indexer: indexer} -} - -// List lists all DownloadRequests in the indexer. -func (s *downloadRequestLister) List(selector labels.Selector) (ret []*v1.DownloadRequest, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.DownloadRequest)) - }) - return ret, err -} - -// DownloadRequests returns an object that can list and get DownloadRequests. -func (s *downloadRequestLister) DownloadRequests(namespace string) DownloadRequestNamespaceLister { - return downloadRequestNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// DownloadRequestNamespaceLister helps list and get DownloadRequests. -// All objects returned here must be treated as read-only. -type DownloadRequestNamespaceLister interface { - // List lists all DownloadRequests in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.DownloadRequest, err error) - // Get retrieves the DownloadRequest from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.DownloadRequest, error) - DownloadRequestNamespaceListerExpansion -} - -// downloadRequestNamespaceLister implements the DownloadRequestNamespaceLister -// interface. -type downloadRequestNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all DownloadRequests in the indexer for a given namespace. -func (s downloadRequestNamespaceLister) List(selector labels.Selector) (ret []*v1.DownloadRequest, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.DownloadRequest)) - }) - return ret, err -} - -// Get retrieves the DownloadRequest from the indexer for a given namespace and name. -func (s downloadRequestNamespaceLister) Get(name string) (*v1.DownloadRequest, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("downloadrequest"), name) - } - return obj.(*v1.DownloadRequest), nil -} diff --git a/pkg/generated/listers/velero/v1/expansion_generated.go b/pkg/generated/listers/velero/v1/expansion_generated.go deleted file mode 100644 index c0cd57654..000000000 --- a/pkg/generated/listers/velero/v1/expansion_generated.go +++ /dev/null @@ -1,107 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -// BackupListerExpansion allows custom methods to be added to -// BackupLister. -type BackupListerExpansion interface{} - -// BackupNamespaceListerExpansion allows custom methods to be added to -// BackupNamespaceLister. -type BackupNamespaceListerExpansion interface{} - -// BackupRepositoryListerExpansion allows custom methods to be added to -// BackupRepositoryLister. -type BackupRepositoryListerExpansion interface{} - -// BackupRepositoryNamespaceListerExpansion allows custom methods to be added to -// BackupRepositoryNamespaceLister. -type BackupRepositoryNamespaceListerExpansion interface{} - -// BackupStorageLocationListerExpansion allows custom methods to be added to -// BackupStorageLocationLister. -type BackupStorageLocationListerExpansion interface{} - -// BackupStorageLocationNamespaceListerExpansion allows custom methods to be added to -// BackupStorageLocationNamespaceLister. -type BackupStorageLocationNamespaceListerExpansion interface{} - -// DeleteBackupRequestListerExpansion allows custom methods to be added to -// DeleteBackupRequestLister. -type DeleteBackupRequestListerExpansion interface{} - -// DeleteBackupRequestNamespaceListerExpansion allows custom methods to be added to -// DeleteBackupRequestNamespaceLister. -type DeleteBackupRequestNamespaceListerExpansion interface{} - -// DownloadRequestListerExpansion allows custom methods to be added to -// DownloadRequestLister. -type DownloadRequestListerExpansion interface{} - -// DownloadRequestNamespaceListerExpansion allows custom methods to be added to -// DownloadRequestNamespaceLister. -type DownloadRequestNamespaceListerExpansion interface{} - -// PodVolumeBackupListerExpansion allows custom methods to be added to -// PodVolumeBackupLister. -type PodVolumeBackupListerExpansion interface{} - -// PodVolumeBackupNamespaceListerExpansion allows custom methods to be added to -// PodVolumeBackupNamespaceLister. -type PodVolumeBackupNamespaceListerExpansion interface{} - -// PodVolumeRestoreListerExpansion allows custom methods to be added to -// PodVolumeRestoreLister. -type PodVolumeRestoreListerExpansion interface{} - -// PodVolumeRestoreNamespaceListerExpansion allows custom methods to be added to -// PodVolumeRestoreNamespaceLister. -type PodVolumeRestoreNamespaceListerExpansion interface{} - -// RestoreListerExpansion allows custom methods to be added to -// RestoreLister. -type RestoreListerExpansion interface{} - -// RestoreNamespaceListerExpansion allows custom methods to be added to -// RestoreNamespaceLister. -type RestoreNamespaceListerExpansion interface{} - -// ScheduleListerExpansion allows custom methods to be added to -// ScheduleLister. -type ScheduleListerExpansion interface{} - -// ScheduleNamespaceListerExpansion allows custom methods to be added to -// ScheduleNamespaceLister. -type ScheduleNamespaceListerExpansion interface{} - -// ServerStatusRequestListerExpansion allows custom methods to be added to -// ServerStatusRequestLister. -type ServerStatusRequestListerExpansion interface{} - -// ServerStatusRequestNamespaceListerExpansion allows custom methods to be added to -// ServerStatusRequestNamespaceLister. -type ServerStatusRequestNamespaceListerExpansion interface{} - -// VolumeSnapshotLocationListerExpansion allows custom methods to be added to -// VolumeSnapshotLocationLister. -type VolumeSnapshotLocationListerExpansion interface{} - -// VolumeSnapshotLocationNamespaceListerExpansion allows custom methods to be added to -// VolumeSnapshotLocationNamespaceLister. -type VolumeSnapshotLocationNamespaceListerExpansion interface{} diff --git a/pkg/generated/listers/velero/v1/podvolumebackup.go b/pkg/generated/listers/velero/v1/podvolumebackup.go deleted file mode 100644 index 08ed20d6f..000000000 --- a/pkg/generated/listers/velero/v1/podvolumebackup.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// PodVolumeBackupLister helps list PodVolumeBackups. -// All objects returned here must be treated as read-only. -type PodVolumeBackupLister interface { - // List lists all PodVolumeBackups in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.PodVolumeBackup, err error) - // PodVolumeBackups returns an object that can list and get PodVolumeBackups. - PodVolumeBackups(namespace string) PodVolumeBackupNamespaceLister - PodVolumeBackupListerExpansion -} - -// podVolumeBackupLister implements the PodVolumeBackupLister interface. -type podVolumeBackupLister struct { - indexer cache.Indexer -} - -// NewPodVolumeBackupLister returns a new PodVolumeBackupLister. -func NewPodVolumeBackupLister(indexer cache.Indexer) PodVolumeBackupLister { - return &podVolumeBackupLister{indexer: indexer} -} - -// List lists all PodVolumeBackups in the indexer. -func (s *podVolumeBackupLister) List(selector labels.Selector) (ret []*v1.PodVolumeBackup, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.PodVolumeBackup)) - }) - return ret, err -} - -// PodVolumeBackups returns an object that can list and get PodVolumeBackups. -func (s *podVolumeBackupLister) PodVolumeBackups(namespace string) PodVolumeBackupNamespaceLister { - return podVolumeBackupNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// PodVolumeBackupNamespaceLister helps list and get PodVolumeBackups. -// All objects returned here must be treated as read-only. -type PodVolumeBackupNamespaceLister interface { - // List lists all PodVolumeBackups in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.PodVolumeBackup, err error) - // Get retrieves the PodVolumeBackup from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.PodVolumeBackup, error) - PodVolumeBackupNamespaceListerExpansion -} - -// podVolumeBackupNamespaceLister implements the PodVolumeBackupNamespaceLister -// interface. -type podVolumeBackupNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all PodVolumeBackups in the indexer for a given namespace. -func (s podVolumeBackupNamespaceLister) List(selector labels.Selector) (ret []*v1.PodVolumeBackup, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.PodVolumeBackup)) - }) - return ret, err -} - -// Get retrieves the PodVolumeBackup from the indexer for a given namespace and name. -func (s podVolumeBackupNamespaceLister) Get(name string) (*v1.PodVolumeBackup, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("podvolumebackup"), name) - } - return obj.(*v1.PodVolumeBackup), nil -} diff --git a/pkg/generated/listers/velero/v1/podvolumerestore.go b/pkg/generated/listers/velero/v1/podvolumerestore.go deleted file mode 100644 index 93f96b24b..000000000 --- a/pkg/generated/listers/velero/v1/podvolumerestore.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// PodVolumeRestoreLister helps list PodVolumeRestores. -// All objects returned here must be treated as read-only. -type PodVolumeRestoreLister interface { - // List lists all PodVolumeRestores in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.PodVolumeRestore, err error) - // PodVolumeRestores returns an object that can list and get PodVolumeRestores. - PodVolumeRestores(namespace string) PodVolumeRestoreNamespaceLister - PodVolumeRestoreListerExpansion -} - -// podVolumeRestoreLister implements the PodVolumeRestoreLister interface. -type podVolumeRestoreLister struct { - indexer cache.Indexer -} - -// NewPodVolumeRestoreLister returns a new PodVolumeRestoreLister. -func NewPodVolumeRestoreLister(indexer cache.Indexer) PodVolumeRestoreLister { - return &podVolumeRestoreLister{indexer: indexer} -} - -// List lists all PodVolumeRestores in the indexer. -func (s *podVolumeRestoreLister) List(selector labels.Selector) (ret []*v1.PodVolumeRestore, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.PodVolumeRestore)) - }) - return ret, err -} - -// PodVolumeRestores returns an object that can list and get PodVolumeRestores. -func (s *podVolumeRestoreLister) PodVolumeRestores(namespace string) PodVolumeRestoreNamespaceLister { - return podVolumeRestoreNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// PodVolumeRestoreNamespaceLister helps list and get PodVolumeRestores. -// All objects returned here must be treated as read-only. -type PodVolumeRestoreNamespaceLister interface { - // List lists all PodVolumeRestores in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.PodVolumeRestore, err error) - // Get retrieves the PodVolumeRestore from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.PodVolumeRestore, error) - PodVolumeRestoreNamespaceListerExpansion -} - -// podVolumeRestoreNamespaceLister implements the PodVolumeRestoreNamespaceLister -// interface. -type podVolumeRestoreNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all PodVolumeRestores in the indexer for a given namespace. -func (s podVolumeRestoreNamespaceLister) List(selector labels.Selector) (ret []*v1.PodVolumeRestore, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.PodVolumeRestore)) - }) - return ret, err -} - -// Get retrieves the PodVolumeRestore from the indexer for a given namespace and name. -func (s podVolumeRestoreNamespaceLister) Get(name string) (*v1.PodVolumeRestore, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("podvolumerestore"), name) - } - return obj.(*v1.PodVolumeRestore), nil -} diff --git a/pkg/generated/listers/velero/v1/restore.go b/pkg/generated/listers/velero/v1/restore.go deleted file mode 100644 index de0b89ce8..000000000 --- a/pkg/generated/listers/velero/v1/restore.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// RestoreLister helps list Restores. -// All objects returned here must be treated as read-only. -type RestoreLister interface { - // List lists all Restores in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Restore, err error) - // Restores returns an object that can list and get Restores. - Restores(namespace string) RestoreNamespaceLister - RestoreListerExpansion -} - -// restoreLister implements the RestoreLister interface. -type restoreLister struct { - indexer cache.Indexer -} - -// NewRestoreLister returns a new RestoreLister. -func NewRestoreLister(indexer cache.Indexer) RestoreLister { - return &restoreLister{indexer: indexer} -} - -// List lists all Restores in the indexer. -func (s *restoreLister) List(selector labels.Selector) (ret []*v1.Restore, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Restore)) - }) - return ret, err -} - -// Restores returns an object that can list and get Restores. -func (s *restoreLister) Restores(namespace string) RestoreNamespaceLister { - return restoreNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// RestoreNamespaceLister helps list and get Restores. -// All objects returned here must be treated as read-only. -type RestoreNamespaceLister interface { - // List lists all Restores in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Restore, err error) - // Get retrieves the Restore from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.Restore, error) - RestoreNamespaceListerExpansion -} - -// restoreNamespaceLister implements the RestoreNamespaceLister -// interface. -type restoreNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Restores in the indexer for a given namespace. -func (s restoreNamespaceLister) List(selector labels.Selector) (ret []*v1.Restore, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Restore)) - }) - return ret, err -} - -// Get retrieves the Restore from the indexer for a given namespace and name. -func (s restoreNamespaceLister) Get(name string) (*v1.Restore, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("restore"), name) - } - return obj.(*v1.Restore), nil -} diff --git a/pkg/generated/listers/velero/v1/schedule.go b/pkg/generated/listers/velero/v1/schedule.go deleted file mode 100644 index 90a262a46..000000000 --- a/pkg/generated/listers/velero/v1/schedule.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ScheduleLister helps list Schedules. -// All objects returned here must be treated as read-only. -type ScheduleLister interface { - // List lists all Schedules in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Schedule, err error) - // Schedules returns an object that can list and get Schedules. - Schedules(namespace string) ScheduleNamespaceLister - ScheduleListerExpansion -} - -// scheduleLister implements the ScheduleLister interface. -type scheduleLister struct { - indexer cache.Indexer -} - -// NewScheduleLister returns a new ScheduleLister. -func NewScheduleLister(indexer cache.Indexer) ScheduleLister { - return &scheduleLister{indexer: indexer} -} - -// List lists all Schedules in the indexer. -func (s *scheduleLister) List(selector labels.Selector) (ret []*v1.Schedule, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Schedule)) - }) - return ret, err -} - -// Schedules returns an object that can list and get Schedules. -func (s *scheduleLister) Schedules(namespace string) ScheduleNamespaceLister { - return scheduleNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ScheduleNamespaceLister helps list and get Schedules. -// All objects returned here must be treated as read-only. -type ScheduleNamespaceLister interface { - // List lists all Schedules in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Schedule, err error) - // Get retrieves the Schedule from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.Schedule, error) - ScheduleNamespaceListerExpansion -} - -// scheduleNamespaceLister implements the ScheduleNamespaceLister -// interface. -type scheduleNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Schedules in the indexer for a given namespace. -func (s scheduleNamespaceLister) List(selector labels.Selector) (ret []*v1.Schedule, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Schedule)) - }) - return ret, err -} - -// Get retrieves the Schedule from the indexer for a given namespace and name. -func (s scheduleNamespaceLister) Get(name string) (*v1.Schedule, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("schedule"), name) - } - return obj.(*v1.Schedule), nil -} diff --git a/pkg/generated/listers/velero/v1/serverstatusrequest.go b/pkg/generated/listers/velero/v1/serverstatusrequest.go deleted file mode 100644 index c03b60c48..000000000 --- a/pkg/generated/listers/velero/v1/serverstatusrequest.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ServerStatusRequestLister helps list ServerStatusRequests. -// All objects returned here must be treated as read-only. -type ServerStatusRequestLister interface { - // List lists all ServerStatusRequests in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.ServerStatusRequest, err error) - // ServerStatusRequests returns an object that can list and get ServerStatusRequests. - ServerStatusRequests(namespace string) ServerStatusRequestNamespaceLister - ServerStatusRequestListerExpansion -} - -// serverStatusRequestLister implements the ServerStatusRequestLister interface. -type serverStatusRequestLister struct { - indexer cache.Indexer -} - -// NewServerStatusRequestLister returns a new ServerStatusRequestLister. -func NewServerStatusRequestLister(indexer cache.Indexer) ServerStatusRequestLister { - return &serverStatusRequestLister{indexer: indexer} -} - -// List lists all ServerStatusRequests in the indexer. -func (s *serverStatusRequestLister) List(selector labels.Selector) (ret []*v1.ServerStatusRequest, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ServerStatusRequest)) - }) - return ret, err -} - -// ServerStatusRequests returns an object that can list and get ServerStatusRequests. -func (s *serverStatusRequestLister) ServerStatusRequests(namespace string) ServerStatusRequestNamespaceLister { - return serverStatusRequestNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ServerStatusRequestNamespaceLister helps list and get ServerStatusRequests. -// All objects returned here must be treated as read-only. -type ServerStatusRequestNamespaceLister interface { - // List lists all ServerStatusRequests in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.ServerStatusRequest, err error) - // Get retrieves the ServerStatusRequest from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.ServerStatusRequest, error) - ServerStatusRequestNamespaceListerExpansion -} - -// serverStatusRequestNamespaceLister implements the ServerStatusRequestNamespaceLister -// interface. -type serverStatusRequestNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ServerStatusRequests in the indexer for a given namespace. -func (s serverStatusRequestNamespaceLister) List(selector labels.Selector) (ret []*v1.ServerStatusRequest, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ServerStatusRequest)) - }) - return ret, err -} - -// Get retrieves the ServerStatusRequest from the indexer for a given namespace and name. -func (s serverStatusRequestNamespaceLister) Get(name string) (*v1.ServerStatusRequest, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("serverstatusrequest"), name) - } - return obj.(*v1.ServerStatusRequest), nil -} diff --git a/pkg/generated/listers/velero/v1/volumesnapshotlocation.go b/pkg/generated/listers/velero/v1/volumesnapshotlocation.go deleted file mode 100644 index 8c8aa432f..000000000 --- a/pkg/generated/listers/velero/v1/volumesnapshotlocation.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VolumeSnapshotLocationLister helps list VolumeSnapshotLocations. -// All objects returned here must be treated as read-only. -type VolumeSnapshotLocationLister interface { - // List lists all VolumeSnapshotLocations in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.VolumeSnapshotLocation, err error) - // VolumeSnapshotLocations returns an object that can list and get VolumeSnapshotLocations. - VolumeSnapshotLocations(namespace string) VolumeSnapshotLocationNamespaceLister - VolumeSnapshotLocationListerExpansion -} - -// volumeSnapshotLocationLister implements the VolumeSnapshotLocationLister interface. -type volumeSnapshotLocationLister struct { - indexer cache.Indexer -} - -// NewVolumeSnapshotLocationLister returns a new VolumeSnapshotLocationLister. -func NewVolumeSnapshotLocationLister(indexer cache.Indexer) VolumeSnapshotLocationLister { - return &volumeSnapshotLocationLister{indexer: indexer} -} - -// List lists all VolumeSnapshotLocations in the indexer. -func (s *volumeSnapshotLocationLister) List(selector labels.Selector) (ret []*v1.VolumeSnapshotLocation, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.VolumeSnapshotLocation)) - }) - return ret, err -} - -// VolumeSnapshotLocations returns an object that can list and get VolumeSnapshotLocations. -func (s *volumeSnapshotLocationLister) VolumeSnapshotLocations(namespace string) VolumeSnapshotLocationNamespaceLister { - return volumeSnapshotLocationNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// VolumeSnapshotLocationNamespaceLister helps list and get VolumeSnapshotLocations. -// All objects returned here must be treated as read-only. -type VolumeSnapshotLocationNamespaceLister interface { - // List lists all VolumeSnapshotLocations in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.VolumeSnapshotLocation, err error) - // Get retrieves the VolumeSnapshotLocation from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.VolumeSnapshotLocation, error) - VolumeSnapshotLocationNamespaceListerExpansion -} - -// volumeSnapshotLocationNamespaceLister implements the VolumeSnapshotLocationNamespaceLister -// interface. -type volumeSnapshotLocationNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VolumeSnapshotLocations in the indexer for a given namespace. -func (s volumeSnapshotLocationNamespaceLister) List(selector labels.Selector) (ret []*v1.VolumeSnapshotLocation, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.VolumeSnapshotLocation)) - }) - return ret, err -} - -// Get retrieves the VolumeSnapshotLocation from the indexer for a given namespace and name. -func (s volumeSnapshotLocationNamespaceLister) Get(name string) (*v1.VolumeSnapshotLocation, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("volumesnapshotlocation"), name) - } - return obj.(*v1.VolumeSnapshotLocation), nil -} diff --git a/pkg/generated/listers/velero/v2alpha1/datadownload.go b/pkg/generated/listers/velero/v2alpha1/datadownload.go deleted file mode 100644 index dadf14b60..000000000 --- a/pkg/generated/listers/velero/v2alpha1/datadownload.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - v2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// DataDownloadLister helps list DataDownloads. -// All objects returned here must be treated as read-only. -type DataDownloadLister interface { - // List lists all DataDownloads in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v2alpha1.DataDownload, err error) - // DataDownloads returns an object that can list and get DataDownloads. - DataDownloads(namespace string) DataDownloadNamespaceLister - DataDownloadListerExpansion -} - -// dataDownloadLister implements the DataDownloadLister interface. -type dataDownloadLister struct { - indexer cache.Indexer -} - -// NewDataDownloadLister returns a new DataDownloadLister. -func NewDataDownloadLister(indexer cache.Indexer) DataDownloadLister { - return &dataDownloadLister{indexer: indexer} -} - -// List lists all DataDownloads in the indexer. -func (s *dataDownloadLister) List(selector labels.Selector) (ret []*v2alpha1.DataDownload, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.DataDownload)) - }) - return ret, err -} - -// DataDownloads returns an object that can list and get DataDownloads. -func (s *dataDownloadLister) DataDownloads(namespace string) DataDownloadNamespaceLister { - return dataDownloadNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// DataDownloadNamespaceLister helps list and get DataDownloads. -// All objects returned here must be treated as read-only. -type DataDownloadNamespaceLister interface { - // List lists all DataDownloads in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v2alpha1.DataDownload, err error) - // Get retrieves the DataDownload from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v2alpha1.DataDownload, error) - DataDownloadNamespaceListerExpansion -} - -// dataDownloadNamespaceLister implements the DataDownloadNamespaceLister -// interface. -type dataDownloadNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all DataDownloads in the indexer for a given namespace. -func (s dataDownloadNamespaceLister) List(selector labels.Selector) (ret []*v2alpha1.DataDownload, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.DataDownload)) - }) - return ret, err -} - -// Get retrieves the DataDownload from the indexer for a given namespace and name. -func (s dataDownloadNamespaceLister) Get(name string) (*v2alpha1.DataDownload, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2alpha1.Resource("datadownload"), name) - } - return obj.(*v2alpha1.DataDownload), nil -} diff --git a/pkg/generated/listers/velero/v2alpha1/dataupload.go b/pkg/generated/listers/velero/v2alpha1/dataupload.go deleted file mode 100644 index 0dbe6bed1..000000000 --- a/pkg/generated/listers/velero/v2alpha1/dataupload.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - v2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// DataUploadLister helps list DataUploads. -// All objects returned here must be treated as read-only. -type DataUploadLister interface { - // List lists all DataUploads in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v2alpha1.DataUpload, err error) - // DataUploads returns an object that can list and get DataUploads. - DataUploads(namespace string) DataUploadNamespaceLister - DataUploadListerExpansion -} - -// dataUploadLister implements the DataUploadLister interface. -type dataUploadLister struct { - indexer cache.Indexer -} - -// NewDataUploadLister returns a new DataUploadLister. -func NewDataUploadLister(indexer cache.Indexer) DataUploadLister { - return &dataUploadLister{indexer: indexer} -} - -// List lists all DataUploads in the indexer. -func (s *dataUploadLister) List(selector labels.Selector) (ret []*v2alpha1.DataUpload, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.DataUpload)) - }) - return ret, err -} - -// DataUploads returns an object that can list and get DataUploads. -func (s *dataUploadLister) DataUploads(namespace string) DataUploadNamespaceLister { - return dataUploadNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// DataUploadNamespaceLister helps list and get DataUploads. -// All objects returned here must be treated as read-only. -type DataUploadNamespaceLister interface { - // List lists all DataUploads in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v2alpha1.DataUpload, err error) - // Get retrieves the DataUpload from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v2alpha1.DataUpload, error) - DataUploadNamespaceListerExpansion -} - -// dataUploadNamespaceLister implements the DataUploadNamespaceLister -// interface. -type dataUploadNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all DataUploads in the indexer for a given namespace. -func (s dataUploadNamespaceLister) List(selector labels.Selector) (ret []*v2alpha1.DataUpload, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.DataUpload)) - }) - return ret, err -} - -// Get retrieves the DataUpload from the indexer for a given namespace and name. -func (s dataUploadNamespaceLister) Get(name string) (*v2alpha1.DataUpload, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2alpha1.Resource("dataupload"), name) - } - return obj.(*v2alpha1.DataUpload), nil -} diff --git a/pkg/generated/listers/velero/v2alpha1/expansion_generated.go b/pkg/generated/listers/velero/v2alpha1/expansion_generated.go deleted file mode 100644 index 1bdb85ec0..000000000 --- a/pkg/generated/listers/velero/v2alpha1/expansion_generated.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright the Velero contributors. - -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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -// DataDownloadListerExpansion allows custom methods to be added to -// DataDownloadLister. -type DataDownloadListerExpansion interface{} - -// DataDownloadNamespaceListerExpansion allows custom methods to be added to -// DataDownloadNamespaceLister. -type DataDownloadNamespaceListerExpansion interface{} - -// DataUploadListerExpansion allows custom methods to be added to -// DataUploadLister. -type DataUploadListerExpansion interface{} - -// DataUploadNamespaceListerExpansion allows custom methods to be added to -// DataUploadNamespaceLister. -type DataUploadNamespaceListerExpansion interface{}