diff --git a/api/database_cluster_backup_test.go b/api/database_cluster_backup_test.go new file mode 100644 index 000000000..88fd8339d --- /dev/null +++ b/api/database_cluster_backup_test.go @@ -0,0 +1,226 @@ +// everest +// Copyright (C) 2023 Percona LLC +// +// 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 api + +import ( + "bytes" + "encoding/json" + "io" + "net/http" + "net/http/httptest" + "testing" + + "github.com/golang-jwt/jwt/v5" + "github.com/labstack/echo/v4" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes/scheme" + + everestv1alpha1 "github.com/percona/everest-operator/api/v1alpha1" + "github.com/percona/everest/pkg/kubernetes" + "github.com/percona/everest/pkg/rbac" + "github.com/percona/everest/pkg/rbac/mocks" + "github.com/percona/everest/pkg/session" +) + +type enforceStrings struct{ subject, resource, action, object string } + +func TestListDBCluster_permissions(t *testing.T) { + t.Parallel() + + err := everestv1alpha1.SchemeBuilder.AddToScheme(scheme.Scheme) + require.NoError(t, err) + metav1.AddToGroupVersion(scheme.Scheme, everestv1alpha1.GroupVersion) + + l := zap.NewNop().Sugar() + + testCases := []struct { + name string + apiCall func(echo.Context, *EverestServer) error + body any + httpMethod string + kubeClient func() kubernetes.KubernetesConnector + proxyResponse any + + expectedEnforce []enforceStrings + }{ + { + name: "List DB cluster backups", + httpMethod: http.MethodGet, + apiCall: func(ctx echo.Context, everest *EverestServer) error { + return everest.ListDatabaseClusterBackups(ctx, "ns", "my-name") + }, + proxyResponse: &everestv1alpha1.DatabaseClusterBackupList{ + TypeMeta: metav1.TypeMeta{ + Kind: "database-cluster-backup-list", + }, + Items: []everestv1alpha1.DatabaseClusterBackup{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "name1", + Namespace: "ns", + }, + Spec: everestv1alpha1.DatabaseClusterBackupSpec{ + DBClusterName: "db-cluster-name", + }, + }, + }, + }, + + expectedEnforce: []enforceStrings{ + {"alice", rbac.ResourceBackupStorages, rbac.ActionRead, "ns/name1"}, + {"alice", rbac.ResourceDatabaseClusterBackups, rbac.ActionRead, "ns/db-cluster-name"}, + }, + }, + { + name: "Get DB cluster backup", + httpMethod: http.MethodGet, + apiCall: func(ctx echo.Context, everest *EverestServer) error { + return everest.GetDatabaseClusterBackup(ctx, "ns", "my-name") + }, + kubeClient: func() kubernetes.KubernetesConnector { + k := kubernetes.NewMockKubernetesConnector(t) + k.EXPECT().GetDatabaseClusterBackup(mock.Anything, mock.Anything, mock.Anything).Return( + &everestv1alpha1.DatabaseClusterBackup{ + TypeMeta: metav1.TypeMeta{ + Kind: "database-cluster-backup", + }, + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns", + Name: "name1", + }, + Spec: everestv1alpha1.DatabaseClusterBackupSpec{ + DBClusterName: "db-cluster-name", + }, + }, nil, + ) + + return k + }, + + expectedEnforce: []enforceStrings{ + {"alice", rbac.ResourceBackupStorages, rbac.ActionRead, "ns/name1"}, + {"alice", rbac.ResourceDatabaseClusterBackups, rbac.ActionRead, "ns/db-cluster-name"}, + }, + }, + { + name: "Create DB cluster backup", + httpMethod: http.MethodPost, + body: &DatabaseClusterBackup{ + Spec: &struct { + BackupStorageName string "json:\"backupStorageName\"" + DbClusterName string "json:\"dbClusterName\"" + }{ + BackupStorageName: "name1", + DbClusterName: "db-cluster-name", + }, + }, + apiCall: func(ctx echo.Context, everest *EverestServer) error { + return everest.CreateDatabaseClusterBackup(ctx, "ns") + }, + proxyResponse: &everestv1alpha1.DatabaseClusterBackup{}, + kubeClient: func() kubernetes.KubernetesConnector { + k := kubernetes.NewMockKubernetesConnector(t) + k.EXPECT().GetDatabaseCluster(mock.Anything, mock.Anything, mock.Anything).Return( + &everestv1alpha1.DatabaseCluster{ + Spec: everestv1alpha1.DatabaseClusterSpec{ + Engine: everestv1alpha1.Engine{ + Type: everestv1alpha1.DatabaseEnginePXC, + }, + }, + }, nil, + ) + k.EXPECT().ListDatabaseClusterBackups(mock.Anything, mock.Anything, mock.Anything).Return( + &everestv1alpha1.DatabaseClusterBackupList{ + Items: []everestv1alpha1.DatabaseClusterBackup{}, + }, nil, + ) + + return k + }, + + expectedEnforce: []enforceStrings{ + {"alice", rbac.ResourceBackupStorages, rbac.ActionRead, "ns/name1"}, + {"alice", rbac.ResourceDatabaseClusterBackups, rbac.ActionCreate, "ns/db-cluster-name"}, + }, + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + + enforcer := &mocks.IEnforcer{} + kp := newMockK8sProxier(t) + if tt.proxyResponse != nil { + kp.EXPECT().proxyKubernetes(mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything). + Run(func( + ctx echo.Context, namespace, kind, name string, + respTransformers ...apiResponseTransformerFn, + ) { + b, err := json.Marshal(tt.proxyResponse) + require.NoError(t, err) + + resp := &http.Response{ + Body: io.NopCloser(bytes.NewReader(b)), + Header: make(http.Header), + } + + modify := modifiersFn(l, respTransformers...) + err = modify(resp) + require.NoError(t, err) + }).Return(nil).Once() + } + + for _, e := range tt.expectedEnforce { + enforcer.EXPECT().Enforce(e.subject, e.resource, e.action, e.object).Return(true, nil) + } + + everest := &EverestServer{ + rbacEnforcer: enforcer, + l: l, + k8sProxier: kp, + } + if tt.kubeClient != nil { + everest.kubeClient = tt.kubeClient() + } + + var body io.Reader + if tt.body != nil { + b, err := json.Marshal(tt.body) + require.NoError(t, err) + body = bytes.NewReader(b) + } + + req, err := http.NewRequest(tt.httpMethod, "/", body) + require.NoError(t, err) + req.Header.Set(echo.HeaderContentType, echo.MIMEApplicationJSON) + rec := httptest.NewRecorder() + e := echo.New() + c := e.NewContext(req, rec) + claims := make(jwt.MapClaims) + claims["sub"] = "alice" + claims["iss"] = session.SessionManagerClaimsIssuer + + c.Set("user", &jwt.Token{Claims: claims}) + + err = tt.apiCall(c, everest) + require.NoError(t, err) + }) + } +} diff --git a/api/everest.go b/api/everest.go index 7724a748c..ae7840ecd 100644 --- a/api/everest.go +++ b/api/everest.go @@ -56,7 +56,8 @@ type EverestServer struct { config *config.EverestConfig l *zap.SugaredLogger echo *echo.Echo - kubeClient *kubernetes.Kubernetes + k8sProxier k8sProxier + kubeClient kubernetes.KubernetesConnector sessionMgr *session.Manager attemptsStore *RateLimiterMemoryStore rbacEnforcer casbin.IEnforcer @@ -80,9 +81,13 @@ func NewEverestServer(ctx context.Context, c *config.EverestConfig, l *zap.Sugar return nil, errors.Join(err, errors.New("failed to create session manager")) } e := &EverestServer{ - config: c, - l: l, - echo: echoServer, + config: c, + l: l, + echo: echoServer, + k8sProxier: &k8sProxy{ + kubeClient: kubeClient, + l: l, + }, kubeClient: kubeClient, sessionMgr: sessMgr, attemptsStore: store, diff --git a/api/gen.go b/api/gen.go new file mode 100644 index 000000000..86ef7796c --- /dev/null +++ b/api/gen.go @@ -0,0 +1,18 @@ +// everest +// Copyright (C) 2023 Percona LLC +// +// 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 api + +//go:generate ../bin/mockery --name=k8sProxier --case=snake --inpackage --with-expecter=true diff --git a/api/kubernetes.go b/api/kubernetes.go index 0e56c323e..6c38d2a79 100644 --- a/api/kubernetes.go +++ b/api/kubernetes.go @@ -57,7 +57,7 @@ func (e *EverestServer) GetKubernetesClusterResources(ctx echo.Context) error { } func (e *EverestServer) calculateClusterResources( - ctx echo.Context, kubeClient *kubernetes.Kubernetes, clusterType kubernetes.ClusterType, + ctx echo.Context, kubeClient kubernetes.KubernetesConnector, clusterType kubernetes.ClusterType, volumes *corev1.PersistentVolumeList, ) (*KubernetesClusterResources, error) { allCPUMillis, allMemoryBytes, allDiskBytes, err := kubeClient.GetAllClusterResources( diff --git a/api/mock_k8s_proxier.go b/api/mock_k8s_proxier.go new file mode 100644 index 000000000..140b544e3 --- /dev/null +++ b/api/mock_k8s_proxier.go @@ -0,0 +1,100 @@ +// Code generated by mockery v2.46.2. DO NOT EDIT. + +package api + +import ( + echo "github.com/labstack/echo/v4" + mock "github.com/stretchr/testify/mock" +) + +// mockK8sProxier is an autogenerated mock type for the k8sProxier type +type mockK8sProxier struct { + mock.Mock +} + +type mockK8sProxier_Expecter struct { + mock *mock.Mock +} + +func (_m *mockK8sProxier) EXPECT() *mockK8sProxier_Expecter { + return &mockK8sProxier_Expecter{mock: &_m.Mock} +} + +// proxyKubernetes provides a mock function with given fields: ctx, namespace, kind, name, respTransformers +func (_m *mockK8sProxier) proxyKubernetes(ctx echo.Context, namespace string, kind string, name string, respTransformers ...apiResponseTransformerFn) error { + _va := make([]interface{}, len(respTransformers)) + for _i := range respTransformers { + _va[_i] = respTransformers[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, namespace, kind, name) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for proxyKubernetes") + } + + var r0 error + if rf, ok := ret.Get(0).(func(echo.Context, string, string, string, ...apiResponseTransformerFn) error); ok { + r0 = rf(ctx, namespace, kind, name, respTransformers...) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// mockK8sProxier_proxyKubernetes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'proxyKubernetes' +type mockK8sProxier_proxyKubernetes_Call struct { + *mock.Call +} + +// proxyKubernetes is a helper method to define mock.On call +// - ctx echo.Context +// - namespace string +// - kind string +// - name string +// - respTransformers ...apiResponseTransformerFn +func (_e *mockK8sProxier_Expecter) proxyKubernetes(ctx interface{}, namespace interface{}, kind interface{}, name interface{}, respTransformers ...interface{}) *mockK8sProxier_proxyKubernetes_Call { + return &mockK8sProxier_proxyKubernetes_Call{Call: _e.mock.On("proxyKubernetes", + append([]interface{}{ctx, namespace, kind, name}, respTransformers...)...)} +} + +func (_c *mockK8sProxier_proxyKubernetes_Call) Run(run func(ctx echo.Context, namespace string, kind string, name string, respTransformers ...apiResponseTransformerFn)) *mockK8sProxier_proxyKubernetes_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]apiResponseTransformerFn, len(args)-4) + for i, a := range args[4:] { + if a != nil { + variadicArgs[i] = a.(apiResponseTransformerFn) + } + } + run(args[0].(echo.Context), args[1].(string), args[2].(string), args[3].(string), variadicArgs...) + }) + return _c +} + +func (_c *mockK8sProxier_proxyKubernetes_Call) Return(_a0 error) *mockK8sProxier_proxyKubernetes_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *mockK8sProxier_proxyKubernetes_Call) RunAndReturn(run func(echo.Context, string, string, string, ...apiResponseTransformerFn) error) *mockK8sProxier_proxyKubernetes_Call { + _c.Call.Return(run) + return _c +} + +// newMockK8sProxier creates a new instance of mockK8sProxier. 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 newMockK8sProxier(t interface { + mock.TestingT + Cleanup(func()) +}, +) *mockK8sProxier { + mock := &mockK8sProxier{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/api/proxy.go b/api/proxy.go index 46a32e633..380b7c440 100644 --- a/api/proxy.go +++ b/api/proxy.go @@ -34,6 +34,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/client-go/rest" + + "github.com/percona/everest/pkg/kubernetes" ) var ( @@ -56,14 +58,32 @@ var ( type apiResponseTransformerFn func(in []byte) ([]byte, error) +type k8sProxy struct { + kubeClient *kubernetes.Kubernetes + l *zap.SugaredLogger +} + +type k8sProxier interface { + proxyKubernetes( + ctx echo.Context, namespace, kind, name string, + respTransformers ...apiResponseTransformerFn, + ) error +} + +var _ k8sProxier = &k8sProxy{} // Check interface. + func (e *EverestServer) proxyKubernetes( - ctx echo.Context, - namespace, - kind, - name string, + ctx echo.Context, namespace, kind, name string, + respTransformers ...apiResponseTransformerFn, +) error { + return e.k8sProxier.proxyKubernetes(ctx, namespace, kind, name, respTransformers...) +} + +func (k *k8sProxy) proxyKubernetes( + ctx echo.Context, namespace, kind, name string, respTransformers ...apiResponseTransformerFn, ) error { - config := e.kubeClient.Config() + config := k.kubeClient.Config() reverseProxy := httputil.NewSingleHostReverseProxy( &url.URL{ Host: strings.TrimPrefix(config.Host, "https://"), @@ -71,21 +91,35 @@ func (e *EverestServer) proxyKubernetes( }) transport, err := rest.TransportFor(config) if err != nil { - e.l.Error(err) + k.l.Error(err) return ctx.JSON(http.StatusBadRequest, Error{ Message: pointer.ToString("Could not create REST transport"), }) } reverseProxy.Transport = transport - reverseProxy.ErrorHandler = everestErrorHandler(e.l) + reverseProxy.ErrorHandler = everestErrorHandler(k.l) + reverseProxy.ModifyResponse = modifiersFn(k.l, respTransformers...) + req := ctx.Request() + // All requests to Everest are protected by authorization. + // We need to remove the header, otherwise Kubernetes returns 401 unauthorized response. + req.Header.Del("Authorization") + if namespace == "" { + namespace = k.kubeClient.Namespace() + } + req.URL.Path = buildProxiedURL(namespace, kind, name) + reverseProxy.ServeHTTP(ctx.Response(), req) + return nil +} + +func modifiersFn(l *zap.SugaredLogger, respTransformers ...apiResponseTransformerFn) func(resp *http.Response) error { modifiers := make([]func(*http.Response) error, 0, len(respTransformers)+1) - modifiers = append(modifiers, everestResponseModifier(e.l)) //nolint:bodyclose + modifiers = append(modifiers, everestResponseModifier(l)) //nolint:bodyclose for _, fn := range respTransformers { modifiers = append(modifiers, func(r *http.Response) error { //nolint:bodyclose - return runResponseModifier(r, e.l, fn) + return runResponseModifier(r, l, fn) }) } - reverseProxy.ModifyResponse = func(resp *http.Response) error { + return func(resp *http.Response) error { for _, fn := range modifiers { if err := fn(resp); err != nil { return err @@ -93,16 +127,6 @@ func (e *EverestServer) proxyKubernetes( } return nil } - req := ctx.Request() - // All requests to Everest are protected by authorization. - // We need to remove the header, otherwise Kubernetes returns 401 unauthorized response. - req.Header.Del("Authorization") - if namespace == "" { - namespace = e.kubeClient.Namespace() - } - req.URL.Path = buildProxiedURL(namespace, kind, name) - reverseProxy.ServeHTTP(ctx.Response(), req) - return nil } func buildProxiedURL(namespace, kind, name string) string { diff --git a/api/validation.go b/api/validation.go index 319bd785b..16ae038a5 100644 --- a/api/validation.go +++ b/api/validation.go @@ -1334,7 +1334,7 @@ func (e *EverestServer) validateDatabaseClusterBackup(ctx context.Context, names return nil } -func validatePGReposForBackup(ctx context.Context, db everestv1alpha1.DatabaseCluster, kubeClient *kubernetes.Kubernetes, newBackup everestv1alpha1.DatabaseClusterBackup) error { +func validatePGReposForBackup(ctx context.Context, db everestv1alpha1.DatabaseCluster, kubeClient kubernetes.KubernetesConnector, newBackup everestv1alpha1.DatabaseClusterBackup) error { if db.Spec.Engine.Type != everestv1alpha1.DatabaseEnginePostgresql { return nil } @@ -1365,7 +1365,7 @@ func validatePGReposForBackup(ctx context.Context, db everestv1alpha1.DatabaseCl return nil } -func validateDatabaseClusterRestore(ctx context.Context, namespace string, restore *DatabaseClusterRestore, kubeClient *kubernetes.Kubernetes) error { +func validateDatabaseClusterRestore(ctx context.Context, namespace string, restore *DatabaseClusterRestore, kubeClient kubernetes.KubernetesConnector) error { if restore == nil { return errors.New("restore cannot be empty") } diff --git a/pkg/kubernetes/gen.go b/pkg/kubernetes/gen.go index bf85cbd34..b531e7a0d 100644 --- a/pkg/kubernetes/gen.go +++ b/pkg/kubernetes/gen.go @@ -15,5 +15,5 @@ package kubernetes -//go:generate ../../bin/ifacemaker -f accounts.go -f backup_storage.go -f configmap.go -f database_engine.go -f deployment.go -f install_plan.go -f kubernetes.go -f monitoring_config.go -f namespace.go -f operator.go -f jwt.go -f oidc.go -f secret.go -s Kubernetes -i KubernetesConnector -p kubernetes -o kubernetes_interface.go -//go:generate ../../bin/mockery --name=KubernetesConnector --case=snake --inpackage +//go:generate ../../bin/ifacemaker -f accounts.go -f backup_storage.go -f configmap.go -f container.go -f database_cluster_backup.go -f database_cluster_restore.go -f database_cluster.go -f database_engine.go -f deployment.go -f install_plan.go -f jwt.go -f kubernetes.go -f monitoring_config.go -f namespace.go -f node.go -f oidc.go -f operator.go -f pod.go -f resources.go -f role.go -f secret.go -f service_account.go -f storage.go -s Kubernetes -i KubernetesConnector -p kubernetes -o kubernetes_interface.go +//go:generate ../../bin/mockery --name=KubernetesConnector --case=snake --inpackage --with-expecter=true diff --git a/pkg/kubernetes/kubernetes_interface.go b/pkg/kubernetes/kubernetes_interface.go index fe322682f..478c16aa6 100644 --- a/pkg/kubernetes/kubernetes_interface.go +++ b/pkg/kubernetes/kubernetes_interface.go @@ -9,6 +9,8 @@ import ( olmv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + rbac "k8s.io/api/rbac/v1" + storagev1 "k8s.io/api/storage/v1" apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -47,6 +49,30 @@ type KubernetesConnector interface { IsBackupStorageUsed(ctx context.Context, namespace, name string) (bool, error) // GetConfigMap returns k8s configmap by provided name and namespace. GetConfigMap(ctx context.Context, namespace, name string) (*corev1.ConfigMap, error) + // GetDatabaseClusterBackup returns database cluster backup by name. + GetDatabaseClusterBackup(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseClusterBackup, error) + // ListDatabaseClusterBackups returns database cluster backups. + ListDatabaseClusterBackups(ctx context.Context, namespace string, options metav1.ListOptions) (*everestv1alpha1.DatabaseClusterBackupList, error) + // UpdateDatabaseClusterBackup updates database cluster backup. + UpdateDatabaseClusterBackup(ctx context.Context, backup *everestv1alpha1.DatabaseClusterBackup) (*everestv1alpha1.DatabaseClusterBackup, error) + // GetDatabaseClusterRestore returns database cluster restore by name. + GetDatabaseClusterRestore(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseClusterRestore, error) + // ListDatabaseClusterRestores returns database cluster restores. + ListDatabaseClusterRestores(ctx context.Context, namespace string, options metav1.ListOptions) (*everestv1alpha1.DatabaseClusterRestoreList, error) + // ListDatabaseClusters returns list of managed database clusters. + ListDatabaseClusters(ctx context.Context, namespace string) (*everestv1alpha1.DatabaseClusterList, error) + // GetDatabaseCluster returns database clusters by provided name. + GetDatabaseCluster(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseCluster, error) + // DeleteDatabaseClusters deletes all database clusters in provided namespace. + // This function will wait until all clusters are deleted. + DeleteDatabaseClusters(ctx context.Context, namespace string) error + // PatchDatabaseCluster patches CR of managed Database cluster. + PatchDatabaseCluster(cluster *everestv1alpha1.DatabaseCluster) error + // DeleteDatabaseCluster deletes database cluster. + DeleteDatabaseCluster(ctx context.Context, namespace, name string) error + // DatabasesExist checks if databases exist in provided at least one of the provided namespaces. + // If namespaces are not provided, it checks in all namespaces. + DatabasesExist(ctx context.Context, namespaces ...string) (bool, error) // ListDatabaseEngines returns list of managed database clusters. ListDatabaseEngines(ctx context.Context, namespace string) (*everestv1alpha1.DatabaseEngineList, error) // GetDatabaseEngine returns database clusters by provided name. @@ -66,6 +92,8 @@ type KubernetesConnector interface { DeleteDeployment(ctx context.Context, name, namespace string) error // ApproveInstallPlan approves an install plan. ApproveInstallPlan(ctx context.Context, namespace, installPlanName string) (bool, error) + // CreateRSAKeyPair creates a new RSA key pair and stores it in a secret. + CreateRSAKeyPair(ctx context.Context) error // Kubeconfig returns the path to the kubeconfig. Kubeconfig() string // Config returns *rest.Config. @@ -140,14 +168,31 @@ type KubernetesConnector interface { ListNamespaces(ctx context.Context, opts metav1.ListOptions) (*corev1.NamespaceList, error) // UpdateNamespace updates the given namespace. UpdateNamespace(ctx context.Context, namespace *corev1.Namespace, opts metav1.UpdateOptions) (*corev1.Namespace, error) - // OperatorInstalledVersion returns the installed version of operator by name. - OperatorInstalledVersion(ctx context.Context, namespace, name string) (*goversion.Version, error) - // CreateRSAKeyPair creates a new RSA key pair and stores it in a secret. - CreateRSAKeyPair(ctx context.Context) error + // GetWorkerNodes returns list of cluster workers nodes. + GetWorkerNodes(ctx context.Context) ([]corev1.Node, error) // UpdateEverestSettings accepts the full list of Everest settings and updates the settings. UpdateEverestSettings(ctx context.Context, settings common.EverestSettings) error // GetEverestSettings returns Everest settings. GetEverestSettings(ctx context.Context) (common.EverestSettings, error) + // OperatorInstalledVersion returns the installed version of operator by name. + OperatorInstalledVersion(ctx context.Context, namespace, name string) (*goversion.Version, error) + // GetPods returns list of pods. + GetPods(ctx context.Context, namespace string, labelSelector *metav1.LabelSelector) (*corev1.PodList, error) + // GetAllClusterResources goes through all cluster nodes and sums their allocatable resources. + GetAllClusterResources(ctx context.Context, clusterType ClusterType, volumes *corev1.PersistentVolumeList) (uint64, uint64, uint64, error) + // GetConsumedCPUAndMemory returns consumed CPU and Memory in given namespace. If namespace + // is empty, it tries to get them from all namespaces. + GetConsumedCPUAndMemory(ctx context.Context, namespace string) (cpuMillis uint64, memoryBytes uint64, err error) + // GetConsumedDiskBytes returns consumed bytes. The strategy differs based on k8s cluster type. + GetConsumedDiskBytes(_ context.Context, clusterType ClusterType, volumes *corev1.PersistentVolumeList) (uint64, error) + // CreateRole creates a new role. + CreateRole(namespace, name string, rules []rbac.PolicyRule) error + // CreateRoleBinding binds a role to a service account. + CreateRoleBinding(namespace, name, roleName, serviceAccountName string) error + // CreateClusterRole creates a new cluster role. + CreateClusterRole(name string, rules []rbac.PolicyRule) error + // CreateClusterRoleBinding binds a cluster role to a service account. + CreateClusterRoleBinding(namespace, name, roleName, serviceAccountName string) error // ListSecrets returns secret by name. ListSecrets(ctx context.Context, namespace string) (*corev1.SecretList, error) // GetSecret returns a secret by name. @@ -160,4 +205,12 @@ type KubernetesConnector interface { UpdateSecret(ctx context.Context, secret *corev1.Secret) (*corev1.Secret, error) // DeleteSecret deletes a secret. DeleteSecret(ctx context.Context, namespace, name string) error + // CreateServiceAccount creates a new service account. + CreateServiceAccount(name, namespace string) error + // CreateServiceAccountToken creates a new secret with service account token. + CreateServiceAccountToken(serviceAccountName, secretName, namespace string) error + // GetPersistentVolumes returns list of persistent volumes. + GetPersistentVolumes(ctx context.Context) (*corev1.PersistentVolumeList, error) + // GetStorageClasses returns list of storage classes. + GetStorageClasses(ctx context.Context) (*storagev1.StorageClassList, error) } diff --git a/pkg/kubernetes/mock_kubernetes_connector.go b/pkg/kubernetes/mock_kubernetes_connector.go index ddffb2344..af112363a 100644 --- a/pkg/kubernetes/mock_kubernetes_connector.go +++ b/pkg/kubernetes/mock_kubernetes_connector.go @@ -9,7 +9,9 @@ import ( operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1" mock "github.com/stretchr/testify/mock" appsv1 "k8s.io/api/apps/v1" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/api/rbac/v1" + storagev1 "k8s.io/api/storage/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -27,6 +29,14 @@ type MockKubernetesConnector struct { mock.Mock } +type MockKubernetesConnector_Expecter struct { + mock *mock.Mock +} + +func (_m *MockKubernetesConnector) EXPECT() *MockKubernetesConnector_Expecter { + return &MockKubernetesConnector_Expecter{mock: &_m.Mock} +} + // Accounts provides a mock function with given fields: func (_m *MockKubernetesConnector) Accounts() accounts.Interface { ret := _m.Called() @@ -47,6 +57,33 @@ func (_m *MockKubernetesConnector) Accounts() accounts.Interface { return r0 } +// MockKubernetesConnector_Accounts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Accounts' +type MockKubernetesConnector_Accounts_Call struct { + *mock.Call +} + +// Accounts is a helper method to define mock.On call +func (_e *MockKubernetesConnector_Expecter) Accounts() *MockKubernetesConnector_Accounts_Call { + return &MockKubernetesConnector_Accounts_Call{Call: _e.mock.On("Accounts")} +} + +func (_c *MockKubernetesConnector_Accounts_Call) Run(run func()) *MockKubernetesConnector_Accounts_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockKubernetesConnector_Accounts_Call) Return(_a0 accounts.Interface) *MockKubernetesConnector_Accounts_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_Accounts_Call) RunAndReturn(run func() accounts.Interface) *MockKubernetesConnector_Accounts_Call { + _c.Call.Return(run) + return _c +} + // ApplyManifestFile provides a mock function with given fields: files, namespace func (_m *MockKubernetesConnector) ApplyManifestFile(files []byte, namespace string) error { ret := _m.Called(files, namespace) @@ -65,6 +102,35 @@ func (_m *MockKubernetesConnector) ApplyManifestFile(files []byte, namespace str return r0 } +// MockKubernetesConnector_ApplyManifestFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyManifestFile' +type MockKubernetesConnector_ApplyManifestFile_Call struct { + *mock.Call +} + +// ApplyManifestFile is a helper method to define mock.On call +// - files []byte +// - namespace string +func (_e *MockKubernetesConnector_Expecter) ApplyManifestFile(files interface{}, namespace interface{}) *MockKubernetesConnector_ApplyManifestFile_Call { + return &MockKubernetesConnector_ApplyManifestFile_Call{Call: _e.mock.On("ApplyManifestFile", files, namespace)} +} + +func (_c *MockKubernetesConnector_ApplyManifestFile_Call) Run(run func(files []byte, namespace string)) *MockKubernetesConnector_ApplyManifestFile_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]byte), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_ApplyManifestFile_Call) Return(_a0 error) *MockKubernetesConnector_ApplyManifestFile_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_ApplyManifestFile_Call) RunAndReturn(run func([]byte, string) error) *MockKubernetesConnector_ApplyManifestFile_Call { + _c.Call.Return(run) + return _c +} + // ApproveInstallPlan provides a mock function with given fields: ctx, namespace, installPlanName func (_m *MockKubernetesConnector) ApproveInstallPlan(ctx context.Context, namespace string, installPlanName string) (bool, error) { ret := _m.Called(ctx, namespace, installPlanName) @@ -93,6 +159,36 @@ func (_m *MockKubernetesConnector) ApproveInstallPlan(ctx context.Context, names return r0, r1 } +// MockKubernetesConnector_ApproveInstallPlan_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApproveInstallPlan' +type MockKubernetesConnector_ApproveInstallPlan_Call struct { + *mock.Call +} + +// ApproveInstallPlan is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - installPlanName string +func (_e *MockKubernetesConnector_Expecter) ApproveInstallPlan(ctx interface{}, namespace interface{}, installPlanName interface{}) *MockKubernetesConnector_ApproveInstallPlan_Call { + return &MockKubernetesConnector_ApproveInstallPlan_Call{Call: _e.mock.On("ApproveInstallPlan", ctx, namespace, installPlanName)} +} + +func (_c *MockKubernetesConnector_ApproveInstallPlan_Call) Run(run func(ctx context.Context, namespace string, installPlanName string)) *MockKubernetesConnector_ApproveInstallPlan_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_ApproveInstallPlan_Call) Return(_a0 bool, _a1 error) *MockKubernetesConnector_ApproveInstallPlan_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_ApproveInstallPlan_Call) RunAndReturn(run func(context.Context, string, string) (bool, error)) *MockKubernetesConnector_ApproveInstallPlan_Call { + _c.Call.Return(run) + return _c +} + // ClusterName provides a mock function with given fields: func (_m *MockKubernetesConnector) ClusterName() string { ret := _m.Called() @@ -111,6 +207,33 @@ func (_m *MockKubernetesConnector) ClusterName() string { return r0 } +// MockKubernetesConnector_ClusterName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClusterName' +type MockKubernetesConnector_ClusterName_Call struct { + *mock.Call +} + +// ClusterName is a helper method to define mock.On call +func (_e *MockKubernetesConnector_Expecter) ClusterName() *MockKubernetesConnector_ClusterName_Call { + return &MockKubernetesConnector_ClusterName_Call{Call: _e.mock.On("ClusterName")} +} + +func (_c *MockKubernetesConnector_ClusterName_Call) Run(run func()) *MockKubernetesConnector_ClusterName_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockKubernetesConnector_ClusterName_Call) Return(_a0 string) *MockKubernetesConnector_ClusterName_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_ClusterName_Call) RunAndReturn(run func() string) *MockKubernetesConnector_ClusterName_Call { + _c.Call.Return(run) + return _c +} + // Config provides a mock function with given fields: func (_m *MockKubernetesConnector) Config() *rest.Config { ret := _m.Called() @@ -131,6 +254,33 @@ func (_m *MockKubernetesConnector) Config() *rest.Config { return r0 } +// MockKubernetesConnector_Config_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Config' +type MockKubernetesConnector_Config_Call struct { + *mock.Call +} + +// Config is a helper method to define mock.On call +func (_e *MockKubernetesConnector_Expecter) Config() *MockKubernetesConnector_Config_Call { + return &MockKubernetesConnector_Config_Call{Call: _e.mock.On("Config")} +} + +func (_c *MockKubernetesConnector_Config_Call) Run(run func()) *MockKubernetesConnector_Config_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockKubernetesConnector_Config_Call) Return(_a0 *rest.Config) *MockKubernetesConnector_Config_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_Config_Call) RunAndReturn(run func() *rest.Config) *MockKubernetesConnector_Config_Call { + _c.Call.Return(run) + return _c +} + // CreateBackupStorage provides a mock function with given fields: ctx, storage func (_m *MockKubernetesConnector) CreateBackupStorage(ctx context.Context, storage *v1alpha1.BackupStorage) error { ret := _m.Called(ctx, storage) @@ -149,6 +299,131 @@ func (_m *MockKubernetesConnector) CreateBackupStorage(ctx context.Context, stor return r0 } +// MockKubernetesConnector_CreateBackupStorage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateBackupStorage' +type MockKubernetesConnector_CreateBackupStorage_Call struct { + *mock.Call +} + +// CreateBackupStorage is a helper method to define mock.On call +// - ctx context.Context +// - storage *v1alpha1.BackupStorage +func (_e *MockKubernetesConnector_Expecter) CreateBackupStorage(ctx interface{}, storage interface{}) *MockKubernetesConnector_CreateBackupStorage_Call { + return &MockKubernetesConnector_CreateBackupStorage_Call{Call: _e.mock.On("CreateBackupStorage", ctx, storage)} +} + +func (_c *MockKubernetesConnector_CreateBackupStorage_Call) Run(run func(ctx context.Context, storage *v1alpha1.BackupStorage)) *MockKubernetesConnector_CreateBackupStorage_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*v1alpha1.BackupStorage)) + }) + return _c +} + +func (_c *MockKubernetesConnector_CreateBackupStorage_Call) Return(_a0 error) *MockKubernetesConnector_CreateBackupStorage_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_CreateBackupStorage_Call) RunAndReturn(run func(context.Context, *v1alpha1.BackupStorage) error) *MockKubernetesConnector_CreateBackupStorage_Call { + _c.Call.Return(run) + return _c +} + +// CreateClusterRole provides a mock function with given fields: name, rules +func (_m *MockKubernetesConnector) CreateClusterRole(name string, rules []v1.PolicyRule) error { + ret := _m.Called(name, rules) + + if len(ret) == 0 { + panic("no return value specified for CreateClusterRole") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, []v1.PolicyRule) error); ok { + r0 = rf(name, rules) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockKubernetesConnector_CreateClusterRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateClusterRole' +type MockKubernetesConnector_CreateClusterRole_Call struct { + *mock.Call +} + +// CreateClusterRole is a helper method to define mock.On call +// - name string +// - rules []v1.PolicyRule +func (_e *MockKubernetesConnector_Expecter) CreateClusterRole(name interface{}, rules interface{}) *MockKubernetesConnector_CreateClusterRole_Call { + return &MockKubernetesConnector_CreateClusterRole_Call{Call: _e.mock.On("CreateClusterRole", name, rules)} +} + +func (_c *MockKubernetesConnector_CreateClusterRole_Call) Run(run func(name string, rules []v1.PolicyRule)) *MockKubernetesConnector_CreateClusterRole_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([]v1.PolicyRule)) + }) + return _c +} + +func (_c *MockKubernetesConnector_CreateClusterRole_Call) Return(_a0 error) *MockKubernetesConnector_CreateClusterRole_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_CreateClusterRole_Call) RunAndReturn(run func(string, []v1.PolicyRule) error) *MockKubernetesConnector_CreateClusterRole_Call { + _c.Call.Return(run) + return _c +} + +// CreateClusterRoleBinding provides a mock function with given fields: namespace, name, roleName, serviceAccountName +func (_m *MockKubernetesConnector) CreateClusterRoleBinding(namespace string, name string, roleName string, serviceAccountName string) error { + ret := _m.Called(namespace, name, roleName, serviceAccountName) + + if len(ret) == 0 { + panic("no return value specified for CreateClusterRoleBinding") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, string, string, string) error); ok { + r0 = rf(namespace, name, roleName, serviceAccountName) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockKubernetesConnector_CreateClusterRoleBinding_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateClusterRoleBinding' +type MockKubernetesConnector_CreateClusterRoleBinding_Call struct { + *mock.Call +} + +// CreateClusterRoleBinding is a helper method to define mock.On call +// - namespace string +// - name string +// - roleName string +// - serviceAccountName string +func (_e *MockKubernetesConnector_Expecter) CreateClusterRoleBinding(namespace interface{}, name interface{}, roleName interface{}, serviceAccountName interface{}) *MockKubernetesConnector_CreateClusterRoleBinding_Call { + return &MockKubernetesConnector_CreateClusterRoleBinding_Call{Call: _e.mock.On("CreateClusterRoleBinding", namespace, name, roleName, serviceAccountName)} +} + +func (_c *MockKubernetesConnector_CreateClusterRoleBinding_Call) Run(run func(namespace string, name string, roleName string, serviceAccountName string)) *MockKubernetesConnector_CreateClusterRoleBinding_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(string), args[3].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_CreateClusterRoleBinding_Call) Return(_a0 error) *MockKubernetesConnector_CreateClusterRoleBinding_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_CreateClusterRoleBinding_Call) RunAndReturn(run func(string, string, string, string) error) *MockKubernetesConnector_CreateClusterRoleBinding_Call { + _c.Call.Return(run) + return _c +} + // CreateMonitoringConfig provides a mock function with given fields: ctx, storage func (_m *MockKubernetesConnector) CreateMonitoringConfig(ctx context.Context, storage *v1alpha1.MonitoringConfig) error { ret := _m.Called(ctx, storage) @@ -167,8 +442,37 @@ func (_m *MockKubernetesConnector) CreateMonitoringConfig(ctx context.Context, s return r0 } +// MockKubernetesConnector_CreateMonitoringConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateMonitoringConfig' +type MockKubernetesConnector_CreateMonitoringConfig_Call struct { + *mock.Call +} + +// CreateMonitoringConfig is a helper method to define mock.On call +// - ctx context.Context +// - storage *v1alpha1.MonitoringConfig +func (_e *MockKubernetesConnector_Expecter) CreateMonitoringConfig(ctx interface{}, storage interface{}) *MockKubernetesConnector_CreateMonitoringConfig_Call { + return &MockKubernetesConnector_CreateMonitoringConfig_Call{Call: _e.mock.On("CreateMonitoringConfig", ctx, storage)} +} + +func (_c *MockKubernetesConnector_CreateMonitoringConfig_Call) Run(run func(ctx context.Context, storage *v1alpha1.MonitoringConfig)) *MockKubernetesConnector_CreateMonitoringConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*v1alpha1.MonitoringConfig)) + }) + return _c +} + +func (_c *MockKubernetesConnector_CreateMonitoringConfig_Call) Return(_a0 error) *MockKubernetesConnector_CreateMonitoringConfig_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_CreateMonitoringConfig_Call) RunAndReturn(run func(context.Context, *v1alpha1.MonitoringConfig) error) *MockKubernetesConnector_CreateMonitoringConfig_Call { + _c.Call.Return(run) + return _c +} + // CreateNamespace provides a mock function with given fields: ctx, namespace -func (_m *MockKubernetesConnector) CreateNamespace(ctx context.Context, namespace *v1.Namespace) error { +func (_m *MockKubernetesConnector) CreateNamespace(ctx context.Context, namespace *corev1.Namespace) error { ret := _m.Called(ctx, namespace) if len(ret) == 0 { @@ -176,7 +480,7 @@ func (_m *MockKubernetesConnector) CreateNamespace(ctx context.Context, namespac } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.Namespace) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, *corev1.Namespace) error); ok { r0 = rf(ctx, namespace) } else { r0 = ret.Error(0) @@ -185,6 +489,35 @@ func (_m *MockKubernetesConnector) CreateNamespace(ctx context.Context, namespac return r0 } +// MockKubernetesConnector_CreateNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateNamespace' +type MockKubernetesConnector_CreateNamespace_Call struct { + *mock.Call +} + +// CreateNamespace is a helper method to define mock.On call +// - ctx context.Context +// - namespace *corev1.Namespace +func (_e *MockKubernetesConnector_Expecter) CreateNamespace(ctx interface{}, namespace interface{}) *MockKubernetesConnector_CreateNamespace_Call { + return &MockKubernetesConnector_CreateNamespace_Call{Call: _e.mock.On("CreateNamespace", ctx, namespace)} +} + +func (_c *MockKubernetesConnector_CreateNamespace_Call) Run(run func(ctx context.Context, namespace *corev1.Namespace)) *MockKubernetesConnector_CreateNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*corev1.Namespace)) + }) + return _c +} + +func (_c *MockKubernetesConnector_CreateNamespace_Call) Return(_a0 error) *MockKubernetesConnector_CreateNamespace_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_CreateNamespace_Call) RunAndReturn(run func(context.Context, *corev1.Namespace) error) *MockKubernetesConnector_CreateNamespace_Call { + _c.Call.Return(run) + return _c +} + // CreateRSAKeyPair provides a mock function with given fields: ctx func (_m *MockKubernetesConnector) CreateRSAKeyPair(ctx context.Context) error { ret := _m.Called(ctx) @@ -203,47 +536,45 @@ func (_m *MockKubernetesConnector) CreateRSAKeyPair(ctx context.Context) error { return r0 } -// CreateSecret provides a mock function with given fields: ctx, secret -func (_m *MockKubernetesConnector) CreateSecret(ctx context.Context, secret *v1.Secret) (*v1.Secret, error) { - ret := _m.Called(ctx, secret) +// MockKubernetesConnector_CreateRSAKeyPair_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateRSAKeyPair' +type MockKubernetesConnector_CreateRSAKeyPair_Call struct { + *mock.Call +} - if len(ret) == 0 { - panic("no return value specified for CreateSecret") - } +// CreateRSAKeyPair is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockKubernetesConnector_Expecter) CreateRSAKeyPair(ctx interface{}) *MockKubernetesConnector_CreateRSAKeyPair_Call { + return &MockKubernetesConnector_CreateRSAKeyPair_Call{Call: _e.mock.On("CreateRSAKeyPair", ctx)} +} - var r0 *v1.Secret - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.Secret) (*v1.Secret, error)); ok { - return rf(ctx, secret) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.Secret) *v1.Secret); ok { - r0 = rf(ctx, secret) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Secret) - } - } +func (_c *MockKubernetesConnector_CreateRSAKeyPair_Call) Run(run func(ctx context.Context)) *MockKubernetesConnector_CreateRSAKeyPair_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} - if rf, ok := ret.Get(1).(func(context.Context, *v1.Secret) error); ok { - r1 = rf(ctx, secret) - } else { - r1 = ret.Error(1) - } +func (_c *MockKubernetesConnector_CreateRSAKeyPair_Call) Return(_a0 error) *MockKubernetesConnector_CreateRSAKeyPair_Call { + _c.Call.Return(_a0) + return _c +} - return r0, r1 +func (_c *MockKubernetesConnector_CreateRSAKeyPair_Call) RunAndReturn(run func(context.Context) error) *MockKubernetesConnector_CreateRSAKeyPair_Call { + _c.Call.Return(run) + return _c } -// DeleteBackupStorage provides a mock function with given fields: ctx, namespace, name -func (_m *MockKubernetesConnector) DeleteBackupStorage(ctx context.Context, namespace string, name string) error { - ret := _m.Called(ctx, namespace, name) +// CreateRole provides a mock function with given fields: namespace, name, rules +func (_m *MockKubernetesConnector) CreateRole(namespace string, name string, rules []v1.PolicyRule) error { + ret := _m.Called(namespace, name, rules) if len(ret) == 0 { - panic("no return value specified for DeleteBackupStorage") + panic("no return value specified for CreateRole") } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { - r0 = rf(ctx, namespace, name) + if rf, ok := ret.Get(0).(func(string, string, []v1.PolicyRule) error); ok { + r0 = rf(namespace, name, rules) } else { r0 = ret.Error(0) } @@ -251,35 +582,47 @@ func (_m *MockKubernetesConnector) DeleteBackupStorage(ctx context.Context, name return r0 } -// DeleteBackupStorages provides a mock function with given fields: ctx, namespace -func (_m *MockKubernetesConnector) DeleteBackupStorages(ctx context.Context, namespace string) error { - ret := _m.Called(ctx, namespace) +// MockKubernetesConnector_CreateRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateRole' +type MockKubernetesConnector_CreateRole_Call struct { + *mock.Call +} - if len(ret) == 0 { - panic("no return value specified for DeleteBackupStorages") - } +// CreateRole is a helper method to define mock.On call +// - namespace string +// - name string +// - rules []v1.PolicyRule +func (_e *MockKubernetesConnector_Expecter) CreateRole(namespace interface{}, name interface{}, rules interface{}) *MockKubernetesConnector_CreateRole_Call { + return &MockKubernetesConnector_CreateRole_Call{Call: _e.mock.On("CreateRole", namespace, name, rules)} +} - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { - r0 = rf(ctx, namespace) - } else { - r0 = ret.Error(0) - } +func (_c *MockKubernetesConnector_CreateRole_Call) Run(run func(namespace string, name string, rules []v1.PolicyRule)) *MockKubernetesConnector_CreateRole_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].([]v1.PolicyRule)) + }) + return _c +} - return r0 +func (_c *MockKubernetesConnector_CreateRole_Call) Return(_a0 error) *MockKubernetesConnector_CreateRole_Call { + _c.Call.Return(_a0) + return _c } -// DeleteCRD provides a mock function with given fields: ctx, name -func (_m *MockKubernetesConnector) DeleteCRD(ctx context.Context, name string) error { - ret := _m.Called(ctx, name) +func (_c *MockKubernetesConnector_CreateRole_Call) RunAndReturn(run func(string, string, []v1.PolicyRule) error) *MockKubernetesConnector_CreateRole_Call { + _c.Call.Return(run) + return _c +} + +// CreateRoleBinding provides a mock function with given fields: namespace, name, roleName, serviceAccountName +func (_m *MockKubernetesConnector) CreateRoleBinding(namespace string, name string, roleName string, serviceAccountName string) error { + ret := _m.Called(namespace, name, roleName, serviceAccountName) if len(ret) == 0 { - panic("no return value specified for DeleteCRD") + panic("no return value specified for CreateRoleBinding") } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { - r0 = rf(ctx, name) + if rf, ok := ret.Get(0).(func(string, string, string, string) error); ok { + r0 = rf(namespace, name, roleName, serviceAccountName) } else { r0 = ret.Error(0) } @@ -287,53 +630,107 @@ func (_m *MockKubernetesConnector) DeleteCRD(ctx context.Context, name string) e return r0 } -// DeleteCatalogSource provides a mock function with given fields: ctx, name, namespace -func (_m *MockKubernetesConnector) DeleteCatalogSource(ctx context.Context, name string, namespace string) error { - ret := _m.Called(ctx, name, namespace) +// MockKubernetesConnector_CreateRoleBinding_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateRoleBinding' +type MockKubernetesConnector_CreateRoleBinding_Call struct { + *mock.Call +} - if len(ret) == 0 { - panic("no return value specified for DeleteCatalogSource") - } +// CreateRoleBinding is a helper method to define mock.On call +// - namespace string +// - name string +// - roleName string +// - serviceAccountName string +func (_e *MockKubernetesConnector_Expecter) CreateRoleBinding(namespace interface{}, name interface{}, roleName interface{}, serviceAccountName interface{}) *MockKubernetesConnector_CreateRoleBinding_Call { + return &MockKubernetesConnector_CreateRoleBinding_Call{Call: _e.mock.On("CreateRoleBinding", namespace, name, roleName, serviceAccountName)} +} - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { - r0 = rf(ctx, name, namespace) - } else { - r0 = ret.Error(0) - } +func (_c *MockKubernetesConnector_CreateRoleBinding_Call) Run(run func(namespace string, name string, roleName string, serviceAccountName string)) *MockKubernetesConnector_CreateRoleBinding_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(string), args[3].(string)) + }) + return _c +} - return r0 +func (_c *MockKubernetesConnector_CreateRoleBinding_Call) Return(_a0 error) *MockKubernetesConnector_CreateRoleBinding_Call { + _c.Call.Return(_a0) + return _c } -// DeleteClusterServiceVersion provides a mock function with given fields: ctx, key -func (_m *MockKubernetesConnector) DeleteClusterServiceVersion(ctx context.Context, key types.NamespacedName) error { - ret := _m.Called(ctx, key) +func (_c *MockKubernetesConnector_CreateRoleBinding_Call) RunAndReturn(run func(string, string, string, string) error) *MockKubernetesConnector_CreateRoleBinding_Call { + _c.Call.Return(run) + return _c +} + +// CreateSecret provides a mock function with given fields: ctx, secret +func (_m *MockKubernetesConnector) CreateSecret(ctx context.Context, secret *corev1.Secret) (*corev1.Secret, error) { + ret := _m.Called(ctx, secret) if len(ret) == 0 { - panic("no return value specified for DeleteClusterServiceVersion") + panic("no return value specified for CreateSecret") } - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.NamespacedName) error); ok { - r0 = rf(ctx, key) + var r0 *corev1.Secret + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *corev1.Secret) (*corev1.Secret, error)); ok { + return rf(ctx, secret) + } + if rf, ok := ret.Get(0).(func(context.Context, *corev1.Secret) *corev1.Secret); ok { + r0 = rf(ctx, secret) } else { - r0 = ret.Error(0) + if ret.Get(0) != nil { + r0 = ret.Get(0).(*corev1.Secret) + } } - return r0 + if rf, ok := ret.Get(1).(func(context.Context, *corev1.Secret) error); ok { + r1 = rf(ctx, secret) + } else { + r1 = ret.Error(1) + } + + return r0, r1 } -// DeleteDeployment provides a mock function with given fields: ctx, name, namespace -func (_m *MockKubernetesConnector) DeleteDeployment(ctx context.Context, name string, namespace string) error { - ret := _m.Called(ctx, name, namespace) +// MockKubernetesConnector_CreateSecret_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateSecret' +type MockKubernetesConnector_CreateSecret_Call struct { + *mock.Call +} + +// CreateSecret is a helper method to define mock.On call +// - ctx context.Context +// - secret *corev1.Secret +func (_e *MockKubernetesConnector_Expecter) CreateSecret(ctx interface{}, secret interface{}) *MockKubernetesConnector_CreateSecret_Call { + return &MockKubernetesConnector_CreateSecret_Call{Call: _e.mock.On("CreateSecret", ctx, secret)} +} + +func (_c *MockKubernetesConnector_CreateSecret_Call) Run(run func(ctx context.Context, secret *corev1.Secret)) *MockKubernetesConnector_CreateSecret_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*corev1.Secret)) + }) + return _c +} + +func (_c *MockKubernetesConnector_CreateSecret_Call) Return(_a0 *corev1.Secret, _a1 error) *MockKubernetesConnector_CreateSecret_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_CreateSecret_Call) RunAndReturn(run func(context.Context, *corev1.Secret) (*corev1.Secret, error)) *MockKubernetesConnector_CreateSecret_Call { + _c.Call.Return(run) + return _c +} + +// CreateServiceAccount provides a mock function with given fields: name, namespace +func (_m *MockKubernetesConnector) CreateServiceAccount(name string, namespace string) error { + ret := _m.Called(name, namespace) if len(ret) == 0 { - panic("no return value specified for DeleteDeployment") + panic("no return value specified for CreateServiceAccount") } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { - r0 = rf(ctx, name, namespace) + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(name, namespace) } else { r0 = ret.Error(0) } @@ -341,17 +738,46 @@ func (_m *MockKubernetesConnector) DeleteDeployment(ctx context.Context, name st return r0 } -// DeleteManifestFile provides a mock function with given fields: fileBytes, namespace -func (_m *MockKubernetesConnector) DeleteManifestFile(fileBytes []byte, namespace string) error { - ret := _m.Called(fileBytes, namespace) +// MockKubernetesConnector_CreateServiceAccount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateServiceAccount' +type MockKubernetesConnector_CreateServiceAccount_Call struct { + *mock.Call +} + +// CreateServiceAccount is a helper method to define mock.On call +// - name string +// - namespace string +func (_e *MockKubernetesConnector_Expecter) CreateServiceAccount(name interface{}, namespace interface{}) *MockKubernetesConnector_CreateServiceAccount_Call { + return &MockKubernetesConnector_CreateServiceAccount_Call{Call: _e.mock.On("CreateServiceAccount", name, namespace)} +} + +func (_c *MockKubernetesConnector_CreateServiceAccount_Call) Run(run func(name string, namespace string)) *MockKubernetesConnector_CreateServiceAccount_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_CreateServiceAccount_Call) Return(_a0 error) *MockKubernetesConnector_CreateServiceAccount_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_CreateServiceAccount_Call) RunAndReturn(run func(string, string) error) *MockKubernetesConnector_CreateServiceAccount_Call { + _c.Call.Return(run) + return _c +} + +// CreateServiceAccountToken provides a mock function with given fields: serviceAccountName, secretName, namespace +func (_m *MockKubernetesConnector) CreateServiceAccountToken(serviceAccountName string, secretName string, namespace string) error { + ret := _m.Called(serviceAccountName, secretName, namespace) if len(ret) == 0 { - panic("no return value specified for DeleteManifestFile") + panic("no return value specified for CreateServiceAccountToken") } var r0 error - if rf, ok := ret.Get(0).(func([]byte, string) error); ok { - r0 = rf(fileBytes, namespace) + if rf, ok := ret.Get(0).(func(string, string, string) error); ok { + r0 = rf(serviceAccountName, secretName, namespace) } else { r0 = ret.Error(0) } @@ -359,12 +785,113 @@ func (_m *MockKubernetesConnector) DeleteManifestFile(fileBytes []byte, namespac return r0 } -// DeleteMonitoringConfig provides a mock function with given fields: ctx, namespace, name -func (_m *MockKubernetesConnector) DeleteMonitoringConfig(ctx context.Context, namespace string, name string) error { +// MockKubernetesConnector_CreateServiceAccountToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateServiceAccountToken' +type MockKubernetesConnector_CreateServiceAccountToken_Call struct { + *mock.Call +} + +// CreateServiceAccountToken is a helper method to define mock.On call +// - serviceAccountName string +// - secretName string +// - namespace string +func (_e *MockKubernetesConnector_Expecter) CreateServiceAccountToken(serviceAccountName interface{}, secretName interface{}, namespace interface{}) *MockKubernetesConnector_CreateServiceAccountToken_Call { + return &MockKubernetesConnector_CreateServiceAccountToken_Call{Call: _e.mock.On("CreateServiceAccountToken", serviceAccountName, secretName, namespace)} +} + +func (_c *MockKubernetesConnector_CreateServiceAccountToken_Call) Run(run func(serviceAccountName string, secretName string, namespace string)) *MockKubernetesConnector_CreateServiceAccountToken_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_CreateServiceAccountToken_Call) Return(_a0 error) *MockKubernetesConnector_CreateServiceAccountToken_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_CreateServiceAccountToken_Call) RunAndReturn(run func(string, string, string) error) *MockKubernetesConnector_CreateServiceAccountToken_Call { + _c.Call.Return(run) + return _c +} + +// DatabasesExist provides a mock function with given fields: ctx, namespaces +func (_m *MockKubernetesConnector) DatabasesExist(ctx context.Context, namespaces ...string) (bool, error) { + _va := make([]interface{}, len(namespaces)) + for _i := range namespaces { + _va[_i] = namespaces[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for DatabasesExist") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ...string) (bool, error)); ok { + return rf(ctx, namespaces...) + } + if rf, ok := ret.Get(0).(func(context.Context, ...string) bool); ok { + r0 = rf(ctx, namespaces...) + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func(context.Context, ...string) error); ok { + r1 = rf(ctx, namespaces...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_DatabasesExist_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DatabasesExist' +type MockKubernetesConnector_DatabasesExist_Call struct { + *mock.Call +} + +// DatabasesExist is a helper method to define mock.On call +// - ctx context.Context +// - namespaces ...string +func (_e *MockKubernetesConnector_Expecter) DatabasesExist(ctx interface{}, namespaces ...interface{}) *MockKubernetesConnector_DatabasesExist_Call { + return &MockKubernetesConnector_DatabasesExist_Call{Call: _e.mock.On("DatabasesExist", + append([]interface{}{ctx}, namespaces...)...)} +} + +func (_c *MockKubernetesConnector_DatabasesExist_Call) Run(run func(ctx context.Context, namespaces ...string)) *MockKubernetesConnector_DatabasesExist_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(context.Context), variadicArgs...) + }) + return _c +} + +func (_c *MockKubernetesConnector_DatabasesExist_Call) Return(_a0 bool, _a1 error) *MockKubernetesConnector_DatabasesExist_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_DatabasesExist_Call) RunAndReturn(run func(context.Context, ...string) (bool, error)) *MockKubernetesConnector_DatabasesExist_Call { + _c.Call.Return(run) + return _c +} + +// DeleteBackupStorage provides a mock function with given fields: ctx, namespace, name +func (_m *MockKubernetesConnector) DeleteBackupStorage(ctx context.Context, namespace string, name string) error { ret := _m.Called(ctx, namespace, name) if len(ret) == 0 { - panic("no return value specified for DeleteMonitoringConfig") + panic("no return value specified for DeleteBackupStorage") } var r0 error @@ -377,12 +904,42 @@ func (_m *MockKubernetesConnector) DeleteMonitoringConfig(ctx context.Context, n return r0 } -// DeleteMonitoringConfigs provides a mock function with given fields: ctx, namespace -func (_m *MockKubernetesConnector) DeleteMonitoringConfigs(ctx context.Context, namespace string) error { +// MockKubernetesConnector_DeleteBackupStorage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteBackupStorage' +type MockKubernetesConnector_DeleteBackupStorage_Call struct { + *mock.Call +} + +// DeleteBackupStorage is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) DeleteBackupStorage(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_DeleteBackupStorage_Call { + return &MockKubernetesConnector_DeleteBackupStorage_Call{Call: _e.mock.On("DeleteBackupStorage", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_DeleteBackupStorage_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_DeleteBackupStorage_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteBackupStorage_Call) Return(_a0 error) *MockKubernetesConnector_DeleteBackupStorage_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteBackupStorage_Call) RunAndReturn(run func(context.Context, string, string) error) *MockKubernetesConnector_DeleteBackupStorage_Call { + _c.Call.Return(run) + return _c +} + +// DeleteBackupStorages provides a mock function with given fields: ctx, namespace +func (_m *MockKubernetesConnector) DeleteBackupStorages(ctx context.Context, namespace string) error { ret := _m.Called(ctx, namespace) if len(ret) == 0 { - panic("no return value specified for DeleteMonitoringConfigs") + panic("no return value specified for DeleteBackupStorages") } var r0 error @@ -395,12 +952,41 @@ func (_m *MockKubernetesConnector) DeleteMonitoringConfigs(ctx context.Context, return r0 } -// DeleteNamespace provides a mock function with given fields: ctx, name -func (_m *MockKubernetesConnector) DeleteNamespace(ctx context.Context, name string) error { +// MockKubernetesConnector_DeleteBackupStorages_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteBackupStorages' +type MockKubernetesConnector_DeleteBackupStorages_Call struct { + *mock.Call +} + +// DeleteBackupStorages is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +func (_e *MockKubernetesConnector_Expecter) DeleteBackupStorages(ctx interface{}, namespace interface{}) *MockKubernetesConnector_DeleteBackupStorages_Call { + return &MockKubernetesConnector_DeleteBackupStorages_Call{Call: _e.mock.On("DeleteBackupStorages", ctx, namespace)} +} + +func (_c *MockKubernetesConnector_DeleteBackupStorages_Call) Run(run func(ctx context.Context, namespace string)) *MockKubernetesConnector_DeleteBackupStorages_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteBackupStorages_Call) Return(_a0 error) *MockKubernetesConnector_DeleteBackupStorages_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteBackupStorages_Call) RunAndReturn(run func(context.Context, string) error) *MockKubernetesConnector_DeleteBackupStorages_Call { + _c.Call.Return(run) + return _c +} + +// DeleteCRD provides a mock function with given fields: ctx, name +func (_m *MockKubernetesConnector) DeleteCRD(ctx context.Context, name string) error { ret := _m.Called(ctx, name) if len(ret) == 0 { - panic("no return value specified for DeleteNamespace") + panic("no return value specified for DeleteCRD") } var r0 error @@ -413,17 +999,46 @@ func (_m *MockKubernetesConnector) DeleteNamespace(ctx context.Context, name str return r0 } -// DeleteSecret provides a mock function with given fields: ctx, namespace, name -func (_m *MockKubernetesConnector) DeleteSecret(ctx context.Context, namespace string, name string) error { - ret := _m.Called(ctx, namespace, name) +// MockKubernetesConnector_DeleteCRD_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteCRD' +type MockKubernetesConnector_DeleteCRD_Call struct { + *mock.Call +} + +// DeleteCRD is a helper method to define mock.On call +// - ctx context.Context +// - name string +func (_e *MockKubernetesConnector_Expecter) DeleteCRD(ctx interface{}, name interface{}) *MockKubernetesConnector_DeleteCRD_Call { + return &MockKubernetesConnector_DeleteCRD_Call{Call: _e.mock.On("DeleteCRD", ctx, name)} +} + +func (_c *MockKubernetesConnector_DeleteCRD_Call) Run(run func(ctx context.Context, name string)) *MockKubernetesConnector_DeleteCRD_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteCRD_Call) Return(_a0 error) *MockKubernetesConnector_DeleteCRD_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteCRD_Call) RunAndReturn(run func(context.Context, string) error) *MockKubernetesConnector_DeleteCRD_Call { + _c.Call.Return(run) + return _c +} + +// DeleteCatalogSource provides a mock function with given fields: ctx, name, namespace +func (_m *MockKubernetesConnector) DeleteCatalogSource(ctx context.Context, name string, namespace string) error { + ret := _m.Called(ctx, name, namespace) if len(ret) == 0 { - panic("no return value specified for DeleteSecret") + panic("no return value specified for DeleteCatalogSource") } var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { - r0 = rf(ctx, namespace, name) + r0 = rf(ctx, name, namespace) } else { r0 = ret.Error(0) } @@ -431,12 +1046,42 @@ func (_m *MockKubernetesConnector) DeleteSecret(ctx context.Context, namespace s return r0 } -// DeleteSubscription provides a mock function with given fields: ctx, key -func (_m *MockKubernetesConnector) DeleteSubscription(ctx context.Context, key types.NamespacedName) error { +// MockKubernetesConnector_DeleteCatalogSource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteCatalogSource' +type MockKubernetesConnector_DeleteCatalogSource_Call struct { + *mock.Call +} + +// DeleteCatalogSource is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - namespace string +func (_e *MockKubernetesConnector_Expecter) DeleteCatalogSource(ctx interface{}, name interface{}, namespace interface{}) *MockKubernetesConnector_DeleteCatalogSource_Call { + return &MockKubernetesConnector_DeleteCatalogSource_Call{Call: _e.mock.On("DeleteCatalogSource", ctx, name, namespace)} +} + +func (_c *MockKubernetesConnector_DeleteCatalogSource_Call) Run(run func(ctx context.Context, name string, namespace string)) *MockKubernetesConnector_DeleteCatalogSource_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteCatalogSource_Call) Return(_a0 error) *MockKubernetesConnector_DeleteCatalogSource_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteCatalogSource_Call) RunAndReturn(run func(context.Context, string, string) error) *MockKubernetesConnector_DeleteCatalogSource_Call { + _c.Call.Return(run) + return _c +} + +// DeleteClusterServiceVersion provides a mock function with given fields: ctx, key +func (_m *MockKubernetesConnector) DeleteClusterServiceVersion(ctx context.Context, key types.NamespacedName) error { ret := _m.Called(ctx, key) if len(ret) == 0 { - panic("no return value specified for DeleteSubscription") + panic("no return value specified for DeleteClusterServiceVersion") } var r0 error @@ -449,59 +1094,914 @@ func (_m *MockKubernetesConnector) DeleteSubscription(ctx context.Context, key t return r0 } -// GetBackupStorage provides a mock function with given fields: ctx, namespace, name -func (_m *MockKubernetesConnector) GetBackupStorage(ctx context.Context, namespace string, name string) (*v1alpha1.BackupStorage, error) { +// MockKubernetesConnector_DeleteClusterServiceVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteClusterServiceVersion' +type MockKubernetesConnector_DeleteClusterServiceVersion_Call struct { + *mock.Call +} + +// DeleteClusterServiceVersion is a helper method to define mock.On call +// - ctx context.Context +// - key types.NamespacedName +func (_e *MockKubernetesConnector_Expecter) DeleteClusterServiceVersion(ctx interface{}, key interface{}) *MockKubernetesConnector_DeleteClusterServiceVersion_Call { + return &MockKubernetesConnector_DeleteClusterServiceVersion_Call{Call: _e.mock.On("DeleteClusterServiceVersion", ctx, key)} +} + +func (_c *MockKubernetesConnector_DeleteClusterServiceVersion_Call) Run(run func(ctx context.Context, key types.NamespacedName)) *MockKubernetesConnector_DeleteClusterServiceVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(types.NamespacedName)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteClusterServiceVersion_Call) Return(_a0 error) *MockKubernetesConnector_DeleteClusterServiceVersion_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteClusterServiceVersion_Call) RunAndReturn(run func(context.Context, types.NamespacedName) error) *MockKubernetesConnector_DeleteClusterServiceVersion_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDatabaseCluster provides a mock function with given fields: ctx, namespace, name +func (_m *MockKubernetesConnector) DeleteDatabaseCluster(ctx context.Context, namespace string, name string) error { ret := _m.Called(ctx, namespace, name) if len(ret) == 0 { - panic("no return value specified for GetBackupStorage") + panic("no return value specified for DeleteDatabaseCluster") } - var r0 *v1alpha1.BackupStorage - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) (*v1alpha1.BackupStorage, error)); ok { - return rf(ctx, namespace, name) - } - if rf, ok := ret.Get(0).(func(context.Context, string, string) *v1alpha1.BackupStorage); ok { + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { r0 = rf(ctx, namespace, name) } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1alpha1.BackupStorage) - } + r0 = ret.Error(0) } - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, namespace, name) + return r0 +} + +// MockKubernetesConnector_DeleteDatabaseCluster_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDatabaseCluster' +type MockKubernetesConnector_DeleteDatabaseCluster_Call struct { + *mock.Call +} + +// DeleteDatabaseCluster is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) DeleteDatabaseCluster(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_DeleteDatabaseCluster_Call { + return &MockKubernetesConnector_DeleteDatabaseCluster_Call{Call: _e.mock.On("DeleteDatabaseCluster", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_DeleteDatabaseCluster_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_DeleteDatabaseCluster_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteDatabaseCluster_Call) Return(_a0 error) *MockKubernetesConnector_DeleteDatabaseCluster_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteDatabaseCluster_Call) RunAndReturn(run func(context.Context, string, string) error) *MockKubernetesConnector_DeleteDatabaseCluster_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDatabaseClusters provides a mock function with given fields: ctx, namespace +func (_m *MockKubernetesConnector) DeleteDatabaseClusters(ctx context.Context, namespace string) error { + ret := _m.Called(ctx, namespace) + + if len(ret) == 0 { + panic("no return value specified for DeleteDatabaseClusters") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, namespace) } else { - r1 = ret.Error(1) + r0 = ret.Error(0) + } + + return r0 +} + +// MockKubernetesConnector_DeleteDatabaseClusters_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDatabaseClusters' +type MockKubernetesConnector_DeleteDatabaseClusters_Call struct { + *mock.Call +} + +// DeleteDatabaseClusters is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +func (_e *MockKubernetesConnector_Expecter) DeleteDatabaseClusters(ctx interface{}, namespace interface{}) *MockKubernetesConnector_DeleteDatabaseClusters_Call { + return &MockKubernetesConnector_DeleteDatabaseClusters_Call{Call: _e.mock.On("DeleteDatabaseClusters", ctx, namespace)} +} + +func (_c *MockKubernetesConnector_DeleteDatabaseClusters_Call) Run(run func(ctx context.Context, namespace string)) *MockKubernetesConnector_DeleteDatabaseClusters_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteDatabaseClusters_Call) Return(_a0 error) *MockKubernetesConnector_DeleteDatabaseClusters_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteDatabaseClusters_Call) RunAndReturn(run func(context.Context, string) error) *MockKubernetesConnector_DeleteDatabaseClusters_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDeployment provides a mock function with given fields: ctx, name, namespace +func (_m *MockKubernetesConnector) DeleteDeployment(ctx context.Context, name string, namespace string) error { + ret := _m.Called(ctx, name, namespace) + + if len(ret) == 0 { + panic("no return value specified for DeleteDeployment") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { + r0 = rf(ctx, name, namespace) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockKubernetesConnector_DeleteDeployment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDeployment' +type MockKubernetesConnector_DeleteDeployment_Call struct { + *mock.Call +} + +// DeleteDeployment is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - namespace string +func (_e *MockKubernetesConnector_Expecter) DeleteDeployment(ctx interface{}, name interface{}, namespace interface{}) *MockKubernetesConnector_DeleteDeployment_Call { + return &MockKubernetesConnector_DeleteDeployment_Call{Call: _e.mock.On("DeleteDeployment", ctx, name, namespace)} +} + +func (_c *MockKubernetesConnector_DeleteDeployment_Call) Run(run func(ctx context.Context, name string, namespace string)) *MockKubernetesConnector_DeleteDeployment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteDeployment_Call) Return(_a0 error) *MockKubernetesConnector_DeleteDeployment_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteDeployment_Call) RunAndReturn(run func(context.Context, string, string) error) *MockKubernetesConnector_DeleteDeployment_Call { + _c.Call.Return(run) + return _c +} + +// DeleteManifestFile provides a mock function with given fields: fileBytes, namespace +func (_m *MockKubernetesConnector) DeleteManifestFile(fileBytes []byte, namespace string) error { + ret := _m.Called(fileBytes, namespace) + + if len(ret) == 0 { + panic("no return value specified for DeleteManifestFile") + } + + var r0 error + if rf, ok := ret.Get(0).(func([]byte, string) error); ok { + r0 = rf(fileBytes, namespace) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockKubernetesConnector_DeleteManifestFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteManifestFile' +type MockKubernetesConnector_DeleteManifestFile_Call struct { + *mock.Call +} + +// DeleteManifestFile is a helper method to define mock.On call +// - fileBytes []byte +// - namespace string +func (_e *MockKubernetesConnector_Expecter) DeleteManifestFile(fileBytes interface{}, namespace interface{}) *MockKubernetesConnector_DeleteManifestFile_Call { + return &MockKubernetesConnector_DeleteManifestFile_Call{Call: _e.mock.On("DeleteManifestFile", fileBytes, namespace)} +} + +func (_c *MockKubernetesConnector_DeleteManifestFile_Call) Run(run func(fileBytes []byte, namespace string)) *MockKubernetesConnector_DeleteManifestFile_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]byte), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteManifestFile_Call) Return(_a0 error) *MockKubernetesConnector_DeleteManifestFile_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteManifestFile_Call) RunAndReturn(run func([]byte, string) error) *MockKubernetesConnector_DeleteManifestFile_Call { + _c.Call.Return(run) + return _c +} + +// DeleteMonitoringConfig provides a mock function with given fields: ctx, namespace, name +func (_m *MockKubernetesConnector) DeleteMonitoringConfig(ctx context.Context, namespace string, name string) error { + ret := _m.Called(ctx, namespace, name) + + if len(ret) == 0 { + panic("no return value specified for DeleteMonitoringConfig") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { + r0 = rf(ctx, namespace, name) + } else { + r0 = ret.Error(0) } - return r0, r1 + return r0 +} + +// MockKubernetesConnector_DeleteMonitoringConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteMonitoringConfig' +type MockKubernetesConnector_DeleteMonitoringConfig_Call struct { + *mock.Call +} + +// DeleteMonitoringConfig is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) DeleteMonitoringConfig(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_DeleteMonitoringConfig_Call { + return &MockKubernetesConnector_DeleteMonitoringConfig_Call{Call: _e.mock.On("DeleteMonitoringConfig", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_DeleteMonitoringConfig_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_DeleteMonitoringConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteMonitoringConfig_Call) Return(_a0 error) *MockKubernetesConnector_DeleteMonitoringConfig_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteMonitoringConfig_Call) RunAndReturn(run func(context.Context, string, string) error) *MockKubernetesConnector_DeleteMonitoringConfig_Call { + _c.Call.Return(run) + return _c +} + +// DeleteMonitoringConfigs provides a mock function with given fields: ctx, namespace +func (_m *MockKubernetesConnector) DeleteMonitoringConfigs(ctx context.Context, namespace string) error { + ret := _m.Called(ctx, namespace) + + if len(ret) == 0 { + panic("no return value specified for DeleteMonitoringConfigs") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, namespace) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockKubernetesConnector_DeleteMonitoringConfigs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteMonitoringConfigs' +type MockKubernetesConnector_DeleteMonitoringConfigs_Call struct { + *mock.Call +} + +// DeleteMonitoringConfigs is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +func (_e *MockKubernetesConnector_Expecter) DeleteMonitoringConfigs(ctx interface{}, namespace interface{}) *MockKubernetesConnector_DeleteMonitoringConfigs_Call { + return &MockKubernetesConnector_DeleteMonitoringConfigs_Call{Call: _e.mock.On("DeleteMonitoringConfigs", ctx, namespace)} +} + +func (_c *MockKubernetesConnector_DeleteMonitoringConfigs_Call) Run(run func(ctx context.Context, namespace string)) *MockKubernetesConnector_DeleteMonitoringConfigs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteMonitoringConfigs_Call) Return(_a0 error) *MockKubernetesConnector_DeleteMonitoringConfigs_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteMonitoringConfigs_Call) RunAndReturn(run func(context.Context, string) error) *MockKubernetesConnector_DeleteMonitoringConfigs_Call { + _c.Call.Return(run) + return _c +} + +// DeleteNamespace provides a mock function with given fields: ctx, name +func (_m *MockKubernetesConnector) DeleteNamespace(ctx context.Context, name string) error { + ret := _m.Called(ctx, name) + + if len(ret) == 0 { + panic("no return value specified for DeleteNamespace") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockKubernetesConnector_DeleteNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteNamespace' +type MockKubernetesConnector_DeleteNamespace_Call struct { + *mock.Call +} + +// DeleteNamespace is a helper method to define mock.On call +// - ctx context.Context +// - name string +func (_e *MockKubernetesConnector_Expecter) DeleteNamespace(ctx interface{}, name interface{}) *MockKubernetesConnector_DeleteNamespace_Call { + return &MockKubernetesConnector_DeleteNamespace_Call{Call: _e.mock.On("DeleteNamespace", ctx, name)} +} + +func (_c *MockKubernetesConnector_DeleteNamespace_Call) Run(run func(ctx context.Context, name string)) *MockKubernetesConnector_DeleteNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteNamespace_Call) Return(_a0 error) *MockKubernetesConnector_DeleteNamespace_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteNamespace_Call) RunAndReturn(run func(context.Context, string) error) *MockKubernetesConnector_DeleteNamespace_Call { + _c.Call.Return(run) + return _c +} + +// DeleteSecret provides a mock function with given fields: ctx, namespace, name +func (_m *MockKubernetesConnector) DeleteSecret(ctx context.Context, namespace string, name string) error { + ret := _m.Called(ctx, namespace, name) + + if len(ret) == 0 { + panic("no return value specified for DeleteSecret") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { + r0 = rf(ctx, namespace, name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockKubernetesConnector_DeleteSecret_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteSecret' +type MockKubernetesConnector_DeleteSecret_Call struct { + *mock.Call +} + +// DeleteSecret is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) DeleteSecret(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_DeleteSecret_Call { + return &MockKubernetesConnector_DeleteSecret_Call{Call: _e.mock.On("DeleteSecret", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_DeleteSecret_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_DeleteSecret_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteSecret_Call) Return(_a0 error) *MockKubernetesConnector_DeleteSecret_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteSecret_Call) RunAndReturn(run func(context.Context, string, string) error) *MockKubernetesConnector_DeleteSecret_Call { + _c.Call.Return(run) + return _c +} + +// DeleteSubscription provides a mock function with given fields: ctx, key +func (_m *MockKubernetesConnector) DeleteSubscription(ctx context.Context, key types.NamespacedName) error { + ret := _m.Called(ctx, key) + + if len(ret) == 0 { + panic("no return value specified for DeleteSubscription") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, types.NamespacedName) error); ok { + r0 = rf(ctx, key) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockKubernetesConnector_DeleteSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteSubscription' +type MockKubernetesConnector_DeleteSubscription_Call struct { + *mock.Call +} + +// DeleteSubscription is a helper method to define mock.On call +// - ctx context.Context +// - key types.NamespacedName +func (_e *MockKubernetesConnector_Expecter) DeleteSubscription(ctx interface{}, key interface{}) *MockKubernetesConnector_DeleteSubscription_Call { + return &MockKubernetesConnector_DeleteSubscription_Call{Call: _e.mock.On("DeleteSubscription", ctx, key)} +} + +func (_c *MockKubernetesConnector_DeleteSubscription_Call) Run(run func(ctx context.Context, key types.NamespacedName)) *MockKubernetesConnector_DeleteSubscription_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(types.NamespacedName)) + }) + return _c +} + +func (_c *MockKubernetesConnector_DeleteSubscription_Call) Return(_a0 error) *MockKubernetesConnector_DeleteSubscription_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_DeleteSubscription_Call) RunAndReturn(run func(context.Context, types.NamespacedName) error) *MockKubernetesConnector_DeleteSubscription_Call { + _c.Call.Return(run) + return _c +} + +// GetAllClusterResources provides a mock function with given fields: ctx, clusterType, volumes +func (_m *MockKubernetesConnector) GetAllClusterResources(ctx context.Context, clusterType ClusterType, volumes *corev1.PersistentVolumeList) (uint64, uint64, uint64, error) { + ret := _m.Called(ctx, clusterType, volumes) + + if len(ret) == 0 { + panic("no return value specified for GetAllClusterResources") + } + + var r0 uint64 + var r1 uint64 + var r2 uint64 + var r3 error + if rf, ok := ret.Get(0).(func(context.Context, ClusterType, *corev1.PersistentVolumeList) (uint64, uint64, uint64, error)); ok { + return rf(ctx, clusterType, volumes) + } + if rf, ok := ret.Get(0).(func(context.Context, ClusterType, *corev1.PersistentVolumeList) uint64); ok { + r0 = rf(ctx, clusterType, volumes) + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func(context.Context, ClusterType, *corev1.PersistentVolumeList) uint64); ok { + r1 = rf(ctx, clusterType, volumes) + } else { + r1 = ret.Get(1).(uint64) + } + + if rf, ok := ret.Get(2).(func(context.Context, ClusterType, *corev1.PersistentVolumeList) uint64); ok { + r2 = rf(ctx, clusterType, volumes) + } else { + r2 = ret.Get(2).(uint64) + } + + if rf, ok := ret.Get(3).(func(context.Context, ClusterType, *corev1.PersistentVolumeList) error); ok { + r3 = rf(ctx, clusterType, volumes) + } else { + r3 = ret.Error(3) + } + + return r0, r1, r2, r3 +} + +// MockKubernetesConnector_GetAllClusterResources_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllClusterResources' +type MockKubernetesConnector_GetAllClusterResources_Call struct { + *mock.Call +} + +// GetAllClusterResources is a helper method to define mock.On call +// - ctx context.Context +// - clusterType ClusterType +// - volumes *corev1.PersistentVolumeList +func (_e *MockKubernetesConnector_Expecter) GetAllClusterResources(ctx interface{}, clusterType interface{}, volumes interface{}) *MockKubernetesConnector_GetAllClusterResources_Call { + return &MockKubernetesConnector_GetAllClusterResources_Call{Call: _e.mock.On("GetAllClusterResources", ctx, clusterType, volumes)} +} + +func (_c *MockKubernetesConnector_GetAllClusterResources_Call) Run(run func(ctx context.Context, clusterType ClusterType, volumes *corev1.PersistentVolumeList)) *MockKubernetesConnector_GetAllClusterResources_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ClusterType), args[2].(*corev1.PersistentVolumeList)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetAllClusterResources_Call) Return(_a0 uint64, _a1 uint64, _a2 uint64, _a3 error) *MockKubernetesConnector_GetAllClusterResources_Call { + _c.Call.Return(_a0, _a1, _a2, _a3) + return _c +} + +func (_c *MockKubernetesConnector_GetAllClusterResources_Call) RunAndReturn(run func(context.Context, ClusterType, *corev1.PersistentVolumeList) (uint64, uint64, uint64, error)) *MockKubernetesConnector_GetAllClusterResources_Call { + _c.Call.Return(run) + return _c +} + +// GetBackupStorage provides a mock function with given fields: ctx, namespace, name +func (_m *MockKubernetesConnector) GetBackupStorage(ctx context.Context, namespace string, name string) (*v1alpha1.BackupStorage, error) { + ret := _m.Called(ctx, namespace, name) + + if len(ret) == 0 { + panic("no return value specified for GetBackupStorage") + } + + var r0 *v1alpha1.BackupStorage + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*v1alpha1.BackupStorage, error)); ok { + return rf(ctx, namespace, name) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string) *v1alpha1.BackupStorage); ok { + r0 = rf(ctx, namespace, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v1alpha1.BackupStorage) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, namespace, name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_GetBackupStorage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBackupStorage' +type MockKubernetesConnector_GetBackupStorage_Call struct { + *mock.Call +} + +// GetBackupStorage is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) GetBackupStorage(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_GetBackupStorage_Call { + return &MockKubernetesConnector_GetBackupStorage_Call{Call: _e.mock.On("GetBackupStorage", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_GetBackupStorage_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_GetBackupStorage_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetBackupStorage_Call) Return(_a0 *v1alpha1.BackupStorage, _a1 error) *MockKubernetesConnector_GetBackupStorage_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetBackupStorage_Call) RunAndReturn(run func(context.Context, string, string) (*v1alpha1.BackupStorage, error)) *MockKubernetesConnector_GetBackupStorage_Call { + _c.Call.Return(run) + return _c +} + +// GetCatalogSource provides a mock function with given fields: ctx, name, namespace +func (_m *MockKubernetesConnector) GetCatalogSource(ctx context.Context, name string, namespace string) (*operatorsv1alpha1.CatalogSource, error) { + ret := _m.Called(ctx, name, namespace) + + if len(ret) == 0 { + panic("no return value specified for GetCatalogSource") + } + + var r0 *operatorsv1alpha1.CatalogSource + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*operatorsv1alpha1.CatalogSource, error)); ok { + return rf(ctx, name, namespace) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string) *operatorsv1alpha1.CatalogSource); ok { + r0 = rf(ctx, name, namespace) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*operatorsv1alpha1.CatalogSource) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, name, namespace) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_GetCatalogSource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCatalogSource' +type MockKubernetesConnector_GetCatalogSource_Call struct { + *mock.Call +} + +// GetCatalogSource is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - namespace string +func (_e *MockKubernetesConnector_Expecter) GetCatalogSource(ctx interface{}, name interface{}, namespace interface{}) *MockKubernetesConnector_GetCatalogSource_Call { + return &MockKubernetesConnector_GetCatalogSource_Call{Call: _e.mock.On("GetCatalogSource", ctx, name, namespace)} +} + +func (_c *MockKubernetesConnector_GetCatalogSource_Call) Run(run func(ctx context.Context, name string, namespace string)) *MockKubernetesConnector_GetCatalogSource_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetCatalogSource_Call) Return(_a0 *operatorsv1alpha1.CatalogSource, _a1 error) *MockKubernetesConnector_GetCatalogSource_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetCatalogSource_Call) RunAndReturn(run func(context.Context, string, string) (*operatorsv1alpha1.CatalogSource, error)) *MockKubernetesConnector_GetCatalogSource_Call { + _c.Call.Return(run) + return _c +} + +// GetClusterServiceVersion provides a mock function with given fields: ctx, key +func (_m *MockKubernetesConnector) GetClusterServiceVersion(ctx context.Context, key types.NamespacedName) (*operatorsv1alpha1.ClusterServiceVersion, error) { + ret := _m.Called(ctx, key) + + if len(ret) == 0 { + panic("no return value specified for GetClusterServiceVersion") + } + + var r0 *operatorsv1alpha1.ClusterServiceVersion + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, types.NamespacedName) (*operatorsv1alpha1.ClusterServiceVersion, error)); ok { + return rf(ctx, key) + } + if rf, ok := ret.Get(0).(func(context.Context, types.NamespacedName) *operatorsv1alpha1.ClusterServiceVersion); ok { + r0 = rf(ctx, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*operatorsv1alpha1.ClusterServiceVersion) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, types.NamespacedName) error); ok { + r1 = rf(ctx, key) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_GetClusterServiceVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClusterServiceVersion' +type MockKubernetesConnector_GetClusterServiceVersion_Call struct { + *mock.Call +} + +// GetClusterServiceVersion is a helper method to define mock.On call +// - ctx context.Context +// - key types.NamespacedName +func (_e *MockKubernetesConnector_Expecter) GetClusterServiceVersion(ctx interface{}, key interface{}) *MockKubernetesConnector_GetClusterServiceVersion_Call { + return &MockKubernetesConnector_GetClusterServiceVersion_Call{Call: _e.mock.On("GetClusterServiceVersion", ctx, key)} +} + +func (_c *MockKubernetesConnector_GetClusterServiceVersion_Call) Run(run func(ctx context.Context, key types.NamespacedName)) *MockKubernetesConnector_GetClusterServiceVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(types.NamespacedName)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetClusterServiceVersion_Call) Return(_a0 *operatorsv1alpha1.ClusterServiceVersion, _a1 error) *MockKubernetesConnector_GetClusterServiceVersion_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetClusterServiceVersion_Call) RunAndReturn(run func(context.Context, types.NamespacedName) (*operatorsv1alpha1.ClusterServiceVersion, error)) *MockKubernetesConnector_GetClusterServiceVersion_Call { + _c.Call.Return(run) + return _c +} + +// GetClusterType provides a mock function with given fields: ctx +func (_m *MockKubernetesConnector) GetClusterType(ctx context.Context) (ClusterType, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetClusterType") + } + + var r0 ClusterType + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (ClusterType, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) ClusterType); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(ClusterType) + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_GetClusterType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClusterType' +type MockKubernetesConnector_GetClusterType_Call struct { + *mock.Call +} + +// GetClusterType is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockKubernetesConnector_Expecter) GetClusterType(ctx interface{}) *MockKubernetesConnector_GetClusterType_Call { + return &MockKubernetesConnector_GetClusterType_Call{Call: _e.mock.On("GetClusterType", ctx)} +} + +func (_c *MockKubernetesConnector_GetClusterType_Call) Run(run func(ctx context.Context)) *MockKubernetesConnector_GetClusterType_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetClusterType_Call) Return(_a0 ClusterType, _a1 error) *MockKubernetesConnector_GetClusterType_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetClusterType_Call) RunAndReturn(run func(context.Context) (ClusterType, error)) *MockKubernetesConnector_GetClusterType_Call { + _c.Call.Return(run) + return _c +} + +// GetConfigMap provides a mock function with given fields: ctx, namespace, name +func (_m *MockKubernetesConnector) GetConfigMap(ctx context.Context, namespace string, name string) (*corev1.ConfigMap, error) { + ret := _m.Called(ctx, namespace, name) + + if len(ret) == 0 { + panic("no return value specified for GetConfigMap") + } + + var r0 *corev1.ConfigMap + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*corev1.ConfigMap, error)); ok { + return rf(ctx, namespace, name) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string) *corev1.ConfigMap); ok { + r0 = rf(ctx, namespace, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*corev1.ConfigMap) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, namespace, name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_GetConfigMap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConfigMap' +type MockKubernetesConnector_GetConfigMap_Call struct { + *mock.Call +} + +// GetConfigMap is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) GetConfigMap(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_GetConfigMap_Call { + return &MockKubernetesConnector_GetConfigMap_Call{Call: _e.mock.On("GetConfigMap", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_GetConfigMap_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_GetConfigMap_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetConfigMap_Call) Return(_a0 *corev1.ConfigMap, _a1 error) *MockKubernetesConnector_GetConfigMap_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetConfigMap_Call) RunAndReturn(run func(context.Context, string, string) (*corev1.ConfigMap, error)) *MockKubernetesConnector_GetConfigMap_Call { + _c.Call.Return(run) + return _c +} + +// GetConsumedCPUAndMemory provides a mock function with given fields: ctx, namespace +func (_m *MockKubernetesConnector) GetConsumedCPUAndMemory(ctx context.Context, namespace string) (uint64, uint64, error) { + ret := _m.Called(ctx, namespace) + + if len(ret) == 0 { + panic("no return value specified for GetConsumedCPUAndMemory") + } + + var r0 uint64 + var r1 uint64 + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, string) (uint64, uint64, error)); ok { + return rf(ctx, namespace) + } + if rf, ok := ret.Get(0).(func(context.Context, string) uint64); ok { + r0 = rf(ctx, namespace) + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func(context.Context, string) uint64); ok { + r1 = rf(ctx, namespace) + } else { + r1 = ret.Get(1).(uint64) + } + + if rf, ok := ret.Get(2).(func(context.Context, string) error); ok { + r2 = rf(ctx, namespace) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// MockKubernetesConnector_GetConsumedCPUAndMemory_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConsumedCPUAndMemory' +type MockKubernetesConnector_GetConsumedCPUAndMemory_Call struct { + *mock.Call +} + +// GetConsumedCPUAndMemory is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +func (_e *MockKubernetesConnector_Expecter) GetConsumedCPUAndMemory(ctx interface{}, namespace interface{}) *MockKubernetesConnector_GetConsumedCPUAndMemory_Call { + return &MockKubernetesConnector_GetConsumedCPUAndMemory_Call{Call: _e.mock.On("GetConsumedCPUAndMemory", ctx, namespace)} +} + +func (_c *MockKubernetesConnector_GetConsumedCPUAndMemory_Call) Run(run func(ctx context.Context, namespace string)) *MockKubernetesConnector_GetConsumedCPUAndMemory_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetConsumedCPUAndMemory_Call) Return(cpuMillis uint64, memoryBytes uint64, err error) *MockKubernetesConnector_GetConsumedCPUAndMemory_Call { + _c.Call.Return(cpuMillis, memoryBytes, err) + return _c +} + +func (_c *MockKubernetesConnector_GetConsumedCPUAndMemory_Call) RunAndReturn(run func(context.Context, string) (uint64, uint64, error)) *MockKubernetesConnector_GetConsumedCPUAndMemory_Call { + _c.Call.Return(run) + return _c } -// GetCatalogSource provides a mock function with given fields: ctx, name, namespace -func (_m *MockKubernetesConnector) GetCatalogSource(ctx context.Context, name string, namespace string) (*operatorsv1alpha1.CatalogSource, error) { - ret := _m.Called(ctx, name, namespace) +// GetConsumedDiskBytes provides a mock function with given fields: _a0, clusterType, volumes +func (_m *MockKubernetesConnector) GetConsumedDiskBytes(_a0 context.Context, clusterType ClusterType, volumes *corev1.PersistentVolumeList) (uint64, error) { + ret := _m.Called(_a0, clusterType, volumes) if len(ret) == 0 { - panic("no return value specified for GetCatalogSource") + panic("no return value specified for GetConsumedDiskBytes") } - var r0 *operatorsv1alpha1.CatalogSource + var r0 uint64 var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) (*operatorsv1alpha1.CatalogSource, error)); ok { - return rf(ctx, name, namespace) + if rf, ok := ret.Get(0).(func(context.Context, ClusterType, *corev1.PersistentVolumeList) (uint64, error)); ok { + return rf(_a0, clusterType, volumes) } - if rf, ok := ret.Get(0).(func(context.Context, string, string) *operatorsv1alpha1.CatalogSource); ok { - r0 = rf(ctx, name, namespace) + if rf, ok := ret.Get(0).(func(context.Context, ClusterType, *corev1.PersistentVolumeList) uint64); ok { + r0 = rf(_a0, clusterType, volumes) } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*operatorsv1alpha1.CatalogSource) - } + r0 = ret.Get(0).(uint64) } - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, name, namespace) + if rf, ok := ret.Get(1).(func(context.Context, ClusterType, *corev1.PersistentVolumeList) error); ok { + r1 = rf(_a0, clusterType, volumes) } else { r1 = ret.Error(1) } @@ -509,29 +2009,59 @@ func (_m *MockKubernetesConnector) GetCatalogSource(ctx context.Context, name st return r0, r1 } -// GetClusterServiceVersion provides a mock function with given fields: ctx, key -func (_m *MockKubernetesConnector) GetClusterServiceVersion(ctx context.Context, key types.NamespacedName) (*operatorsv1alpha1.ClusterServiceVersion, error) { - ret := _m.Called(ctx, key) +// MockKubernetesConnector_GetConsumedDiskBytes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConsumedDiskBytes' +type MockKubernetesConnector_GetConsumedDiskBytes_Call struct { + *mock.Call +} + +// GetConsumedDiskBytes is a helper method to define mock.On call +// - _a0 context.Context +// - clusterType ClusterType +// - volumes *corev1.PersistentVolumeList +func (_e *MockKubernetesConnector_Expecter) GetConsumedDiskBytes(_a0 interface{}, clusterType interface{}, volumes interface{}) *MockKubernetesConnector_GetConsumedDiskBytes_Call { + return &MockKubernetesConnector_GetConsumedDiskBytes_Call{Call: _e.mock.On("GetConsumedDiskBytes", _a0, clusterType, volumes)} +} + +func (_c *MockKubernetesConnector_GetConsumedDiskBytes_Call) Run(run func(_a0 context.Context, clusterType ClusterType, volumes *corev1.PersistentVolumeList)) *MockKubernetesConnector_GetConsumedDiskBytes_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ClusterType), args[2].(*corev1.PersistentVolumeList)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetConsumedDiskBytes_Call) Return(_a0 uint64, _a1 error) *MockKubernetesConnector_GetConsumedDiskBytes_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetConsumedDiskBytes_Call) RunAndReturn(run func(context.Context, ClusterType, *corev1.PersistentVolumeList) (uint64, error)) *MockKubernetesConnector_GetConsumedDiskBytes_Call { + _c.Call.Return(run) + return _c +} + +// GetDBNamespaces provides a mock function with given fields: ctx +func (_m *MockKubernetesConnector) GetDBNamespaces(ctx context.Context) ([]string, error) { + ret := _m.Called(ctx) if len(ret) == 0 { - panic("no return value specified for GetClusterServiceVersion") + panic("no return value specified for GetDBNamespaces") } - var r0 *operatorsv1alpha1.ClusterServiceVersion + var r0 []string var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.NamespacedName) (*operatorsv1alpha1.ClusterServiceVersion, error)); ok { - return rf(ctx, key) + if rf, ok := ret.Get(0).(func(context.Context) ([]string, error)); ok { + return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context, types.NamespacedName) *operatorsv1alpha1.ClusterServiceVersion); ok { - r0 = rf(ctx, key) + if rf, ok := ret.Get(0).(func(context.Context) []string); ok { + r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*operatorsv1alpha1.ClusterServiceVersion) + r0 = ret.Get(0).([]string) } } - if rf, ok := ret.Get(1).(func(context.Context, types.NamespacedName) error); ok { - r1 = rf(ctx, key) + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) } else { r1 = ret.Error(1) } @@ -539,27 +2069,57 @@ func (_m *MockKubernetesConnector) GetClusterServiceVersion(ctx context.Context, return r0, r1 } -// GetClusterType provides a mock function with given fields: ctx -func (_m *MockKubernetesConnector) GetClusterType(ctx context.Context) (ClusterType, error) { - ret := _m.Called(ctx) +// MockKubernetesConnector_GetDBNamespaces_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDBNamespaces' +type MockKubernetesConnector_GetDBNamespaces_Call struct { + *mock.Call +} + +// GetDBNamespaces is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockKubernetesConnector_Expecter) GetDBNamespaces(ctx interface{}) *MockKubernetesConnector_GetDBNamespaces_Call { + return &MockKubernetesConnector_GetDBNamespaces_Call{Call: _e.mock.On("GetDBNamespaces", ctx)} +} + +func (_c *MockKubernetesConnector_GetDBNamespaces_Call) Run(run func(ctx context.Context)) *MockKubernetesConnector_GetDBNamespaces_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetDBNamespaces_Call) Return(_a0 []string, _a1 error) *MockKubernetesConnector_GetDBNamespaces_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetDBNamespaces_Call) RunAndReturn(run func(context.Context) ([]string, error)) *MockKubernetesConnector_GetDBNamespaces_Call { + _c.Call.Return(run) + return _c +} + +// GetDatabaseCluster provides a mock function with given fields: ctx, namespace, name +func (_m *MockKubernetesConnector) GetDatabaseCluster(ctx context.Context, namespace string, name string) (*v1alpha1.DatabaseCluster, error) { + ret := _m.Called(ctx, namespace, name) if len(ret) == 0 { - panic("no return value specified for GetClusterType") + panic("no return value specified for GetDatabaseCluster") } - var r0 ClusterType + var r0 *v1alpha1.DatabaseCluster var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (ClusterType, error)); ok { - return rf(ctx) + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*v1alpha1.DatabaseCluster, error)); ok { + return rf(ctx, namespace, name) } - if rf, ok := ret.Get(0).(func(context.Context) ClusterType); ok { - r0 = rf(ctx) + if rf, ok := ret.Get(0).(func(context.Context, string, string) *v1alpha1.DatabaseCluster); ok { + r0 = rf(ctx, namespace, name) } else { - r0 = ret.Get(0).(ClusterType) + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v1alpha1.DatabaseCluster) + } } - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, namespace, name) } else { r1 = ret.Error(1) } @@ -567,24 +2127,54 @@ func (_m *MockKubernetesConnector) GetClusterType(ctx context.Context) (ClusterT return r0, r1 } -// GetConfigMap provides a mock function with given fields: ctx, namespace, name -func (_m *MockKubernetesConnector) GetConfigMap(ctx context.Context, namespace string, name string) (*v1.ConfigMap, error) { +// MockKubernetesConnector_GetDatabaseCluster_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseCluster' +type MockKubernetesConnector_GetDatabaseCluster_Call struct { + *mock.Call +} + +// GetDatabaseCluster is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) GetDatabaseCluster(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_GetDatabaseCluster_Call { + return &MockKubernetesConnector_GetDatabaseCluster_Call{Call: _e.mock.On("GetDatabaseCluster", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_GetDatabaseCluster_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_GetDatabaseCluster_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetDatabaseCluster_Call) Return(_a0 *v1alpha1.DatabaseCluster, _a1 error) *MockKubernetesConnector_GetDatabaseCluster_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetDatabaseCluster_Call) RunAndReturn(run func(context.Context, string, string) (*v1alpha1.DatabaseCluster, error)) *MockKubernetesConnector_GetDatabaseCluster_Call { + _c.Call.Return(run) + return _c +} + +// GetDatabaseClusterBackup provides a mock function with given fields: ctx, namespace, name +func (_m *MockKubernetesConnector) GetDatabaseClusterBackup(ctx context.Context, namespace string, name string) (*v1alpha1.DatabaseClusterBackup, error) { ret := _m.Called(ctx, namespace, name) if len(ret) == 0 { - panic("no return value specified for GetConfigMap") + panic("no return value specified for GetDatabaseClusterBackup") } - var r0 *v1.ConfigMap + var r0 *v1alpha1.DatabaseClusterBackup var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) (*v1.ConfigMap, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*v1alpha1.DatabaseClusterBackup, error)); ok { return rf(ctx, namespace, name) } - if rf, ok := ret.Get(0).(func(context.Context, string, string) *v1.ConfigMap); ok { + if rf, ok := ret.Get(0).(func(context.Context, string, string) *v1alpha1.DatabaseClusterBackup); ok { r0 = rf(ctx, namespace, name) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.ConfigMap) + r0 = ret.Get(0).(*v1alpha1.DatabaseClusterBackup) } } @@ -597,29 +2187,59 @@ func (_m *MockKubernetesConnector) GetConfigMap(ctx context.Context, namespace s return r0, r1 } -// GetDBNamespaces provides a mock function with given fields: ctx -func (_m *MockKubernetesConnector) GetDBNamespaces(ctx context.Context) ([]string, error) { - ret := _m.Called(ctx) +// MockKubernetesConnector_GetDatabaseClusterBackup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseClusterBackup' +type MockKubernetesConnector_GetDatabaseClusterBackup_Call struct { + *mock.Call +} + +// GetDatabaseClusterBackup is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) GetDatabaseClusterBackup(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_GetDatabaseClusterBackup_Call { + return &MockKubernetesConnector_GetDatabaseClusterBackup_Call{Call: _e.mock.On("GetDatabaseClusterBackup", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_GetDatabaseClusterBackup_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_GetDatabaseClusterBackup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetDatabaseClusterBackup_Call) Return(_a0 *v1alpha1.DatabaseClusterBackup, _a1 error) *MockKubernetesConnector_GetDatabaseClusterBackup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetDatabaseClusterBackup_Call) RunAndReturn(run func(context.Context, string, string) (*v1alpha1.DatabaseClusterBackup, error)) *MockKubernetesConnector_GetDatabaseClusterBackup_Call { + _c.Call.Return(run) + return _c +} + +// GetDatabaseClusterRestore provides a mock function with given fields: ctx, namespace, name +func (_m *MockKubernetesConnector) GetDatabaseClusterRestore(ctx context.Context, namespace string, name string) (*v1alpha1.DatabaseClusterRestore, error) { + ret := _m.Called(ctx, namespace, name) if len(ret) == 0 { - panic("no return value specified for GetDBNamespaces") + panic("no return value specified for GetDatabaseClusterRestore") } - var r0 []string + var r0 *v1alpha1.DatabaseClusterRestore var r1 error - if rf, ok := ret.Get(0).(func(context.Context) ([]string, error)); ok { - return rf(ctx) + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*v1alpha1.DatabaseClusterRestore, error)); ok { + return rf(ctx, namespace, name) } - if rf, ok := ret.Get(0).(func(context.Context) []string); ok { - r0 = rf(ctx) + if rf, ok := ret.Get(0).(func(context.Context, string, string) *v1alpha1.DatabaseClusterRestore); ok { + r0 = rf(ctx, namespace, name) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) + r0 = ret.Get(0).(*v1alpha1.DatabaseClusterRestore) } } - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, namespace, name) } else { r1 = ret.Error(1) } @@ -627,6 +2247,36 @@ func (_m *MockKubernetesConnector) GetDBNamespaces(ctx context.Context) ([]strin return r0, r1 } +// MockKubernetesConnector_GetDatabaseClusterRestore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseClusterRestore' +type MockKubernetesConnector_GetDatabaseClusterRestore_Call struct { + *mock.Call +} + +// GetDatabaseClusterRestore is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) GetDatabaseClusterRestore(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_GetDatabaseClusterRestore_Call { + return &MockKubernetesConnector_GetDatabaseClusterRestore_Call{Call: _e.mock.On("GetDatabaseClusterRestore", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_GetDatabaseClusterRestore_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_GetDatabaseClusterRestore_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetDatabaseClusterRestore_Call) Return(_a0 *v1alpha1.DatabaseClusterRestore, _a1 error) *MockKubernetesConnector_GetDatabaseClusterRestore_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetDatabaseClusterRestore_Call) RunAndReturn(run func(context.Context, string, string) (*v1alpha1.DatabaseClusterRestore, error)) *MockKubernetesConnector_GetDatabaseClusterRestore_Call { + _c.Call.Return(run) + return _c +} + // GetDatabaseEngine provides a mock function with given fields: ctx, namespace, name func (_m *MockKubernetesConnector) GetDatabaseEngine(ctx context.Context, namespace string, name string) (*v1alpha1.DatabaseEngine, error) { ret := _m.Called(ctx, namespace, name) @@ -657,6 +2307,36 @@ func (_m *MockKubernetesConnector) GetDatabaseEngine(ctx context.Context, namesp return r0, r1 } +// MockKubernetesConnector_GetDatabaseEngine_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseEngine' +type MockKubernetesConnector_GetDatabaseEngine_Call struct { + *mock.Call +} + +// GetDatabaseEngine is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) GetDatabaseEngine(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_GetDatabaseEngine_Call { + return &MockKubernetesConnector_GetDatabaseEngine_Call{Call: _e.mock.On("GetDatabaseEngine", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_GetDatabaseEngine_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_GetDatabaseEngine_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetDatabaseEngine_Call) Return(_a0 *v1alpha1.DatabaseEngine, _a1 error) *MockKubernetesConnector_GetDatabaseEngine_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetDatabaseEngine_Call) RunAndReturn(run func(context.Context, string, string) (*v1alpha1.DatabaseEngine, error)) *MockKubernetesConnector_GetDatabaseEngine_Call { + _c.Call.Return(run) + return _c +} + // GetDeployment provides a mock function with given fields: ctx, name, namespace func (_m *MockKubernetesConnector) GetDeployment(ctx context.Context, name string, namespace string) (*appsv1.Deployment, error) { ret := _m.Called(ctx, name, namespace) @@ -687,6 +2367,36 @@ func (_m *MockKubernetesConnector) GetDeployment(ctx context.Context, name strin return r0, r1 } +// MockKubernetesConnector_GetDeployment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDeployment' +type MockKubernetesConnector_GetDeployment_Call struct { + *mock.Call +} + +// GetDeployment is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - namespace string +func (_e *MockKubernetesConnector_Expecter) GetDeployment(ctx interface{}, name interface{}, namespace interface{}) *MockKubernetesConnector_GetDeployment_Call { + return &MockKubernetesConnector_GetDeployment_Call{Call: _e.mock.On("GetDeployment", ctx, name, namespace)} +} + +func (_c *MockKubernetesConnector_GetDeployment_Call) Run(run func(ctx context.Context, name string, namespace string)) *MockKubernetesConnector_GetDeployment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetDeployment_Call) Return(_a0 *appsv1.Deployment, _a1 error) *MockKubernetesConnector_GetDeployment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetDeployment_Call) RunAndReturn(run func(context.Context, string, string) (*appsv1.Deployment, error)) *MockKubernetesConnector_GetDeployment_Call { + _c.Call.Return(run) + return _c +} + // GetEverestID provides a mock function with given fields: ctx func (_m *MockKubernetesConnector) GetEverestID(ctx context.Context) (string, error) { ret := _m.Called(ctx) @@ -715,6 +2425,34 @@ func (_m *MockKubernetesConnector) GetEverestID(ctx context.Context) (string, er return r0, r1 } +// MockKubernetesConnector_GetEverestID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEverestID' +type MockKubernetesConnector_GetEverestID_Call struct { + *mock.Call +} + +// GetEverestID is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockKubernetesConnector_Expecter) GetEverestID(ctx interface{}) *MockKubernetesConnector_GetEverestID_Call { + return &MockKubernetesConnector_GetEverestID_Call{Call: _e.mock.On("GetEverestID", ctx)} +} + +func (_c *MockKubernetesConnector_GetEverestID_Call) Run(run func(ctx context.Context)) *MockKubernetesConnector_GetEverestID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetEverestID_Call) Return(_a0 string, _a1 error) *MockKubernetesConnector_GetEverestID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetEverestID_Call) RunAndReturn(run func(context.Context) (string, error)) *MockKubernetesConnector_GetEverestID_Call { + _c.Call.Return(run) + return _c +} + // GetEverestSettings provides a mock function with given fields: ctx func (_m *MockKubernetesConnector) GetEverestSettings(ctx context.Context) (common.EverestSettings, error) { ret := _m.Called(ctx) @@ -743,6 +2481,34 @@ func (_m *MockKubernetesConnector) GetEverestSettings(ctx context.Context) (comm return r0, r1 } +// MockKubernetesConnector_GetEverestSettings_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEverestSettings' +type MockKubernetesConnector_GetEverestSettings_Call struct { + *mock.Call +} + +// GetEverestSettings is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockKubernetesConnector_Expecter) GetEverestSettings(ctx interface{}) *MockKubernetesConnector_GetEverestSettings_Call { + return &MockKubernetesConnector_GetEverestSettings_Call{Call: _e.mock.On("GetEverestSettings", ctx)} +} + +func (_c *MockKubernetesConnector_GetEverestSettings_Call) Run(run func(ctx context.Context)) *MockKubernetesConnector_GetEverestSettings_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetEverestSettings_Call) Return(_a0 common.EverestSettings, _a1 error) *MockKubernetesConnector_GetEverestSettings_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetEverestSettings_Call) RunAndReturn(run func(context.Context) (common.EverestSettings, error)) *MockKubernetesConnector_GetEverestSettings_Call { + _c.Call.Return(run) + return _c +} + // GetMonitoringConfig provides a mock function with given fields: ctx, namespace, name func (_m *MockKubernetesConnector) GetMonitoringConfig(ctx context.Context, namespace string, name string) (*v1alpha1.MonitoringConfig, error) { ret := _m.Called(ctx, namespace, name) @@ -773,6 +2539,36 @@ func (_m *MockKubernetesConnector) GetMonitoringConfig(ctx context.Context, name return r0, r1 } +// MockKubernetesConnector_GetMonitoringConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMonitoringConfig' +type MockKubernetesConnector_GetMonitoringConfig_Call struct { + *mock.Call +} + +// GetMonitoringConfig is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) GetMonitoringConfig(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_GetMonitoringConfig_Call { + return &MockKubernetesConnector_GetMonitoringConfig_Call{Call: _e.mock.On("GetMonitoringConfig", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_GetMonitoringConfig_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_GetMonitoringConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetMonitoringConfig_Call) Return(_a0 *v1alpha1.MonitoringConfig, _a1 error) *MockKubernetesConnector_GetMonitoringConfig_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetMonitoringConfig_Call) RunAndReturn(run func(context.Context, string, string) (*v1alpha1.MonitoringConfig, error)) *MockKubernetesConnector_GetMonitoringConfig_Call { + _c.Call.Return(run) + return _c +} + // GetMonitoringConfigsBySecretName provides a mock function with given fields: ctx, namespace, secretName func (_m *MockKubernetesConnector) GetMonitoringConfigsBySecretName(ctx context.Context, namespace string, secretName string) ([]*v1alpha1.MonitoringConfig, error) { ret := _m.Called(ctx, namespace, secretName) @@ -803,29 +2599,176 @@ func (_m *MockKubernetesConnector) GetMonitoringConfigsBySecretName(ctx context. return r0, r1 } -// GetNamespace provides a mock function with given fields: ctx, name -func (_m *MockKubernetesConnector) GetNamespace(ctx context.Context, name string) (*v1.Namespace, error) { - ret := _m.Called(ctx, name) +// MockKubernetesConnector_GetMonitoringConfigsBySecretName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMonitoringConfigsBySecretName' +type MockKubernetesConnector_GetMonitoringConfigsBySecretName_Call struct { + *mock.Call +} + +// GetMonitoringConfigsBySecretName is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - secretName string +func (_e *MockKubernetesConnector_Expecter) GetMonitoringConfigsBySecretName(ctx interface{}, namespace interface{}, secretName interface{}) *MockKubernetesConnector_GetMonitoringConfigsBySecretName_Call { + return &MockKubernetesConnector_GetMonitoringConfigsBySecretName_Call{Call: _e.mock.On("GetMonitoringConfigsBySecretName", ctx, namespace, secretName)} +} + +func (_c *MockKubernetesConnector_GetMonitoringConfigsBySecretName_Call) Run(run func(ctx context.Context, namespace string, secretName string)) *MockKubernetesConnector_GetMonitoringConfigsBySecretName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetMonitoringConfigsBySecretName_Call) Return(_a0 []*v1alpha1.MonitoringConfig, _a1 error) *MockKubernetesConnector_GetMonitoringConfigsBySecretName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetMonitoringConfigsBySecretName_Call) RunAndReturn(run func(context.Context, string, string) ([]*v1alpha1.MonitoringConfig, error)) *MockKubernetesConnector_GetMonitoringConfigsBySecretName_Call { + _c.Call.Return(run) + return _c +} + +// GetNamespace provides a mock function with given fields: ctx, name +func (_m *MockKubernetesConnector) GetNamespace(ctx context.Context, name string) (*corev1.Namespace, error) { + ret := _m.Called(ctx, name) + + if len(ret) == 0 { + panic("no return value specified for GetNamespace") + } + + var r0 *corev1.Namespace + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*corev1.Namespace, error)); ok { + return rf(ctx, name) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *corev1.Namespace); ok { + r0 = rf(ctx, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*corev1.Namespace) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_GetNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNamespace' +type MockKubernetesConnector_GetNamespace_Call struct { + *mock.Call +} + +// GetNamespace is a helper method to define mock.On call +// - ctx context.Context +// - name string +func (_e *MockKubernetesConnector_Expecter) GetNamespace(ctx interface{}, name interface{}) *MockKubernetesConnector_GetNamespace_Call { + return &MockKubernetesConnector_GetNamespace_Call{Call: _e.mock.On("GetNamespace", ctx, name)} +} + +func (_c *MockKubernetesConnector_GetNamespace_Call) Run(run func(ctx context.Context, name string)) *MockKubernetesConnector_GetNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetNamespace_Call) Return(_a0 *corev1.Namespace, _a1 error) *MockKubernetesConnector_GetNamespace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetNamespace_Call) RunAndReturn(run func(context.Context, string) (*corev1.Namespace, error)) *MockKubernetesConnector_GetNamespace_Call { + _c.Call.Return(run) + return _c +} + +// GetPersistentVolumes provides a mock function with given fields: ctx +func (_m *MockKubernetesConnector) GetPersistentVolumes(ctx context.Context) (*corev1.PersistentVolumeList, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetPersistentVolumes") + } + + var r0 *corev1.PersistentVolumeList + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*corev1.PersistentVolumeList, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) *corev1.PersistentVolumeList); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*corev1.PersistentVolumeList) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_GetPersistentVolumes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPersistentVolumes' +type MockKubernetesConnector_GetPersistentVolumes_Call struct { + *mock.Call +} + +// GetPersistentVolumes is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockKubernetesConnector_Expecter) GetPersistentVolumes(ctx interface{}) *MockKubernetesConnector_GetPersistentVolumes_Call { + return &MockKubernetesConnector_GetPersistentVolumes_Call{Call: _e.mock.On("GetPersistentVolumes", ctx)} +} + +func (_c *MockKubernetesConnector_GetPersistentVolumes_Call) Run(run func(ctx context.Context)) *MockKubernetesConnector_GetPersistentVolumes_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetPersistentVolumes_Call) Return(_a0 *corev1.PersistentVolumeList, _a1 error) *MockKubernetesConnector_GetPersistentVolumes_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetPersistentVolumes_Call) RunAndReturn(run func(context.Context) (*corev1.PersistentVolumeList, error)) *MockKubernetesConnector_GetPersistentVolumes_Call { + _c.Call.Return(run) + return _c +} + +// GetPods provides a mock function with given fields: ctx, namespace, labelSelector +func (_m *MockKubernetesConnector) GetPods(ctx context.Context, namespace string, labelSelector *metav1.LabelSelector) (*corev1.PodList, error) { + ret := _m.Called(ctx, namespace, labelSelector) if len(ret) == 0 { - panic("no return value specified for GetNamespace") + panic("no return value specified for GetPods") } - var r0 *v1.Namespace + var r0 *corev1.PodList var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*v1.Namespace, error)); ok { - return rf(ctx, name) + if rf, ok := ret.Get(0).(func(context.Context, string, *metav1.LabelSelector) (*corev1.PodList, error)); ok { + return rf(ctx, namespace, labelSelector) } - if rf, ok := ret.Get(0).(func(context.Context, string) *v1.Namespace); ok { - r0 = rf(ctx, name) + if rf, ok := ret.Get(0).(func(context.Context, string, *metav1.LabelSelector) *corev1.PodList); ok { + r0 = rf(ctx, namespace, labelSelector) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Namespace) + r0 = ret.Get(0).(*corev1.PodList) } } - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, name) + if rf, ok := ret.Get(1).(func(context.Context, string, *metav1.LabelSelector) error); ok { + r1 = rf(ctx, namespace, labelSelector) } else { r1 = ret.Error(1) } @@ -833,24 +2776,54 @@ func (_m *MockKubernetesConnector) GetNamespace(ctx context.Context, name string return r0, r1 } +// MockKubernetesConnector_GetPods_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPods' +type MockKubernetesConnector_GetPods_Call struct { + *mock.Call +} + +// GetPods is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - labelSelector *metav1.LabelSelector +func (_e *MockKubernetesConnector_Expecter) GetPods(ctx interface{}, namespace interface{}, labelSelector interface{}) *MockKubernetesConnector_GetPods_Call { + return &MockKubernetesConnector_GetPods_Call{Call: _e.mock.On("GetPods", ctx, namespace, labelSelector)} +} + +func (_c *MockKubernetesConnector_GetPods_Call) Run(run func(ctx context.Context, namespace string, labelSelector *metav1.LabelSelector)) *MockKubernetesConnector_GetPods_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(*metav1.LabelSelector)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetPods_Call) Return(_a0 *corev1.PodList, _a1 error) *MockKubernetesConnector_GetPods_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetPods_Call) RunAndReturn(run func(context.Context, string, *metav1.LabelSelector) (*corev1.PodList, error)) *MockKubernetesConnector_GetPods_Call { + _c.Call.Return(run) + return _c +} + // GetSecret provides a mock function with given fields: ctx, namespace, name -func (_m *MockKubernetesConnector) GetSecret(ctx context.Context, namespace string, name string) (*v1.Secret, error) { +func (_m *MockKubernetesConnector) GetSecret(ctx context.Context, namespace string, name string) (*corev1.Secret, error) { ret := _m.Called(ctx, namespace, name) if len(ret) == 0 { panic("no return value specified for GetSecret") } - var r0 *v1.Secret + var r0 *corev1.Secret var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) (*v1.Secret, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*corev1.Secret, error)); ok { return rf(ctx, namespace, name) } - if rf, ok := ret.Get(0).(func(context.Context, string, string) *v1.Secret); ok { + if rf, ok := ret.Get(0).(func(context.Context, string, string) *corev1.Secret); ok { r0 = rf(ctx, namespace, name) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Secret) + r0 = ret.Get(0).(*corev1.Secret) } } @@ -863,6 +2836,36 @@ func (_m *MockKubernetesConnector) GetSecret(ctx context.Context, namespace stri return r0, r1 } +// MockKubernetesConnector_GetSecret_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSecret' +type MockKubernetesConnector_GetSecret_Call struct { + *mock.Call +} + +// GetSecret is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) GetSecret(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_GetSecret_Call { + return &MockKubernetesConnector_GetSecret_Call{Call: _e.mock.On("GetSecret", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_GetSecret_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_GetSecret_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetSecret_Call) Return(_a0 *corev1.Secret, _a1 error) *MockKubernetesConnector_GetSecret_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetSecret_Call) RunAndReturn(run func(context.Context, string, string) (*corev1.Secret, error)) *MockKubernetesConnector_GetSecret_Call { + _c.Call.Return(run) + return _c +} + // GetServerVersion provides a mock function with given fields: func (_m *MockKubernetesConnector) GetServerVersion() (*version.Info, error) { ret := _m.Called() @@ -893,6 +2896,91 @@ func (_m *MockKubernetesConnector) GetServerVersion() (*version.Info, error) { return r0, r1 } +// MockKubernetesConnector_GetServerVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetServerVersion' +type MockKubernetesConnector_GetServerVersion_Call struct { + *mock.Call +} + +// GetServerVersion is a helper method to define mock.On call +func (_e *MockKubernetesConnector_Expecter) GetServerVersion() *MockKubernetesConnector_GetServerVersion_Call { + return &MockKubernetesConnector_GetServerVersion_Call{Call: _e.mock.On("GetServerVersion")} +} + +func (_c *MockKubernetesConnector_GetServerVersion_Call) Run(run func()) *MockKubernetesConnector_GetServerVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockKubernetesConnector_GetServerVersion_Call) Return(_a0 *version.Info, _a1 error) *MockKubernetesConnector_GetServerVersion_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetServerVersion_Call) RunAndReturn(run func() (*version.Info, error)) *MockKubernetesConnector_GetServerVersion_Call { + _c.Call.Return(run) + return _c +} + +// GetStorageClasses provides a mock function with given fields: ctx +func (_m *MockKubernetesConnector) GetStorageClasses(ctx context.Context) (*storagev1.StorageClassList, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetStorageClasses") + } + + var r0 *storagev1.StorageClassList + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*storagev1.StorageClassList, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) *storagev1.StorageClassList); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storagev1.StorageClassList) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_GetStorageClasses_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStorageClasses' +type MockKubernetesConnector_GetStorageClasses_Call struct { + *mock.Call +} + +// GetStorageClasses is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockKubernetesConnector_Expecter) GetStorageClasses(ctx interface{}) *MockKubernetesConnector_GetStorageClasses_Call { + return &MockKubernetesConnector_GetStorageClasses_Call{Call: _e.mock.On("GetStorageClasses", ctx)} +} + +func (_c *MockKubernetesConnector_GetStorageClasses_Call) Run(run func(ctx context.Context)) *MockKubernetesConnector_GetStorageClasses_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetStorageClasses_Call) Return(_a0 *storagev1.StorageClassList, _a1 error) *MockKubernetesConnector_GetStorageClasses_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetStorageClasses_Call) RunAndReturn(run func(context.Context) (*storagev1.StorageClassList, error)) *MockKubernetesConnector_GetStorageClasses_Call { + _c.Call.Return(run) + return _c +} + // GetSubscription provides a mock function with given fields: ctx, name, namespace func (_m *MockKubernetesConnector) GetSubscription(ctx context.Context, name string, namespace string) (*operatorsv1alpha1.Subscription, error) { ret := _m.Called(ctx, name, namespace) @@ -923,6 +3011,94 @@ func (_m *MockKubernetesConnector) GetSubscription(ctx context.Context, name str return r0, r1 } +// MockKubernetesConnector_GetSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSubscription' +type MockKubernetesConnector_GetSubscription_Call struct { + *mock.Call +} + +// GetSubscription is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - namespace string +func (_e *MockKubernetesConnector_Expecter) GetSubscription(ctx interface{}, name interface{}, namespace interface{}) *MockKubernetesConnector_GetSubscription_Call { + return &MockKubernetesConnector_GetSubscription_Call{Call: _e.mock.On("GetSubscription", ctx, name, namespace)} +} + +func (_c *MockKubernetesConnector_GetSubscription_Call) Run(run func(ctx context.Context, name string, namespace string)) *MockKubernetesConnector_GetSubscription_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetSubscription_Call) Return(_a0 *operatorsv1alpha1.Subscription, _a1 error) *MockKubernetesConnector_GetSubscription_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetSubscription_Call) RunAndReturn(run func(context.Context, string, string) (*operatorsv1alpha1.Subscription, error)) *MockKubernetesConnector_GetSubscription_Call { + _c.Call.Return(run) + return _c +} + +// GetWorkerNodes provides a mock function with given fields: ctx +func (_m *MockKubernetesConnector) GetWorkerNodes(ctx context.Context) ([]corev1.Node, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetWorkerNodes") + } + + var r0 []corev1.Node + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) ([]corev1.Node, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) []corev1.Node); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]corev1.Node) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_GetWorkerNodes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkerNodes' +type MockKubernetesConnector_GetWorkerNodes_Call struct { + *mock.Call +} + +// GetWorkerNodes is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockKubernetesConnector_Expecter) GetWorkerNodes(ctx interface{}) *MockKubernetesConnector_GetWorkerNodes_Call { + return &MockKubernetesConnector_GetWorkerNodes_Call{Call: _e.mock.On("GetWorkerNodes", ctx)} +} + +func (_c *MockKubernetesConnector_GetWorkerNodes_Call) Run(run func(ctx context.Context)) *MockKubernetesConnector_GetWorkerNodes_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockKubernetesConnector_GetWorkerNodes_Call) Return(_a0 []corev1.Node, _a1 error) *MockKubernetesConnector_GetWorkerNodes_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_GetWorkerNodes_Call) RunAndReturn(run func(context.Context) ([]corev1.Node, error)) *MockKubernetesConnector_GetWorkerNodes_Call { + _c.Call.Return(run) + return _c +} + // IsBackupStorageUsed provides a mock function with given fields: ctx, namespace, name func (_m *MockKubernetesConnector) IsBackupStorageUsed(ctx context.Context, namespace string, name string) (bool, error) { ret := _m.Called(ctx, namespace, name) @@ -951,6 +3127,36 @@ func (_m *MockKubernetesConnector) IsBackupStorageUsed(ctx context.Context, name return r0, r1 } +// MockKubernetesConnector_IsBackupStorageUsed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsBackupStorageUsed' +type MockKubernetesConnector_IsBackupStorageUsed_Call struct { + *mock.Call +} + +// IsBackupStorageUsed is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) IsBackupStorageUsed(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_IsBackupStorageUsed_Call { + return &MockKubernetesConnector_IsBackupStorageUsed_Call{Call: _e.mock.On("IsBackupStorageUsed", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_IsBackupStorageUsed_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_IsBackupStorageUsed_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_IsBackupStorageUsed_Call) Return(_a0 bool, _a1 error) *MockKubernetesConnector_IsBackupStorageUsed_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_IsBackupStorageUsed_Call) RunAndReturn(run func(context.Context, string, string) (bool, error)) *MockKubernetesConnector_IsBackupStorageUsed_Call { + _c.Call.Return(run) + return _c +} + // IsMonitoringConfigUsed provides a mock function with given fields: ctx, namespace, name func (_m *MockKubernetesConnector) IsMonitoringConfigUsed(ctx context.Context, namespace string, name string) (bool, error) { ret := _m.Called(ctx, namespace, name) @@ -979,6 +3185,36 @@ func (_m *MockKubernetesConnector) IsMonitoringConfigUsed(ctx context.Context, n return r0, r1 } +// MockKubernetesConnector_IsMonitoringConfigUsed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsMonitoringConfigUsed' +type MockKubernetesConnector_IsMonitoringConfigUsed_Call struct { + *mock.Call +} + +// IsMonitoringConfigUsed is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) IsMonitoringConfigUsed(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_IsMonitoringConfigUsed_Call { + return &MockKubernetesConnector_IsMonitoringConfigUsed_Call{Call: _e.mock.On("IsMonitoringConfigUsed", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_IsMonitoringConfigUsed_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_IsMonitoringConfigUsed_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_IsMonitoringConfigUsed_Call) Return(_a0 bool, _a1 error) *MockKubernetesConnector_IsMonitoringConfigUsed_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_IsMonitoringConfigUsed_Call) RunAndReturn(run func(context.Context, string, string) (bool, error)) *MockKubernetesConnector_IsMonitoringConfigUsed_Call { + _c.Call.Return(run) + return _c +} + // Kubeconfig provides a mock function with given fields: func (_m *MockKubernetesConnector) Kubeconfig() string { ret := _m.Called() @@ -997,6 +3233,33 @@ func (_m *MockKubernetesConnector) Kubeconfig() string { return r0 } +// MockKubernetesConnector_Kubeconfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Kubeconfig' +type MockKubernetesConnector_Kubeconfig_Call struct { + *mock.Call +} + +// Kubeconfig is a helper method to define mock.On call +func (_e *MockKubernetesConnector_Expecter) Kubeconfig() *MockKubernetesConnector_Kubeconfig_Call { + return &MockKubernetesConnector_Kubeconfig_Call{Call: _e.mock.On("Kubeconfig")} +} + +func (_c *MockKubernetesConnector_Kubeconfig_Call) Run(run func()) *MockKubernetesConnector_Kubeconfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockKubernetesConnector_Kubeconfig_Call) Return(_a0 string) *MockKubernetesConnector_Kubeconfig_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_Kubeconfig_Call) RunAndReturn(run func() string) *MockKubernetesConnector_Kubeconfig_Call { + _c.Call.Return(run) + return _c +} + // ListBackupStorages provides a mock function with given fields: ctx, namespace func (_m *MockKubernetesConnector) ListBackupStorages(ctx context.Context, namespace string) (*v1alpha1.BackupStorageList, error) { ret := _m.Called(ctx, namespace) @@ -1027,6 +3290,35 @@ func (_m *MockKubernetesConnector) ListBackupStorages(ctx context.Context, names return r0, r1 } +// MockKubernetesConnector_ListBackupStorages_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListBackupStorages' +type MockKubernetesConnector_ListBackupStorages_Call struct { + *mock.Call +} + +// ListBackupStorages is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +func (_e *MockKubernetesConnector_Expecter) ListBackupStorages(ctx interface{}, namespace interface{}) *MockKubernetesConnector_ListBackupStorages_Call { + return &MockKubernetesConnector_ListBackupStorages_Call{Call: _e.mock.On("ListBackupStorages", ctx, namespace)} +} + +func (_c *MockKubernetesConnector_ListBackupStorages_Call) Run(run func(ctx context.Context, namespace string)) *MockKubernetesConnector_ListBackupStorages_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_ListBackupStorages_Call) Return(_a0 *v1alpha1.BackupStorageList, _a1 error) *MockKubernetesConnector_ListBackupStorages_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_ListBackupStorages_Call) RunAndReturn(run func(context.Context, string) (*v1alpha1.BackupStorageList, error)) *MockKubernetesConnector_ListBackupStorages_Call { + _c.Call.Return(run) + return _c +} + // ListCRDs provides a mock function with given fields: ctx func (_m *MockKubernetesConnector) ListCRDs(ctx context.Context) (*apiextensionsv1.CustomResourceDefinitionList, error) { ret := _m.Called(ctx) @@ -1057,24 +3349,231 @@ func (_m *MockKubernetesConnector) ListCRDs(ctx context.Context) (*apiextensions return r0, r1 } +// MockKubernetesConnector_ListCRDs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCRDs' +type MockKubernetesConnector_ListCRDs_Call struct { + *mock.Call +} + +// ListCRDs is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockKubernetesConnector_Expecter) ListCRDs(ctx interface{}) *MockKubernetesConnector_ListCRDs_Call { + return &MockKubernetesConnector_ListCRDs_Call{Call: _e.mock.On("ListCRDs", ctx)} +} + +func (_c *MockKubernetesConnector_ListCRDs_Call) Run(run func(ctx context.Context)) *MockKubernetesConnector_ListCRDs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockKubernetesConnector_ListCRDs_Call) Return(_a0 *apiextensionsv1.CustomResourceDefinitionList, _a1 error) *MockKubernetesConnector_ListCRDs_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_ListCRDs_Call) RunAndReturn(run func(context.Context) (*apiextensionsv1.CustomResourceDefinitionList, error)) *MockKubernetesConnector_ListCRDs_Call { + _c.Call.Return(run) + return _c +} + // ListClusterServiceVersion provides a mock function with given fields: ctx, namespace func (_m *MockKubernetesConnector) ListClusterServiceVersion(ctx context.Context, namespace string) (*operatorsv1alpha1.ClusterServiceVersionList, error) { ret := _m.Called(ctx, namespace) if len(ret) == 0 { - panic("no return value specified for ListClusterServiceVersion") + panic("no return value specified for ListClusterServiceVersion") + } + + var r0 *operatorsv1alpha1.ClusterServiceVersionList + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*operatorsv1alpha1.ClusterServiceVersionList, error)); ok { + return rf(ctx, namespace) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *operatorsv1alpha1.ClusterServiceVersionList); ok { + r0 = rf(ctx, namespace) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*operatorsv1alpha1.ClusterServiceVersionList) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, namespace) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_ListClusterServiceVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListClusterServiceVersion' +type MockKubernetesConnector_ListClusterServiceVersion_Call struct { + *mock.Call +} + +// ListClusterServiceVersion is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +func (_e *MockKubernetesConnector_Expecter) ListClusterServiceVersion(ctx interface{}, namespace interface{}) *MockKubernetesConnector_ListClusterServiceVersion_Call { + return &MockKubernetesConnector_ListClusterServiceVersion_Call{Call: _e.mock.On("ListClusterServiceVersion", ctx, namespace)} +} + +func (_c *MockKubernetesConnector_ListClusterServiceVersion_Call) Run(run func(ctx context.Context, namespace string)) *MockKubernetesConnector_ListClusterServiceVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_ListClusterServiceVersion_Call) Return(_a0 *operatorsv1alpha1.ClusterServiceVersionList, _a1 error) *MockKubernetesConnector_ListClusterServiceVersion_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_ListClusterServiceVersion_Call) RunAndReturn(run func(context.Context, string) (*operatorsv1alpha1.ClusterServiceVersionList, error)) *MockKubernetesConnector_ListClusterServiceVersion_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseClusterBackups provides a mock function with given fields: ctx, namespace, options +func (_m *MockKubernetesConnector) ListDatabaseClusterBackups(ctx context.Context, namespace string, options metav1.ListOptions) (*v1alpha1.DatabaseClusterBackupList, error) { + ret := _m.Called(ctx, namespace, options) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseClusterBackups") + } + + var r0 *v1alpha1.DatabaseClusterBackupList + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, metav1.ListOptions) (*v1alpha1.DatabaseClusterBackupList, error)); ok { + return rf(ctx, namespace, options) + } + if rf, ok := ret.Get(0).(func(context.Context, string, metav1.ListOptions) *v1alpha1.DatabaseClusterBackupList); ok { + r0 = rf(ctx, namespace, options) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v1alpha1.DatabaseClusterBackupList) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, metav1.ListOptions) error); ok { + r1 = rf(ctx, namespace, options) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_ListDatabaseClusterBackups_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseClusterBackups' +type MockKubernetesConnector_ListDatabaseClusterBackups_Call struct { + *mock.Call +} + +// ListDatabaseClusterBackups is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - options metav1.ListOptions +func (_e *MockKubernetesConnector_Expecter) ListDatabaseClusterBackups(ctx interface{}, namespace interface{}, options interface{}) *MockKubernetesConnector_ListDatabaseClusterBackups_Call { + return &MockKubernetesConnector_ListDatabaseClusterBackups_Call{Call: _e.mock.On("ListDatabaseClusterBackups", ctx, namespace, options)} +} + +func (_c *MockKubernetesConnector_ListDatabaseClusterBackups_Call) Run(run func(ctx context.Context, namespace string, options metav1.ListOptions)) *MockKubernetesConnector_ListDatabaseClusterBackups_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(metav1.ListOptions)) + }) + return _c +} + +func (_c *MockKubernetesConnector_ListDatabaseClusterBackups_Call) Return(_a0 *v1alpha1.DatabaseClusterBackupList, _a1 error) *MockKubernetesConnector_ListDatabaseClusterBackups_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_ListDatabaseClusterBackups_Call) RunAndReturn(run func(context.Context, string, metav1.ListOptions) (*v1alpha1.DatabaseClusterBackupList, error)) *MockKubernetesConnector_ListDatabaseClusterBackups_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseClusterRestores provides a mock function with given fields: ctx, namespace, options +func (_m *MockKubernetesConnector) ListDatabaseClusterRestores(ctx context.Context, namespace string, options metav1.ListOptions) (*v1alpha1.DatabaseClusterRestoreList, error) { + ret := _m.Called(ctx, namespace, options) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseClusterRestores") + } + + var r0 *v1alpha1.DatabaseClusterRestoreList + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, metav1.ListOptions) (*v1alpha1.DatabaseClusterRestoreList, error)); ok { + return rf(ctx, namespace, options) + } + if rf, ok := ret.Get(0).(func(context.Context, string, metav1.ListOptions) *v1alpha1.DatabaseClusterRestoreList); ok { + r0 = rf(ctx, namespace, options) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v1alpha1.DatabaseClusterRestoreList) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, metav1.ListOptions) error); ok { + r1 = rf(ctx, namespace, options) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_ListDatabaseClusterRestores_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseClusterRestores' +type MockKubernetesConnector_ListDatabaseClusterRestores_Call struct { + *mock.Call +} + +// ListDatabaseClusterRestores is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - options metav1.ListOptions +func (_e *MockKubernetesConnector_Expecter) ListDatabaseClusterRestores(ctx interface{}, namespace interface{}, options interface{}) *MockKubernetesConnector_ListDatabaseClusterRestores_Call { + return &MockKubernetesConnector_ListDatabaseClusterRestores_Call{Call: _e.mock.On("ListDatabaseClusterRestores", ctx, namespace, options)} +} + +func (_c *MockKubernetesConnector_ListDatabaseClusterRestores_Call) Run(run func(ctx context.Context, namespace string, options metav1.ListOptions)) *MockKubernetesConnector_ListDatabaseClusterRestores_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(metav1.ListOptions)) + }) + return _c +} + +func (_c *MockKubernetesConnector_ListDatabaseClusterRestores_Call) Return(_a0 *v1alpha1.DatabaseClusterRestoreList, _a1 error) *MockKubernetesConnector_ListDatabaseClusterRestores_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_ListDatabaseClusterRestores_Call) RunAndReturn(run func(context.Context, string, metav1.ListOptions) (*v1alpha1.DatabaseClusterRestoreList, error)) *MockKubernetesConnector_ListDatabaseClusterRestores_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseClusters provides a mock function with given fields: ctx, namespace +func (_m *MockKubernetesConnector) ListDatabaseClusters(ctx context.Context, namespace string) (*v1alpha1.DatabaseClusterList, error) { + ret := _m.Called(ctx, namespace) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseClusters") } - var r0 *operatorsv1alpha1.ClusterServiceVersionList + var r0 *v1alpha1.DatabaseClusterList var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*operatorsv1alpha1.ClusterServiceVersionList, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, string) (*v1alpha1.DatabaseClusterList, error)); ok { return rf(ctx, namespace) } - if rf, ok := ret.Get(0).(func(context.Context, string) *operatorsv1alpha1.ClusterServiceVersionList); ok { + if rf, ok := ret.Get(0).(func(context.Context, string) *v1alpha1.DatabaseClusterList); ok { r0 = rf(ctx, namespace) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*operatorsv1alpha1.ClusterServiceVersionList) + r0 = ret.Get(0).(*v1alpha1.DatabaseClusterList) } } @@ -1087,6 +3586,35 @@ func (_m *MockKubernetesConnector) ListClusterServiceVersion(ctx context.Context return r0, r1 } +// MockKubernetesConnector_ListDatabaseClusters_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseClusters' +type MockKubernetesConnector_ListDatabaseClusters_Call struct { + *mock.Call +} + +// ListDatabaseClusters is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +func (_e *MockKubernetesConnector_Expecter) ListDatabaseClusters(ctx interface{}, namespace interface{}) *MockKubernetesConnector_ListDatabaseClusters_Call { + return &MockKubernetesConnector_ListDatabaseClusters_Call{Call: _e.mock.On("ListDatabaseClusters", ctx, namespace)} +} + +func (_c *MockKubernetesConnector_ListDatabaseClusters_Call) Run(run func(ctx context.Context, namespace string)) *MockKubernetesConnector_ListDatabaseClusters_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_ListDatabaseClusters_Call) Return(_a0 *v1alpha1.DatabaseClusterList, _a1 error) *MockKubernetesConnector_ListDatabaseClusters_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_ListDatabaseClusters_Call) RunAndReturn(run func(context.Context, string) (*v1alpha1.DatabaseClusterList, error)) *MockKubernetesConnector_ListDatabaseClusters_Call { + _c.Call.Return(run) + return _c +} + // ListDatabaseEngines provides a mock function with given fields: ctx, namespace func (_m *MockKubernetesConnector) ListDatabaseEngines(ctx context.Context, namespace string) (*v1alpha1.DatabaseEngineList, error) { ret := _m.Called(ctx, namespace) @@ -1117,6 +3645,35 @@ func (_m *MockKubernetesConnector) ListDatabaseEngines(ctx context.Context, name return r0, r1 } +// MockKubernetesConnector_ListDatabaseEngines_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseEngines' +type MockKubernetesConnector_ListDatabaseEngines_Call struct { + *mock.Call +} + +// ListDatabaseEngines is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +func (_e *MockKubernetesConnector_Expecter) ListDatabaseEngines(ctx interface{}, namespace interface{}) *MockKubernetesConnector_ListDatabaseEngines_Call { + return &MockKubernetesConnector_ListDatabaseEngines_Call{Call: _e.mock.On("ListDatabaseEngines", ctx, namespace)} +} + +func (_c *MockKubernetesConnector_ListDatabaseEngines_Call) Run(run func(ctx context.Context, namespace string)) *MockKubernetesConnector_ListDatabaseEngines_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_ListDatabaseEngines_Call) Return(_a0 *v1alpha1.DatabaseEngineList, _a1 error) *MockKubernetesConnector_ListDatabaseEngines_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_ListDatabaseEngines_Call) RunAndReturn(run func(context.Context, string) (*v1alpha1.DatabaseEngineList, error)) *MockKubernetesConnector_ListDatabaseEngines_Call { + _c.Call.Return(run) + return _c +} + // ListDeployments provides a mock function with given fields: ctx, namespace func (_m *MockKubernetesConnector) ListDeployments(ctx context.Context, namespace string) (*appsv1.DeploymentList, error) { ret := _m.Called(ctx, namespace) @@ -1147,6 +3704,35 @@ func (_m *MockKubernetesConnector) ListDeployments(ctx context.Context, namespac return r0, r1 } +// MockKubernetesConnector_ListDeployments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDeployments' +type MockKubernetesConnector_ListDeployments_Call struct { + *mock.Call +} + +// ListDeployments is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +func (_e *MockKubernetesConnector_Expecter) ListDeployments(ctx interface{}, namespace interface{}) *MockKubernetesConnector_ListDeployments_Call { + return &MockKubernetesConnector_ListDeployments_Call{Call: _e.mock.On("ListDeployments", ctx, namespace)} +} + +func (_c *MockKubernetesConnector_ListDeployments_Call) Run(run func(ctx context.Context, namespace string)) *MockKubernetesConnector_ListDeployments_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_ListDeployments_Call) Return(_a0 *appsv1.DeploymentList, _a1 error) *MockKubernetesConnector_ListDeployments_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_ListDeployments_Call) RunAndReturn(run func(context.Context, string) (*appsv1.DeploymentList, error)) *MockKubernetesConnector_ListDeployments_Call { + _c.Call.Return(run) + return _c +} + // ListMonitoringConfigs provides a mock function with given fields: ctx, namespace func (_m *MockKubernetesConnector) ListMonitoringConfigs(ctx context.Context, namespace string) (*v1alpha1.MonitoringConfigList, error) { ret := _m.Called(ctx, namespace) @@ -1177,24 +3763,53 @@ func (_m *MockKubernetesConnector) ListMonitoringConfigs(ctx context.Context, na return r0, r1 } +// MockKubernetesConnector_ListMonitoringConfigs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListMonitoringConfigs' +type MockKubernetesConnector_ListMonitoringConfigs_Call struct { + *mock.Call +} + +// ListMonitoringConfigs is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +func (_e *MockKubernetesConnector_Expecter) ListMonitoringConfigs(ctx interface{}, namespace interface{}) *MockKubernetesConnector_ListMonitoringConfigs_Call { + return &MockKubernetesConnector_ListMonitoringConfigs_Call{Call: _e.mock.On("ListMonitoringConfigs", ctx, namespace)} +} + +func (_c *MockKubernetesConnector_ListMonitoringConfigs_Call) Run(run func(ctx context.Context, namespace string)) *MockKubernetesConnector_ListMonitoringConfigs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_ListMonitoringConfigs_Call) Return(_a0 *v1alpha1.MonitoringConfigList, _a1 error) *MockKubernetesConnector_ListMonitoringConfigs_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_ListMonitoringConfigs_Call) RunAndReturn(run func(context.Context, string) (*v1alpha1.MonitoringConfigList, error)) *MockKubernetesConnector_ListMonitoringConfigs_Call { + _c.Call.Return(run) + return _c +} + // ListNamespaces provides a mock function with given fields: ctx, opts -func (_m *MockKubernetesConnector) ListNamespaces(ctx context.Context, opts metav1.ListOptions) (*v1.NamespaceList, error) { +func (_m *MockKubernetesConnector) ListNamespaces(ctx context.Context, opts metav1.ListOptions) (*corev1.NamespaceList, error) { ret := _m.Called(ctx, opts) if len(ret) == 0 { panic("no return value specified for ListNamespaces") } - var r0 *v1.NamespaceList + var r0 *corev1.NamespaceList var r1 error - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (*v1.NamespaceList, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) (*corev1.NamespaceList, error)); ok { return rf(ctx, opts) } - if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) *v1.NamespaceList); ok { + if rf, ok := ret.Get(0).(func(context.Context, metav1.ListOptions) *corev1.NamespaceList); ok { r0 = rf(ctx, opts) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.NamespaceList) + r0 = ret.Get(0).(*corev1.NamespaceList) } } @@ -1207,24 +3822,53 @@ func (_m *MockKubernetesConnector) ListNamespaces(ctx context.Context, opts meta return r0, r1 } +// MockKubernetesConnector_ListNamespaces_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListNamespaces' +type MockKubernetesConnector_ListNamespaces_Call struct { + *mock.Call +} + +// ListNamespaces is a helper method to define mock.On call +// - ctx context.Context +// - opts metav1.ListOptions +func (_e *MockKubernetesConnector_Expecter) ListNamespaces(ctx interface{}, opts interface{}) *MockKubernetesConnector_ListNamespaces_Call { + return &MockKubernetesConnector_ListNamespaces_Call{Call: _e.mock.On("ListNamespaces", ctx, opts)} +} + +func (_c *MockKubernetesConnector_ListNamespaces_Call) Run(run func(ctx context.Context, opts metav1.ListOptions)) *MockKubernetesConnector_ListNamespaces_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(metav1.ListOptions)) + }) + return _c +} + +func (_c *MockKubernetesConnector_ListNamespaces_Call) Return(_a0 *corev1.NamespaceList, _a1 error) *MockKubernetesConnector_ListNamespaces_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_ListNamespaces_Call) RunAndReturn(run func(context.Context, metav1.ListOptions) (*corev1.NamespaceList, error)) *MockKubernetesConnector_ListNamespaces_Call { + _c.Call.Return(run) + return _c +} + // ListSecrets provides a mock function with given fields: ctx, namespace -func (_m *MockKubernetesConnector) ListSecrets(ctx context.Context, namespace string) (*v1.SecretList, error) { +func (_m *MockKubernetesConnector) ListSecrets(ctx context.Context, namespace string) (*corev1.SecretList, error) { ret := _m.Called(ctx, namespace) if len(ret) == 0 { panic("no return value specified for ListSecrets") } - var r0 *v1.SecretList + var r0 *corev1.SecretList var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*v1.SecretList, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, string) (*corev1.SecretList, error)); ok { return rf(ctx, namespace) } - if rf, ok := ret.Get(0).(func(context.Context, string) *v1.SecretList); ok { + if rf, ok := ret.Get(0).(func(context.Context, string) *corev1.SecretList); ok { r0 = rf(ctx, namespace) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.SecretList) + r0 = ret.Get(0).(*corev1.SecretList) } } @@ -1237,6 +3881,35 @@ func (_m *MockKubernetesConnector) ListSecrets(ctx context.Context, namespace st return r0, r1 } +// MockKubernetesConnector_ListSecrets_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSecrets' +type MockKubernetesConnector_ListSecrets_Call struct { + *mock.Call +} + +// ListSecrets is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +func (_e *MockKubernetesConnector_Expecter) ListSecrets(ctx interface{}, namespace interface{}) *MockKubernetesConnector_ListSecrets_Call { + return &MockKubernetesConnector_ListSecrets_Call{Call: _e.mock.On("ListSecrets", ctx, namespace)} +} + +func (_c *MockKubernetesConnector_ListSecrets_Call) Run(run func(ctx context.Context, namespace string)) *MockKubernetesConnector_ListSecrets_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_ListSecrets_Call) Return(_a0 *corev1.SecretList, _a1 error) *MockKubernetesConnector_ListSecrets_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_ListSecrets_Call) RunAndReturn(run func(context.Context, string) (*corev1.SecretList, error)) *MockKubernetesConnector_ListSecrets_Call { + _c.Call.Return(run) + return _c +} + // Namespace provides a mock function with given fields: func (_m *MockKubernetesConnector) Namespace() string { ret := _m.Called() @@ -1255,6 +3928,33 @@ func (_m *MockKubernetesConnector) Namespace() string { return r0 } +// MockKubernetesConnector_Namespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Namespace' +type MockKubernetesConnector_Namespace_Call struct { + *mock.Call +} + +// Namespace is a helper method to define mock.On call +func (_e *MockKubernetesConnector_Expecter) Namespace() *MockKubernetesConnector_Namespace_Call { + return &MockKubernetesConnector_Namespace_Call{Call: _e.mock.On("Namespace")} +} + +func (_c *MockKubernetesConnector_Namespace_Call) Run(run func()) *MockKubernetesConnector_Namespace_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockKubernetesConnector_Namespace_Call) Return(_a0 string) *MockKubernetesConnector_Namespace_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_Namespace_Call) RunAndReturn(run func() string) *MockKubernetesConnector_Namespace_Call { + _c.Call.Return(run) + return _c +} + // OperatorInstalledVersion provides a mock function with given fields: ctx, namespace, name func (_m *MockKubernetesConnector) OperatorInstalledVersion(ctx context.Context, namespace string, name string) (*go_version.Version, error) { ret := _m.Called(ctx, namespace, name) @@ -1285,6 +3985,82 @@ func (_m *MockKubernetesConnector) OperatorInstalledVersion(ctx context.Context, return r0, r1 } +// MockKubernetesConnector_OperatorInstalledVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OperatorInstalledVersion' +type MockKubernetesConnector_OperatorInstalledVersion_Call struct { + *mock.Call +} + +// OperatorInstalledVersion is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +func (_e *MockKubernetesConnector_Expecter) OperatorInstalledVersion(ctx interface{}, namespace interface{}, name interface{}) *MockKubernetesConnector_OperatorInstalledVersion_Call { + return &MockKubernetesConnector_OperatorInstalledVersion_Call{Call: _e.mock.On("OperatorInstalledVersion", ctx, namespace, name)} +} + +func (_c *MockKubernetesConnector_OperatorInstalledVersion_Call) Run(run func(ctx context.Context, namespace string, name string)) *MockKubernetesConnector_OperatorInstalledVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_OperatorInstalledVersion_Call) Return(_a0 *go_version.Version, _a1 error) *MockKubernetesConnector_OperatorInstalledVersion_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_OperatorInstalledVersion_Call) RunAndReturn(run func(context.Context, string, string) (*go_version.Version, error)) *MockKubernetesConnector_OperatorInstalledVersion_Call { + _c.Call.Return(run) + return _c +} + +// PatchDatabaseCluster provides a mock function with given fields: cluster +func (_m *MockKubernetesConnector) PatchDatabaseCluster(cluster *v1alpha1.DatabaseCluster) error { + ret := _m.Called(cluster) + + if len(ret) == 0 { + panic("no return value specified for PatchDatabaseCluster") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*v1alpha1.DatabaseCluster) error); ok { + r0 = rf(cluster) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockKubernetesConnector_PatchDatabaseCluster_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PatchDatabaseCluster' +type MockKubernetesConnector_PatchDatabaseCluster_Call struct { + *mock.Call +} + +// PatchDatabaseCluster is a helper method to define mock.On call +// - cluster *v1alpha1.DatabaseCluster +func (_e *MockKubernetesConnector_Expecter) PatchDatabaseCluster(cluster interface{}) *MockKubernetesConnector_PatchDatabaseCluster_Call { + return &MockKubernetesConnector_PatchDatabaseCluster_Call{Call: _e.mock.On("PatchDatabaseCluster", cluster)} +} + +func (_c *MockKubernetesConnector_PatchDatabaseCluster_Call) Run(run func(cluster *v1alpha1.DatabaseCluster)) *MockKubernetesConnector_PatchDatabaseCluster_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*v1alpha1.DatabaseCluster)) + }) + return _c +} + +func (_c *MockKubernetesConnector_PatchDatabaseCluster_Call) Return(_a0 error) *MockKubernetesConnector_PatchDatabaseCluster_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_PatchDatabaseCluster_Call) RunAndReturn(run func(*v1alpha1.DatabaseCluster) error) *MockKubernetesConnector_PatchDatabaseCluster_Call { + _c.Call.Return(run) + return _c +} + // RestartDeployment provides a mock function with given fields: ctx, name, namespace func (_m *MockKubernetesConnector) RestartDeployment(ctx context.Context, name string, namespace string) error { ret := _m.Called(ctx, name, namespace) @@ -1303,6 +4079,36 @@ func (_m *MockKubernetesConnector) RestartDeployment(ctx context.Context, name s return r0 } +// MockKubernetesConnector_RestartDeployment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RestartDeployment' +type MockKubernetesConnector_RestartDeployment_Call struct { + *mock.Call +} + +// RestartDeployment is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - namespace string +func (_e *MockKubernetesConnector_Expecter) RestartDeployment(ctx interface{}, name interface{}, namespace interface{}) *MockKubernetesConnector_RestartDeployment_Call { + return &MockKubernetesConnector_RestartDeployment_Call{Call: _e.mock.On("RestartDeployment", ctx, name, namespace)} +} + +func (_c *MockKubernetesConnector_RestartDeployment_Call) Run(run func(ctx context.Context, name string, namespace string)) *MockKubernetesConnector_RestartDeployment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_RestartDeployment_Call) Return(_a0 error) *MockKubernetesConnector_RestartDeployment_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_RestartDeployment_Call) RunAndReturn(run func(context.Context, string, string) error) *MockKubernetesConnector_RestartDeployment_Call { + _c.Call.Return(run) + return _c +} + // SetDatabaseEngineLock provides a mock function with given fields: ctx, namespace, name, locked func (_m *MockKubernetesConnector) SetDatabaseEngineLock(ctx context.Context, namespace string, name string, locked bool) error { ret := _m.Called(ctx, namespace, name, locked) @@ -1321,8 +4127,39 @@ func (_m *MockKubernetesConnector) SetDatabaseEngineLock(ctx context.Context, na return r0 } +// MockKubernetesConnector_SetDatabaseEngineLock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetDatabaseEngineLock' +type MockKubernetesConnector_SetDatabaseEngineLock_Call struct { + *mock.Call +} + +// SetDatabaseEngineLock is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - name string +// - locked bool +func (_e *MockKubernetesConnector_Expecter) SetDatabaseEngineLock(ctx interface{}, namespace interface{}, name interface{}, locked interface{}) *MockKubernetesConnector_SetDatabaseEngineLock_Call { + return &MockKubernetesConnector_SetDatabaseEngineLock_Call{Call: _e.mock.On("SetDatabaseEngineLock", ctx, namespace, name, locked)} +} + +func (_c *MockKubernetesConnector_SetDatabaseEngineLock_Call) Run(run func(ctx context.Context, namespace string, name string, locked bool)) *MockKubernetesConnector_SetDatabaseEngineLock_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(bool)) + }) + return _c +} + +func (_c *MockKubernetesConnector_SetDatabaseEngineLock_Call) Return(_a0 error) *MockKubernetesConnector_SetDatabaseEngineLock_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_SetDatabaseEngineLock_Call) RunAndReturn(run func(context.Context, string, string, bool) error) *MockKubernetesConnector_SetDatabaseEngineLock_Call { + _c.Call.Return(run) + return _c +} + // SetSecret provides a mock function with given fields: secret -func (_m *MockKubernetesConnector) SetSecret(secret *v1.Secret) error { +func (_m *MockKubernetesConnector) SetSecret(secret *corev1.Secret) error { ret := _m.Called(secret) if len(ret) == 0 { @@ -1330,7 +4167,7 @@ func (_m *MockKubernetesConnector) SetSecret(secret *v1.Secret) error { } var r0 error - if rf, ok := ret.Get(0).(func(*v1.Secret) error); ok { + if rf, ok := ret.Get(0).(func(*corev1.Secret) error); ok { r0 = rf(secret) } else { r0 = ret.Error(0) @@ -1339,6 +4176,34 @@ func (_m *MockKubernetesConnector) SetSecret(secret *v1.Secret) error { return r0 } +// MockKubernetesConnector_SetSecret_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetSecret' +type MockKubernetesConnector_SetSecret_Call struct { + *mock.Call +} + +// SetSecret is a helper method to define mock.On call +// - secret *corev1.Secret +func (_e *MockKubernetesConnector_Expecter) SetSecret(secret interface{}) *MockKubernetesConnector_SetSecret_Call { + return &MockKubernetesConnector_SetSecret_Call{Call: _e.mock.On("SetSecret", secret)} +} + +func (_c *MockKubernetesConnector_SetSecret_Call) Run(run func(secret *corev1.Secret)) *MockKubernetesConnector_SetSecret_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*corev1.Secret)) + }) + return _c +} + +func (_c *MockKubernetesConnector_SetSecret_Call) Return(_a0 error) *MockKubernetesConnector_SetSecret_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_SetSecret_Call) RunAndReturn(run func(*corev1.Secret) error) *MockKubernetesConnector_SetSecret_Call { + _c.Call.Return(run) + return _c +} + // UpdateBackupStorage provides a mock function with given fields: ctx, storage func (_m *MockKubernetesConnector) UpdateBackupStorage(ctx context.Context, storage *v1alpha1.BackupStorage) error { ret := _m.Called(ctx, storage) @@ -1357,6 +4222,94 @@ func (_m *MockKubernetesConnector) UpdateBackupStorage(ctx context.Context, stor return r0 } +// MockKubernetesConnector_UpdateBackupStorage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateBackupStorage' +type MockKubernetesConnector_UpdateBackupStorage_Call struct { + *mock.Call +} + +// UpdateBackupStorage is a helper method to define mock.On call +// - ctx context.Context +// - storage *v1alpha1.BackupStorage +func (_e *MockKubernetesConnector_Expecter) UpdateBackupStorage(ctx interface{}, storage interface{}) *MockKubernetesConnector_UpdateBackupStorage_Call { + return &MockKubernetesConnector_UpdateBackupStorage_Call{Call: _e.mock.On("UpdateBackupStorage", ctx, storage)} +} + +func (_c *MockKubernetesConnector_UpdateBackupStorage_Call) Run(run func(ctx context.Context, storage *v1alpha1.BackupStorage)) *MockKubernetesConnector_UpdateBackupStorage_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*v1alpha1.BackupStorage)) + }) + return _c +} + +func (_c *MockKubernetesConnector_UpdateBackupStorage_Call) Return(_a0 error) *MockKubernetesConnector_UpdateBackupStorage_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_UpdateBackupStorage_Call) RunAndReturn(run func(context.Context, *v1alpha1.BackupStorage) error) *MockKubernetesConnector_UpdateBackupStorage_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDatabaseClusterBackup provides a mock function with given fields: ctx, backup +func (_m *MockKubernetesConnector) UpdateDatabaseClusterBackup(ctx context.Context, backup *v1alpha1.DatabaseClusterBackup) (*v1alpha1.DatabaseClusterBackup, error) { + ret := _m.Called(ctx, backup) + + if len(ret) == 0 { + panic("no return value specified for UpdateDatabaseClusterBackup") + } + + var r0 *v1alpha1.DatabaseClusterBackup + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *v1alpha1.DatabaseClusterBackup) (*v1alpha1.DatabaseClusterBackup, error)); ok { + return rf(ctx, backup) + } + if rf, ok := ret.Get(0).(func(context.Context, *v1alpha1.DatabaseClusterBackup) *v1alpha1.DatabaseClusterBackup); ok { + r0 = rf(ctx, backup) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v1alpha1.DatabaseClusterBackup) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *v1alpha1.DatabaseClusterBackup) error); ok { + r1 = rf(ctx, backup) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockKubernetesConnector_UpdateDatabaseClusterBackup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDatabaseClusterBackup' +type MockKubernetesConnector_UpdateDatabaseClusterBackup_Call struct { + *mock.Call +} + +// UpdateDatabaseClusterBackup is a helper method to define mock.On call +// - ctx context.Context +// - backup *v1alpha1.DatabaseClusterBackup +func (_e *MockKubernetesConnector_Expecter) UpdateDatabaseClusterBackup(ctx interface{}, backup interface{}) *MockKubernetesConnector_UpdateDatabaseClusterBackup_Call { + return &MockKubernetesConnector_UpdateDatabaseClusterBackup_Call{Call: _e.mock.On("UpdateDatabaseClusterBackup", ctx, backup)} +} + +func (_c *MockKubernetesConnector_UpdateDatabaseClusterBackup_Call) Run(run func(ctx context.Context, backup *v1alpha1.DatabaseClusterBackup)) *MockKubernetesConnector_UpdateDatabaseClusterBackup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*v1alpha1.DatabaseClusterBackup)) + }) + return _c +} + +func (_c *MockKubernetesConnector_UpdateDatabaseClusterBackup_Call) Return(_a0 *v1alpha1.DatabaseClusterBackup, _a1 error) *MockKubernetesConnector_UpdateDatabaseClusterBackup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_UpdateDatabaseClusterBackup_Call) RunAndReturn(run func(context.Context, *v1alpha1.DatabaseClusterBackup) (*v1alpha1.DatabaseClusterBackup, error)) *MockKubernetesConnector_UpdateDatabaseClusterBackup_Call { + _c.Call.Return(run) + return _c +} + // UpdateDatabaseEngine provides a mock function with given fields: ctx, namespace, engine func (_m *MockKubernetesConnector) UpdateDatabaseEngine(ctx context.Context, namespace string, engine *v1alpha1.DatabaseEngine) (*v1alpha1.DatabaseEngine, error) { ret := _m.Called(ctx, namespace, engine) @@ -1387,6 +4340,36 @@ func (_m *MockKubernetesConnector) UpdateDatabaseEngine(ctx context.Context, nam return r0, r1 } +// MockKubernetesConnector_UpdateDatabaseEngine_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDatabaseEngine' +type MockKubernetesConnector_UpdateDatabaseEngine_Call struct { + *mock.Call +} + +// UpdateDatabaseEngine is a helper method to define mock.On call +// - ctx context.Context +// - namespace string +// - engine *v1alpha1.DatabaseEngine +func (_e *MockKubernetesConnector_Expecter) UpdateDatabaseEngine(ctx interface{}, namespace interface{}, engine interface{}) *MockKubernetesConnector_UpdateDatabaseEngine_Call { + return &MockKubernetesConnector_UpdateDatabaseEngine_Call{Call: _e.mock.On("UpdateDatabaseEngine", ctx, namespace, engine)} +} + +func (_c *MockKubernetesConnector_UpdateDatabaseEngine_Call) Run(run func(ctx context.Context, namespace string, engine *v1alpha1.DatabaseEngine)) *MockKubernetesConnector_UpdateDatabaseEngine_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(*v1alpha1.DatabaseEngine)) + }) + return _c +} + +func (_c *MockKubernetesConnector_UpdateDatabaseEngine_Call) Return(_a0 *v1alpha1.DatabaseEngine, _a1 error) *MockKubernetesConnector_UpdateDatabaseEngine_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_UpdateDatabaseEngine_Call) RunAndReturn(run func(context.Context, string, *v1alpha1.DatabaseEngine) (*v1alpha1.DatabaseEngine, error)) *MockKubernetesConnector_UpdateDatabaseEngine_Call { + _c.Call.Return(run) + return _c +} + // UpdateDeployment provides a mock function with given fields: ctx, deployment func (_m *MockKubernetesConnector) UpdateDeployment(ctx context.Context, deployment *appsv1.Deployment) (*appsv1.Deployment, error) { ret := _m.Called(ctx, deployment) @@ -1417,6 +4400,35 @@ func (_m *MockKubernetesConnector) UpdateDeployment(ctx context.Context, deploym return r0, r1 } +// MockKubernetesConnector_UpdateDeployment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDeployment' +type MockKubernetesConnector_UpdateDeployment_Call struct { + *mock.Call +} + +// UpdateDeployment is a helper method to define mock.On call +// - ctx context.Context +// - deployment *appsv1.Deployment +func (_e *MockKubernetesConnector_Expecter) UpdateDeployment(ctx interface{}, deployment interface{}) *MockKubernetesConnector_UpdateDeployment_Call { + return &MockKubernetesConnector_UpdateDeployment_Call{Call: _e.mock.On("UpdateDeployment", ctx, deployment)} +} + +func (_c *MockKubernetesConnector_UpdateDeployment_Call) Run(run func(ctx context.Context, deployment *appsv1.Deployment)) *MockKubernetesConnector_UpdateDeployment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*appsv1.Deployment)) + }) + return _c +} + +func (_c *MockKubernetesConnector_UpdateDeployment_Call) Return(_a0 *appsv1.Deployment, _a1 error) *MockKubernetesConnector_UpdateDeployment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_UpdateDeployment_Call) RunAndReturn(run func(context.Context, *appsv1.Deployment) (*appsv1.Deployment, error)) *MockKubernetesConnector_UpdateDeployment_Call { + _c.Call.Return(run) + return _c +} + // UpdateEverestSettings provides a mock function with given fields: ctx, settings func (_m *MockKubernetesConnector) UpdateEverestSettings(ctx context.Context, settings common.EverestSettings) error { ret := _m.Called(ctx, settings) @@ -1435,6 +4447,35 @@ func (_m *MockKubernetesConnector) UpdateEverestSettings(ctx context.Context, se return r0 } +// MockKubernetesConnector_UpdateEverestSettings_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateEverestSettings' +type MockKubernetesConnector_UpdateEverestSettings_Call struct { + *mock.Call +} + +// UpdateEverestSettings is a helper method to define mock.On call +// - ctx context.Context +// - settings common.EverestSettings +func (_e *MockKubernetesConnector_Expecter) UpdateEverestSettings(ctx interface{}, settings interface{}) *MockKubernetesConnector_UpdateEverestSettings_Call { + return &MockKubernetesConnector_UpdateEverestSettings_Call{Call: _e.mock.On("UpdateEverestSettings", ctx, settings)} +} + +func (_c *MockKubernetesConnector_UpdateEverestSettings_Call) Run(run func(ctx context.Context, settings common.EverestSettings)) *MockKubernetesConnector_UpdateEverestSettings_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.EverestSettings)) + }) + return _c +} + +func (_c *MockKubernetesConnector_UpdateEverestSettings_Call) Return(_a0 error) *MockKubernetesConnector_UpdateEverestSettings_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_UpdateEverestSettings_Call) RunAndReturn(run func(context.Context, common.EverestSettings) error) *MockKubernetesConnector_UpdateEverestSettings_Call { + _c.Call.Return(run) + return _c +} + // UpdateMonitoringConfig provides a mock function with given fields: ctx, storage func (_m *MockKubernetesConnector) UpdateMonitoringConfig(ctx context.Context, storage *v1alpha1.MonitoringConfig) error { ret := _m.Called(ctx, storage) @@ -1453,28 +4494,57 @@ func (_m *MockKubernetesConnector) UpdateMonitoringConfig(ctx context.Context, s return r0 } +// MockKubernetesConnector_UpdateMonitoringConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateMonitoringConfig' +type MockKubernetesConnector_UpdateMonitoringConfig_Call struct { + *mock.Call +} + +// UpdateMonitoringConfig is a helper method to define mock.On call +// - ctx context.Context +// - storage *v1alpha1.MonitoringConfig +func (_e *MockKubernetesConnector_Expecter) UpdateMonitoringConfig(ctx interface{}, storage interface{}) *MockKubernetesConnector_UpdateMonitoringConfig_Call { + return &MockKubernetesConnector_UpdateMonitoringConfig_Call{Call: _e.mock.On("UpdateMonitoringConfig", ctx, storage)} +} + +func (_c *MockKubernetesConnector_UpdateMonitoringConfig_Call) Run(run func(ctx context.Context, storage *v1alpha1.MonitoringConfig)) *MockKubernetesConnector_UpdateMonitoringConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*v1alpha1.MonitoringConfig)) + }) + return _c +} + +func (_c *MockKubernetesConnector_UpdateMonitoringConfig_Call) Return(_a0 error) *MockKubernetesConnector_UpdateMonitoringConfig_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_UpdateMonitoringConfig_Call) RunAndReturn(run func(context.Context, *v1alpha1.MonitoringConfig) error) *MockKubernetesConnector_UpdateMonitoringConfig_Call { + _c.Call.Return(run) + return _c +} + // UpdateNamespace provides a mock function with given fields: ctx, namespace, opts -func (_m *MockKubernetesConnector) UpdateNamespace(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (*v1.Namespace, error) { +func (_m *MockKubernetesConnector) UpdateNamespace(ctx context.Context, namespace *corev1.Namespace, opts metav1.UpdateOptions) (*corev1.Namespace, error) { ret := _m.Called(ctx, namespace, opts) if len(ret) == 0 { panic("no return value specified for UpdateNamespace") } - var r0 *v1.Namespace + var r0 *corev1.Namespace var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.Namespace, metav1.UpdateOptions) (*v1.Namespace, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, *corev1.Namespace, metav1.UpdateOptions) (*corev1.Namespace, error)); ok { return rf(ctx, namespace, opts) } - if rf, ok := ret.Get(0).(func(context.Context, *v1.Namespace, metav1.UpdateOptions) *v1.Namespace); ok { + if rf, ok := ret.Get(0).(func(context.Context, *corev1.Namespace, metav1.UpdateOptions) *corev1.Namespace); ok { r0 = rf(ctx, namespace, opts) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Namespace) + r0 = ret.Get(0).(*corev1.Namespace) } } - if rf, ok := ret.Get(1).(func(context.Context, *v1.Namespace, metav1.UpdateOptions) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, *corev1.Namespace, metav1.UpdateOptions) error); ok { r1 = rf(ctx, namespace, opts) } else { r1 = ret.Error(1) @@ -1483,28 +4553,58 @@ func (_m *MockKubernetesConnector) UpdateNamespace(ctx context.Context, namespac return r0, r1 } +// MockKubernetesConnector_UpdateNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateNamespace' +type MockKubernetesConnector_UpdateNamespace_Call struct { + *mock.Call +} + +// UpdateNamespace is a helper method to define mock.On call +// - ctx context.Context +// - namespace *corev1.Namespace +// - opts metav1.UpdateOptions +func (_e *MockKubernetesConnector_Expecter) UpdateNamespace(ctx interface{}, namespace interface{}, opts interface{}) *MockKubernetesConnector_UpdateNamespace_Call { + return &MockKubernetesConnector_UpdateNamespace_Call{Call: _e.mock.On("UpdateNamespace", ctx, namespace, opts)} +} + +func (_c *MockKubernetesConnector_UpdateNamespace_Call) Run(run func(ctx context.Context, namespace *corev1.Namespace, opts metav1.UpdateOptions)) *MockKubernetesConnector_UpdateNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*corev1.Namespace), args[2].(metav1.UpdateOptions)) + }) + return _c +} + +func (_c *MockKubernetesConnector_UpdateNamespace_Call) Return(_a0 *corev1.Namespace, _a1 error) *MockKubernetesConnector_UpdateNamespace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_UpdateNamespace_Call) RunAndReturn(run func(context.Context, *corev1.Namespace, metav1.UpdateOptions) (*corev1.Namespace, error)) *MockKubernetesConnector_UpdateNamespace_Call { + _c.Call.Return(run) + return _c +} + // UpdateSecret provides a mock function with given fields: ctx, secret -func (_m *MockKubernetesConnector) UpdateSecret(ctx context.Context, secret *v1.Secret) (*v1.Secret, error) { +func (_m *MockKubernetesConnector) UpdateSecret(ctx context.Context, secret *corev1.Secret) (*corev1.Secret, error) { ret := _m.Called(ctx, secret) if len(ret) == 0 { panic("no return value specified for UpdateSecret") } - var r0 *v1.Secret + var r0 *corev1.Secret var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.Secret) (*v1.Secret, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, *corev1.Secret) (*corev1.Secret, error)); ok { return rf(ctx, secret) } - if rf, ok := ret.Get(0).(func(context.Context, *v1.Secret) *v1.Secret); ok { + if rf, ok := ret.Get(0).(func(context.Context, *corev1.Secret) *corev1.Secret); ok { r0 = rf(ctx, secret) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Secret) + r0 = ret.Get(0).(*corev1.Secret) } } - if rf, ok := ret.Get(1).(func(context.Context, *v1.Secret) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, *corev1.Secret) error); ok { r1 = rf(ctx, secret) } else { r1 = ret.Error(1) @@ -1513,6 +4613,35 @@ func (_m *MockKubernetesConnector) UpdateSecret(ctx context.Context, secret *v1. return r0, r1 } +// MockKubernetesConnector_UpdateSecret_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateSecret' +type MockKubernetesConnector_UpdateSecret_Call struct { + *mock.Call +} + +// UpdateSecret is a helper method to define mock.On call +// - ctx context.Context +// - secret *corev1.Secret +func (_e *MockKubernetesConnector_Expecter) UpdateSecret(ctx interface{}, secret interface{}) *MockKubernetesConnector_UpdateSecret_Call { + return &MockKubernetesConnector_UpdateSecret_Call{Call: _e.mock.On("UpdateSecret", ctx, secret)} +} + +func (_c *MockKubernetesConnector_UpdateSecret_Call) Run(run func(ctx context.Context, secret *corev1.Secret)) *MockKubernetesConnector_UpdateSecret_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*corev1.Secret)) + }) + return _c +} + +func (_c *MockKubernetesConnector_UpdateSecret_Call) Return(_a0 *corev1.Secret, _a1 error) *MockKubernetesConnector_UpdateSecret_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockKubernetesConnector_UpdateSecret_Call) RunAndReturn(run func(context.Context, *corev1.Secret) (*corev1.Secret, error)) *MockKubernetesConnector_UpdateSecret_Call { + _c.Call.Return(run) + return _c +} + // WaitForRollout provides a mock function with given fields: ctx, name, namespace func (_m *MockKubernetesConnector) WaitForRollout(ctx context.Context, name string, namespace string) error { ret := _m.Called(ctx, name, namespace) @@ -1531,6 +4660,36 @@ func (_m *MockKubernetesConnector) WaitForRollout(ctx context.Context, name stri return r0 } +// MockKubernetesConnector_WaitForRollout_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WaitForRollout' +type MockKubernetesConnector_WaitForRollout_Call struct { + *mock.Call +} + +// WaitForRollout is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - namespace string +func (_e *MockKubernetesConnector_Expecter) WaitForRollout(ctx interface{}, name interface{}, namespace interface{}) *MockKubernetesConnector_WaitForRollout_Call { + return &MockKubernetesConnector_WaitForRollout_Call{Call: _e.mock.On("WaitForRollout", ctx, name, namespace)} +} + +func (_c *MockKubernetesConnector_WaitForRollout_Call) Run(run func(ctx context.Context, name string, namespace string)) *MockKubernetesConnector_WaitForRollout_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockKubernetesConnector_WaitForRollout_Call) Return(_a0 error) *MockKubernetesConnector_WaitForRollout_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_WaitForRollout_Call) RunAndReturn(run func(context.Context, string, string) error) *MockKubernetesConnector_WaitForRollout_Call { + _c.Call.Return(run) + return _c +} + // WithClient provides a mock function with given fields: c func (_m *MockKubernetesConnector) WithClient(c client.KubeClientConnector) *Kubernetes { ret := _m.Called(c) @@ -1551,6 +4710,34 @@ func (_m *MockKubernetesConnector) WithClient(c client.KubeClientConnector) *Kub return r0 } +// MockKubernetesConnector_WithClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithClient' +type MockKubernetesConnector_WithClient_Call struct { + *mock.Call +} + +// WithClient is a helper method to define mock.On call +// - c client.KubeClientConnector +func (_e *MockKubernetesConnector_Expecter) WithClient(c interface{}) *MockKubernetesConnector_WithClient_Call { + return &MockKubernetesConnector_WithClient_Call{Call: _e.mock.On("WithClient", c)} +} + +func (_c *MockKubernetesConnector_WithClient_Call) Run(run func(c client.KubeClientConnector)) *MockKubernetesConnector_WithClient_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(client.KubeClientConnector)) + }) + return _c +} + +func (_c *MockKubernetesConnector_WithClient_Call) Return(_a0 *Kubernetes) *MockKubernetesConnector_WithClient_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockKubernetesConnector_WithClient_Call) RunAndReturn(run func(client.KubeClientConnector) *Kubernetes) *MockKubernetesConnector_WithClient_Call { + _c.Call.Return(run) + return _c +} + // NewMockKubernetesConnector creates a new instance of MockKubernetesConnector. 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 NewMockKubernetesConnector(t interface { diff --git a/pkg/rbac/configmap-adapter/adapter.go b/pkg/rbac/configmap-adapter/adapter.go index 62040187a..b794606f8 100644 --- a/pkg/rbac/configmap-adapter/adapter.go +++ b/pkg/rbac/configmap-adapter/adapter.go @@ -33,7 +33,7 @@ import ( // Adapter is the ConfigMap adapter for Casbin. // It can load policy from ConfigMap and save policy to ConfigMap. type Adapter struct { - kubeClient *kubernetes.Kubernetes + kubeClient kubernetes.KubernetesConnector namespacedName types.NamespacedName l *zap.SugaredLogger } @@ -41,7 +41,7 @@ type Adapter struct { // New constructs a new adapter that manages a policy inside a ConfigMap. func New( l *zap.SugaredLogger, - kubeClient *kubernetes.Kubernetes, + kubeClient kubernetes.KubernetesConnector, namespacedName types.NamespacedName, ) *Adapter { return &Adapter{ diff --git a/pkg/rbac/gen.go b/pkg/rbac/gen.go index 93a689ce6..ce101a1b7 100644 --- a/pkg/rbac/gen.go +++ b/pkg/rbac/gen.go @@ -15,4 +15,4 @@ package rbac -//go:generate ../../bin/mockery --name=IEnforcer --case=snake --srcpkg=github.com/casbin/casbin/v2 +//go:generate ../../bin/mockery --name=IEnforcer --case=snake --srcpkg=github.com/casbin/casbin/v2 --with-expecter=true diff --git a/pkg/rbac/mocks/i_enforcer.go b/pkg/rbac/mocks/i_enforcer.go index a775aa71d..c2b8504fd 100644 --- a/pkg/rbac/mocks/i_enforcer.go +++ b/pkg/rbac/mocks/i_enforcer.go @@ -16,11 +16,48 @@ type IEnforcer struct { mock.Mock } +type IEnforcer_Expecter struct { + mock *mock.Mock +} + +func (_m *IEnforcer) EXPECT() *IEnforcer_Expecter { + return &IEnforcer_Expecter{mock: &_m.Mock} +} + // AddFunction provides a mock function with given fields: name, function func (_m *IEnforcer) AddFunction(name string, function govaluate.ExpressionFunction) { _m.Called(name, function) } +// IEnforcer_AddFunction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFunction' +type IEnforcer_AddFunction_Call struct { + *mock.Call +} + +// AddFunction is a helper method to define mock.On call +// - name string +// - function govaluate.ExpressionFunction +func (_e *IEnforcer_Expecter) AddFunction(name interface{}, function interface{}) *IEnforcer_AddFunction_Call { + return &IEnforcer_AddFunction_Call{Call: _e.mock.On("AddFunction", name, function)} +} + +func (_c *IEnforcer_AddFunction_Call) Run(run func(name string, function govaluate.ExpressionFunction)) *IEnforcer_AddFunction_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(govaluate.ExpressionFunction)) + }) + return _c +} + +func (_c *IEnforcer_AddFunction_Call) Return() *IEnforcer_AddFunction_Call { + _c.Call.Return() + return _c +} + +func (_c *IEnforcer_AddFunction_Call) RunAndReturn(run func(string, govaluate.ExpressionFunction)) *IEnforcer_AddFunction_Call { + _c.Call.Return(run) + return _c +} + // AddGroupingPolicies provides a mock function with given fields: rules func (_m *IEnforcer) AddGroupingPolicies(rules [][]string) (bool, error) { ret := _m.Called(rules) @@ -49,6 +86,34 @@ func (_m *IEnforcer) AddGroupingPolicies(rules [][]string) (bool, error) { return r0, r1 } +// IEnforcer_AddGroupingPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddGroupingPolicies' +type IEnforcer_AddGroupingPolicies_Call struct { + *mock.Call +} + +// AddGroupingPolicies is a helper method to define mock.On call +// - rules [][]string +func (_e *IEnforcer_Expecter) AddGroupingPolicies(rules interface{}) *IEnforcer_AddGroupingPolicies_Call { + return &IEnforcer_AddGroupingPolicies_Call{Call: _e.mock.On("AddGroupingPolicies", rules)} +} + +func (_c *IEnforcer_AddGroupingPolicies_Call) Run(run func(rules [][]string)) *IEnforcer_AddGroupingPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_AddGroupingPolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddGroupingPolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddGroupingPolicies_Call) RunAndReturn(run func([][]string) (bool, error)) *IEnforcer_AddGroupingPolicies_Call { + _c.Call.Return(run) + return _c +} + // AddGroupingPoliciesEx provides a mock function with given fields: rules func (_m *IEnforcer) AddGroupingPoliciesEx(rules [][]string) (bool, error) { ret := _m.Called(rules) @@ -77,6 +142,34 @@ func (_m *IEnforcer) AddGroupingPoliciesEx(rules [][]string) (bool, error) { return r0, r1 } +// IEnforcer_AddGroupingPoliciesEx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddGroupingPoliciesEx' +type IEnforcer_AddGroupingPoliciesEx_Call struct { + *mock.Call +} + +// AddGroupingPoliciesEx is a helper method to define mock.On call +// - rules [][]string +func (_e *IEnforcer_Expecter) AddGroupingPoliciesEx(rules interface{}) *IEnforcer_AddGroupingPoliciesEx_Call { + return &IEnforcer_AddGroupingPoliciesEx_Call{Call: _e.mock.On("AddGroupingPoliciesEx", rules)} +} + +func (_c *IEnforcer_AddGroupingPoliciesEx_Call) Run(run func(rules [][]string)) *IEnforcer_AddGroupingPoliciesEx_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_AddGroupingPoliciesEx_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddGroupingPoliciesEx_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddGroupingPoliciesEx_Call) RunAndReturn(run func([][]string) (bool, error)) *IEnforcer_AddGroupingPoliciesEx_Call { + _c.Call.Return(run) + return _c +} + // AddGroupingPolicy provides a mock function with given fields: params func (_m *IEnforcer) AddGroupingPolicy(params ...interface{}) (bool, error) { var _ca []interface{} @@ -107,6 +200,41 @@ func (_m *IEnforcer) AddGroupingPolicy(params ...interface{}) (bool, error) { return r0, r1 } +// IEnforcer_AddGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddGroupingPolicy' +type IEnforcer_AddGroupingPolicy_Call struct { + *mock.Call +} + +// AddGroupingPolicy is a helper method to define mock.On call +// - params ...interface{} +func (_e *IEnforcer_Expecter) AddGroupingPolicy(params ...interface{}) *IEnforcer_AddGroupingPolicy_Call { + return &IEnforcer_AddGroupingPolicy_Call{Call: _e.mock.On("AddGroupingPolicy", + append([]interface{}{}, params...)...)} +} + +func (_c *IEnforcer_AddGroupingPolicy_Call) Run(run func(params ...interface{})) *IEnforcer_AddGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_AddGroupingPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddGroupingPolicy_Call) RunAndReturn(run func(...interface{}) (bool, error)) *IEnforcer_AddGroupingPolicy_Call { + _c.Call.Return(run) + return _c +} + // AddNamedGroupingPolicies provides a mock function with given fields: ptype, rules func (_m *IEnforcer) AddNamedGroupingPolicies(ptype string, rules [][]string) (bool, error) { ret := _m.Called(ptype, rules) @@ -135,6 +263,35 @@ func (_m *IEnforcer) AddNamedGroupingPolicies(ptype string, rules [][]string) (b return r0, r1 } +// IEnforcer_AddNamedGroupingPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddNamedGroupingPolicies' +type IEnforcer_AddNamedGroupingPolicies_Call struct { + *mock.Call +} + +// AddNamedGroupingPolicies is a helper method to define mock.On call +// - ptype string +// - rules [][]string +func (_e *IEnforcer_Expecter) AddNamedGroupingPolicies(ptype interface{}, rules interface{}) *IEnforcer_AddNamedGroupingPolicies_Call { + return &IEnforcer_AddNamedGroupingPolicies_Call{Call: _e.mock.On("AddNamedGroupingPolicies", ptype, rules)} +} + +func (_c *IEnforcer_AddNamedGroupingPolicies_Call) Run(run func(ptype string, rules [][]string)) *IEnforcer_AddNamedGroupingPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_AddNamedGroupingPolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddNamedGroupingPolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddNamedGroupingPolicies_Call) RunAndReturn(run func(string, [][]string) (bool, error)) *IEnforcer_AddNamedGroupingPolicies_Call { + _c.Call.Return(run) + return _c +} + // AddNamedGroupingPoliciesEx provides a mock function with given fields: ptype, rules func (_m *IEnforcer) AddNamedGroupingPoliciesEx(ptype string, rules [][]string) (bool, error) { ret := _m.Called(ptype, rules) @@ -163,6 +320,35 @@ func (_m *IEnforcer) AddNamedGroupingPoliciesEx(ptype string, rules [][]string) return r0, r1 } +// IEnforcer_AddNamedGroupingPoliciesEx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddNamedGroupingPoliciesEx' +type IEnforcer_AddNamedGroupingPoliciesEx_Call struct { + *mock.Call +} + +// AddNamedGroupingPoliciesEx is a helper method to define mock.On call +// - ptype string +// - rules [][]string +func (_e *IEnforcer_Expecter) AddNamedGroupingPoliciesEx(ptype interface{}, rules interface{}) *IEnforcer_AddNamedGroupingPoliciesEx_Call { + return &IEnforcer_AddNamedGroupingPoliciesEx_Call{Call: _e.mock.On("AddNamedGroupingPoliciesEx", ptype, rules)} +} + +func (_c *IEnforcer_AddNamedGroupingPoliciesEx_Call) Run(run func(ptype string, rules [][]string)) *IEnforcer_AddNamedGroupingPoliciesEx_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_AddNamedGroupingPoliciesEx_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddNamedGroupingPoliciesEx_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddNamedGroupingPoliciesEx_Call) RunAndReturn(run func(string, [][]string) (bool, error)) *IEnforcer_AddNamedGroupingPoliciesEx_Call { + _c.Call.Return(run) + return _c +} + // AddNamedGroupingPolicy provides a mock function with given fields: ptype, params func (_m *IEnforcer) AddNamedGroupingPolicy(ptype string, params ...interface{}) (bool, error) { var _ca []interface{} @@ -194,6 +380,42 @@ func (_m *IEnforcer) AddNamedGroupingPolicy(ptype string, params ...interface{}) return r0, r1 } +// IEnforcer_AddNamedGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddNamedGroupingPolicy' +type IEnforcer_AddNamedGroupingPolicy_Call struct { + *mock.Call +} + +// AddNamedGroupingPolicy is a helper method to define mock.On call +// - ptype string +// - params ...interface{} +func (_e *IEnforcer_Expecter) AddNamedGroupingPolicy(ptype interface{}, params ...interface{}) *IEnforcer_AddNamedGroupingPolicy_Call { + return &IEnforcer_AddNamedGroupingPolicy_Call{Call: _e.mock.On("AddNamedGroupingPolicy", + append([]interface{}{ptype}, params...)...)} +} + +func (_c *IEnforcer_AddNamedGroupingPolicy_Call) Run(run func(ptype string, params ...interface{})) *IEnforcer_AddNamedGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_AddNamedGroupingPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddNamedGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddNamedGroupingPolicy_Call) RunAndReturn(run func(string, ...interface{}) (bool, error)) *IEnforcer_AddNamedGroupingPolicy_Call { + _c.Call.Return(run) + return _c +} + // AddNamedPolicies provides a mock function with given fields: ptype, rules func (_m *IEnforcer) AddNamedPolicies(ptype string, rules [][]string) (bool, error) { ret := _m.Called(ptype, rules) @@ -222,6 +444,35 @@ func (_m *IEnforcer) AddNamedPolicies(ptype string, rules [][]string) (bool, err return r0, r1 } +// IEnforcer_AddNamedPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddNamedPolicies' +type IEnforcer_AddNamedPolicies_Call struct { + *mock.Call +} + +// AddNamedPolicies is a helper method to define mock.On call +// - ptype string +// - rules [][]string +func (_e *IEnforcer_Expecter) AddNamedPolicies(ptype interface{}, rules interface{}) *IEnforcer_AddNamedPolicies_Call { + return &IEnforcer_AddNamedPolicies_Call{Call: _e.mock.On("AddNamedPolicies", ptype, rules)} +} + +func (_c *IEnforcer_AddNamedPolicies_Call) Run(run func(ptype string, rules [][]string)) *IEnforcer_AddNamedPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_AddNamedPolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddNamedPolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddNamedPolicies_Call) RunAndReturn(run func(string, [][]string) (bool, error)) *IEnforcer_AddNamedPolicies_Call { + _c.Call.Return(run) + return _c +} + // AddNamedPoliciesEx provides a mock function with given fields: ptype, rules func (_m *IEnforcer) AddNamedPoliciesEx(ptype string, rules [][]string) (bool, error) { ret := _m.Called(ptype, rules) @@ -250,6 +501,35 @@ func (_m *IEnforcer) AddNamedPoliciesEx(ptype string, rules [][]string) (bool, e return r0, r1 } +// IEnforcer_AddNamedPoliciesEx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddNamedPoliciesEx' +type IEnforcer_AddNamedPoliciesEx_Call struct { + *mock.Call +} + +// AddNamedPoliciesEx is a helper method to define mock.On call +// - ptype string +// - rules [][]string +func (_e *IEnforcer_Expecter) AddNamedPoliciesEx(ptype interface{}, rules interface{}) *IEnforcer_AddNamedPoliciesEx_Call { + return &IEnforcer_AddNamedPoliciesEx_Call{Call: _e.mock.On("AddNamedPoliciesEx", ptype, rules)} +} + +func (_c *IEnforcer_AddNamedPoliciesEx_Call) Run(run func(ptype string, rules [][]string)) *IEnforcer_AddNamedPoliciesEx_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_AddNamedPoliciesEx_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddNamedPoliciesEx_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddNamedPoliciesEx_Call) RunAndReturn(run func(string, [][]string) (bool, error)) *IEnforcer_AddNamedPoliciesEx_Call { + _c.Call.Return(run) + return _c +} + // AddNamedPolicy provides a mock function with given fields: ptype, params func (_m *IEnforcer) AddNamedPolicy(ptype string, params ...interface{}) (bool, error) { var _ca []interface{} @@ -281,6 +561,42 @@ func (_m *IEnforcer) AddNamedPolicy(ptype string, params ...interface{}) (bool, return r0, r1 } +// IEnforcer_AddNamedPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddNamedPolicy' +type IEnforcer_AddNamedPolicy_Call struct { + *mock.Call +} + +// AddNamedPolicy is a helper method to define mock.On call +// - ptype string +// - params ...interface{} +func (_e *IEnforcer_Expecter) AddNamedPolicy(ptype interface{}, params ...interface{}) *IEnforcer_AddNamedPolicy_Call { + return &IEnforcer_AddNamedPolicy_Call{Call: _e.mock.On("AddNamedPolicy", + append([]interface{}{ptype}, params...)...)} +} + +func (_c *IEnforcer_AddNamedPolicy_Call) Run(run func(ptype string, params ...interface{})) *IEnforcer_AddNamedPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_AddNamedPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddNamedPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddNamedPolicy_Call) RunAndReturn(run func(string, ...interface{}) (bool, error)) *IEnforcer_AddNamedPolicy_Call { + _c.Call.Return(run) + return _c +} + // AddPermissionForUser provides a mock function with given fields: user, permission func (_m *IEnforcer) AddPermissionForUser(user string, permission ...string) (bool, error) { _va := make([]interface{}, len(permission)) @@ -316,6 +632,42 @@ func (_m *IEnforcer) AddPermissionForUser(user string, permission ...string) (bo return r0, r1 } +// IEnforcer_AddPermissionForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddPermissionForUser' +type IEnforcer_AddPermissionForUser_Call struct { + *mock.Call +} + +// AddPermissionForUser is a helper method to define mock.On call +// - user string +// - permission ...string +func (_e *IEnforcer_Expecter) AddPermissionForUser(user interface{}, permission ...interface{}) *IEnforcer_AddPermissionForUser_Call { + return &IEnforcer_AddPermissionForUser_Call{Call: _e.mock.On("AddPermissionForUser", + append([]interface{}{user}, permission...)...)} +} + +func (_c *IEnforcer_AddPermissionForUser_Call) Run(run func(user string, permission ...string)) *IEnforcer_AddPermissionForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_AddPermissionForUser_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddPermissionForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddPermissionForUser_Call) RunAndReturn(run func(string, ...string) (bool, error)) *IEnforcer_AddPermissionForUser_Call { + _c.Call.Return(run) + return _c +} + // AddPermissionsForUser provides a mock function with given fields: user, permissions func (_m *IEnforcer) AddPermissionsForUser(user string, permissions ...[]string) (bool, error) { _va := make([]interface{}, len(permissions)) @@ -351,6 +703,42 @@ func (_m *IEnforcer) AddPermissionsForUser(user string, permissions ...[]string) return r0, r1 } +// IEnforcer_AddPermissionsForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddPermissionsForUser' +type IEnforcer_AddPermissionsForUser_Call struct { + *mock.Call +} + +// AddPermissionsForUser is a helper method to define mock.On call +// - user string +// - permissions ...[]string +func (_e *IEnforcer_Expecter) AddPermissionsForUser(user interface{}, permissions ...interface{}) *IEnforcer_AddPermissionsForUser_Call { + return &IEnforcer_AddPermissionsForUser_Call{Call: _e.mock.On("AddPermissionsForUser", + append([]interface{}{user}, permissions...)...)} +} + +func (_c *IEnforcer_AddPermissionsForUser_Call) Run(run func(user string, permissions ...[]string)) *IEnforcer_AddPermissionsForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([][]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.([]string) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_AddPermissionsForUser_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddPermissionsForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddPermissionsForUser_Call) RunAndReturn(run func(string, ...[]string) (bool, error)) *IEnforcer_AddPermissionsForUser_Call { + _c.Call.Return(run) + return _c +} + // AddPolicies provides a mock function with given fields: rules func (_m *IEnforcer) AddPolicies(rules [][]string) (bool, error) { ret := _m.Called(rules) @@ -379,6 +767,34 @@ func (_m *IEnforcer) AddPolicies(rules [][]string) (bool, error) { return r0, r1 } +// IEnforcer_AddPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddPolicies' +type IEnforcer_AddPolicies_Call struct { + *mock.Call +} + +// AddPolicies is a helper method to define mock.On call +// - rules [][]string +func (_e *IEnforcer_Expecter) AddPolicies(rules interface{}) *IEnforcer_AddPolicies_Call { + return &IEnforcer_AddPolicies_Call{Call: _e.mock.On("AddPolicies", rules)} +} + +func (_c *IEnforcer_AddPolicies_Call) Run(run func(rules [][]string)) *IEnforcer_AddPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_AddPolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddPolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddPolicies_Call) RunAndReturn(run func([][]string) (bool, error)) *IEnforcer_AddPolicies_Call { + _c.Call.Return(run) + return _c +} + // AddPoliciesEx provides a mock function with given fields: rules func (_m *IEnforcer) AddPoliciesEx(rules [][]string) (bool, error) { ret := _m.Called(rules) @@ -407,6 +823,34 @@ func (_m *IEnforcer) AddPoliciesEx(rules [][]string) (bool, error) { return r0, r1 } +// IEnforcer_AddPoliciesEx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddPoliciesEx' +type IEnforcer_AddPoliciesEx_Call struct { + *mock.Call +} + +// AddPoliciesEx is a helper method to define mock.On call +// - rules [][]string +func (_e *IEnforcer_Expecter) AddPoliciesEx(rules interface{}) *IEnforcer_AddPoliciesEx_Call { + return &IEnforcer_AddPoliciesEx_Call{Call: _e.mock.On("AddPoliciesEx", rules)} +} + +func (_c *IEnforcer_AddPoliciesEx_Call) Run(run func(rules [][]string)) *IEnforcer_AddPoliciesEx_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_AddPoliciesEx_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddPoliciesEx_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddPoliciesEx_Call) RunAndReturn(run func([][]string) (bool, error)) *IEnforcer_AddPoliciesEx_Call { + _c.Call.Return(run) + return _c +} + // AddPolicy provides a mock function with given fields: params func (_m *IEnforcer) AddPolicy(params ...interface{}) (bool, error) { var _ca []interface{} @@ -437,6 +881,41 @@ func (_m *IEnforcer) AddPolicy(params ...interface{}) (bool, error) { return r0, r1 } +// IEnforcer_AddPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddPolicy' +type IEnforcer_AddPolicy_Call struct { + *mock.Call +} + +// AddPolicy is a helper method to define mock.On call +// - params ...interface{} +func (_e *IEnforcer_Expecter) AddPolicy(params ...interface{}) *IEnforcer_AddPolicy_Call { + return &IEnforcer_AddPolicy_Call{Call: _e.mock.On("AddPolicy", + append([]interface{}{}, params...)...)} +} + +func (_c *IEnforcer_AddPolicy_Call) Run(run func(params ...interface{})) *IEnforcer_AddPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_AddPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddPolicy_Call) RunAndReturn(run func(...interface{}) (bool, error)) *IEnforcer_AddPolicy_Call { + _c.Call.Return(run) + return _c +} + // AddRoleForUser provides a mock function with given fields: user, role, domain func (_m *IEnforcer) AddRoleForUser(user string, role string, domain ...string) (bool, error) { _va := make([]interface{}, len(domain)) @@ -472,6 +951,43 @@ func (_m *IEnforcer) AddRoleForUser(user string, role string, domain ...string) return r0, r1 } +// IEnforcer_AddRoleForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddRoleForUser' +type IEnforcer_AddRoleForUser_Call struct { + *mock.Call +} + +// AddRoleForUser is a helper method to define mock.On call +// - user string +// - role string +// - domain ...string +func (_e *IEnforcer_Expecter) AddRoleForUser(user interface{}, role interface{}, domain ...interface{}) *IEnforcer_AddRoleForUser_Call { + return &IEnforcer_AddRoleForUser_Call{Call: _e.mock.On("AddRoleForUser", + append([]interface{}{user, role}, domain...)...)} +} + +func (_c *IEnforcer_AddRoleForUser_Call) Run(run func(user string, role string, domain ...string)) *IEnforcer_AddRoleForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), args[1].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_AddRoleForUser_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddRoleForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddRoleForUser_Call) RunAndReturn(run func(string, string, ...string) (bool, error)) *IEnforcer_AddRoleForUser_Call { + _c.Call.Return(run) + return _c +} + // AddRoleForUserInDomain provides a mock function with given fields: user, role, domain func (_m *IEnforcer) AddRoleForUserInDomain(user string, role string, domain string) (bool, error) { ret := _m.Called(user, role, domain) @@ -500,6 +1016,36 @@ func (_m *IEnforcer) AddRoleForUserInDomain(user string, role string, domain str return r0, r1 } +// IEnforcer_AddRoleForUserInDomain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddRoleForUserInDomain' +type IEnforcer_AddRoleForUserInDomain_Call struct { + *mock.Call +} + +// AddRoleForUserInDomain is a helper method to define mock.On call +// - user string +// - role string +// - domain string +func (_e *IEnforcer_Expecter) AddRoleForUserInDomain(user interface{}, role interface{}, domain interface{}) *IEnforcer_AddRoleForUserInDomain_Call { + return &IEnforcer_AddRoleForUserInDomain_Call{Call: _e.mock.On("AddRoleForUserInDomain", user, role, domain)} +} + +func (_c *IEnforcer_AddRoleForUserInDomain_Call) Run(run func(user string, role string, domain string)) *IEnforcer_AddRoleForUserInDomain_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *IEnforcer_AddRoleForUserInDomain_Call) Return(_a0 bool, _a1 error) *IEnforcer_AddRoleForUserInDomain_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_AddRoleForUserInDomain_Call) RunAndReturn(run func(string, string, string) (bool, error)) *IEnforcer_AddRoleForUserInDomain_Call { + _c.Call.Return(run) + return _c +} + // BatchEnforce provides a mock function with given fields: requests func (_m *IEnforcer) BatchEnforce(requests [][]interface{}) ([]bool, error) { ret := _m.Called(requests) @@ -530,6 +1076,34 @@ func (_m *IEnforcer) BatchEnforce(requests [][]interface{}) ([]bool, error) { return r0, r1 } +// IEnforcer_BatchEnforce_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BatchEnforce' +type IEnforcer_BatchEnforce_Call struct { + *mock.Call +} + +// BatchEnforce is a helper method to define mock.On call +// - requests [][]interface{} +func (_e *IEnforcer_Expecter) BatchEnforce(requests interface{}) *IEnforcer_BatchEnforce_Call { + return &IEnforcer_BatchEnforce_Call{Call: _e.mock.On("BatchEnforce", requests)} +} + +func (_c *IEnforcer_BatchEnforce_Call) Run(run func(requests [][]interface{})) *IEnforcer_BatchEnforce_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([][]interface{})) + }) + return _c +} + +func (_c *IEnforcer_BatchEnforce_Call) Return(_a0 []bool, _a1 error) *IEnforcer_BatchEnforce_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_BatchEnforce_Call) RunAndReturn(run func([][]interface{}) ([]bool, error)) *IEnforcer_BatchEnforce_Call { + _c.Call.Return(run) + return _c +} + // BatchEnforceWithMatcher provides a mock function with given fields: matcher, requests func (_m *IEnforcer) BatchEnforceWithMatcher(matcher string, requests [][]interface{}) ([]bool, error) { ret := _m.Called(matcher, requests) @@ -560,6 +1134,35 @@ func (_m *IEnforcer) BatchEnforceWithMatcher(matcher string, requests [][]interf return r0, r1 } +// IEnforcer_BatchEnforceWithMatcher_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BatchEnforceWithMatcher' +type IEnforcer_BatchEnforceWithMatcher_Call struct { + *mock.Call +} + +// BatchEnforceWithMatcher is a helper method to define mock.On call +// - matcher string +// - requests [][]interface{} +func (_e *IEnforcer_Expecter) BatchEnforceWithMatcher(matcher interface{}, requests interface{}) *IEnforcer_BatchEnforceWithMatcher_Call { + return &IEnforcer_BatchEnforceWithMatcher_Call{Call: _e.mock.On("BatchEnforceWithMatcher", matcher, requests)} +} + +func (_c *IEnforcer_BatchEnforceWithMatcher_Call) Run(run func(matcher string, requests [][]interface{})) *IEnforcer_BatchEnforceWithMatcher_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([][]interface{})) + }) + return _c +} + +func (_c *IEnforcer_BatchEnforceWithMatcher_Call) Return(_a0 []bool, _a1 error) *IEnforcer_BatchEnforceWithMatcher_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_BatchEnforceWithMatcher_Call) RunAndReturn(run func(string, [][]interface{}) ([]bool, error)) *IEnforcer_BatchEnforceWithMatcher_Call { + _c.Call.Return(run) + return _c +} + // BuildRoleLinks provides a mock function with given fields: func (_m *IEnforcer) BuildRoleLinks() error { ret := _m.Called() @@ -578,11 +1181,65 @@ func (_m *IEnforcer) BuildRoleLinks() error { return r0 } +// IEnforcer_BuildRoleLinks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BuildRoleLinks' +type IEnforcer_BuildRoleLinks_Call struct { + *mock.Call +} + +// BuildRoleLinks is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) BuildRoleLinks() *IEnforcer_BuildRoleLinks_Call { + return &IEnforcer_BuildRoleLinks_Call{Call: _e.mock.On("BuildRoleLinks")} +} + +func (_c *IEnforcer_BuildRoleLinks_Call) Run(run func()) *IEnforcer_BuildRoleLinks_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_BuildRoleLinks_Call) Return(_a0 error) *IEnforcer_BuildRoleLinks_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_BuildRoleLinks_Call) RunAndReturn(run func() error) *IEnforcer_BuildRoleLinks_Call { + _c.Call.Return(run) + return _c +} + // ClearPolicy provides a mock function with given fields: func (_m *IEnforcer) ClearPolicy() { _m.Called() } +// IEnforcer_ClearPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClearPolicy' +type IEnforcer_ClearPolicy_Call struct { + *mock.Call +} + +// ClearPolicy is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) ClearPolicy() *IEnforcer_ClearPolicy_Call { + return &IEnforcer_ClearPolicy_Call{Call: _e.mock.On("ClearPolicy")} +} + +func (_c *IEnforcer_ClearPolicy_Call) Run(run func()) *IEnforcer_ClearPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_ClearPolicy_Call) Return() *IEnforcer_ClearPolicy_Call { + _c.Call.Return() + return _c +} + +func (_c *IEnforcer_ClearPolicy_Call) RunAndReturn(run func()) *IEnforcer_ClearPolicy_Call { + _c.Call.Return(run) + return _c +} + // DeleteAllUsersByDomain provides a mock function with given fields: domain func (_m *IEnforcer) DeleteAllUsersByDomain(domain string) (bool, error) { ret := _m.Called(domain) @@ -611,6 +1268,34 @@ func (_m *IEnforcer) DeleteAllUsersByDomain(domain string) (bool, error) { return r0, r1 } +// IEnforcer_DeleteAllUsersByDomain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteAllUsersByDomain' +type IEnforcer_DeleteAllUsersByDomain_Call struct { + *mock.Call +} + +// DeleteAllUsersByDomain is a helper method to define mock.On call +// - domain string +func (_e *IEnforcer_Expecter) DeleteAllUsersByDomain(domain interface{}) *IEnforcer_DeleteAllUsersByDomain_Call { + return &IEnforcer_DeleteAllUsersByDomain_Call{Call: _e.mock.On("DeleteAllUsersByDomain", domain)} +} + +func (_c *IEnforcer_DeleteAllUsersByDomain_Call) Run(run func(domain string)) *IEnforcer_DeleteAllUsersByDomain_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *IEnforcer_DeleteAllUsersByDomain_Call) Return(_a0 bool, _a1 error) *IEnforcer_DeleteAllUsersByDomain_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_DeleteAllUsersByDomain_Call) RunAndReturn(run func(string) (bool, error)) *IEnforcer_DeleteAllUsersByDomain_Call { + _c.Call.Return(run) + return _c +} + // DeleteDomains provides a mock function with given fields: domains func (_m *IEnforcer) DeleteDomains(domains ...string) (bool, error) { _va := make([]interface{}, len(domains)) @@ -645,6 +1330,41 @@ func (_m *IEnforcer) DeleteDomains(domains ...string) (bool, error) { return r0, r1 } +// IEnforcer_DeleteDomains_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDomains' +type IEnforcer_DeleteDomains_Call struct { + *mock.Call +} + +// DeleteDomains is a helper method to define mock.On call +// - domains ...string +func (_e *IEnforcer_Expecter) DeleteDomains(domains ...interface{}) *IEnforcer_DeleteDomains_Call { + return &IEnforcer_DeleteDomains_Call{Call: _e.mock.On("DeleteDomains", + append([]interface{}{}, domains...)...)} +} + +func (_c *IEnforcer_DeleteDomains_Call) Run(run func(domains ...string)) *IEnforcer_DeleteDomains_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_DeleteDomains_Call) Return(_a0 bool, _a1 error) *IEnforcer_DeleteDomains_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_DeleteDomains_Call) RunAndReturn(run func(...string) (bool, error)) *IEnforcer_DeleteDomains_Call { + _c.Call.Return(run) + return _c +} + // DeletePermission provides a mock function with given fields: permission func (_m *IEnforcer) DeletePermission(permission ...string) (bool, error) { _va := make([]interface{}, len(permission)) @@ -679,6 +1399,41 @@ func (_m *IEnforcer) DeletePermission(permission ...string) (bool, error) { return r0, r1 } +// IEnforcer_DeletePermission_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeletePermission' +type IEnforcer_DeletePermission_Call struct { + *mock.Call +} + +// DeletePermission is a helper method to define mock.On call +// - permission ...string +func (_e *IEnforcer_Expecter) DeletePermission(permission ...interface{}) *IEnforcer_DeletePermission_Call { + return &IEnforcer_DeletePermission_Call{Call: _e.mock.On("DeletePermission", + append([]interface{}{}, permission...)...)} +} + +func (_c *IEnforcer_DeletePermission_Call) Run(run func(permission ...string)) *IEnforcer_DeletePermission_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_DeletePermission_Call) Return(_a0 bool, _a1 error) *IEnforcer_DeletePermission_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_DeletePermission_Call) RunAndReturn(run func(...string) (bool, error)) *IEnforcer_DeletePermission_Call { + _c.Call.Return(run) + return _c +} + // DeletePermissionForUser provides a mock function with given fields: user, permission func (_m *IEnforcer) DeletePermissionForUser(user string, permission ...string) (bool, error) { _va := make([]interface{}, len(permission)) @@ -714,9 +1469,45 @@ func (_m *IEnforcer) DeletePermissionForUser(user string, permission ...string) return r0, r1 } -// DeletePermissionsForUser provides a mock function with given fields: user -func (_m *IEnforcer) DeletePermissionsForUser(user string) (bool, error) { - ret := _m.Called(user) +// IEnforcer_DeletePermissionForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeletePermissionForUser' +type IEnforcer_DeletePermissionForUser_Call struct { + *mock.Call +} + +// DeletePermissionForUser is a helper method to define mock.On call +// - user string +// - permission ...string +func (_e *IEnforcer_Expecter) DeletePermissionForUser(user interface{}, permission ...interface{}) *IEnforcer_DeletePermissionForUser_Call { + return &IEnforcer_DeletePermissionForUser_Call{Call: _e.mock.On("DeletePermissionForUser", + append([]interface{}{user}, permission...)...)} +} + +func (_c *IEnforcer_DeletePermissionForUser_Call) Run(run func(user string, permission ...string)) *IEnforcer_DeletePermissionForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_DeletePermissionForUser_Call) Return(_a0 bool, _a1 error) *IEnforcer_DeletePermissionForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_DeletePermissionForUser_Call) RunAndReturn(run func(string, ...string) (bool, error)) *IEnforcer_DeletePermissionForUser_Call { + _c.Call.Return(run) + return _c +} + +// DeletePermissionsForUser provides a mock function with given fields: user +func (_m *IEnforcer) DeletePermissionsForUser(user string) (bool, error) { + ret := _m.Called(user) if len(ret) == 0 { panic("no return value specified for DeletePermissionsForUser") @@ -742,6 +1533,34 @@ func (_m *IEnforcer) DeletePermissionsForUser(user string) (bool, error) { return r0, r1 } +// IEnforcer_DeletePermissionsForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeletePermissionsForUser' +type IEnforcer_DeletePermissionsForUser_Call struct { + *mock.Call +} + +// DeletePermissionsForUser is a helper method to define mock.On call +// - user string +func (_e *IEnforcer_Expecter) DeletePermissionsForUser(user interface{}) *IEnforcer_DeletePermissionsForUser_Call { + return &IEnforcer_DeletePermissionsForUser_Call{Call: _e.mock.On("DeletePermissionsForUser", user)} +} + +func (_c *IEnforcer_DeletePermissionsForUser_Call) Run(run func(user string)) *IEnforcer_DeletePermissionsForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *IEnforcer_DeletePermissionsForUser_Call) Return(_a0 bool, _a1 error) *IEnforcer_DeletePermissionsForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_DeletePermissionsForUser_Call) RunAndReturn(run func(string) (bool, error)) *IEnforcer_DeletePermissionsForUser_Call { + _c.Call.Return(run) + return _c +} + // DeleteRole provides a mock function with given fields: role func (_m *IEnforcer) DeleteRole(role string) (bool, error) { ret := _m.Called(role) @@ -770,6 +1589,34 @@ func (_m *IEnforcer) DeleteRole(role string) (bool, error) { return r0, r1 } +// IEnforcer_DeleteRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteRole' +type IEnforcer_DeleteRole_Call struct { + *mock.Call +} + +// DeleteRole is a helper method to define mock.On call +// - role string +func (_e *IEnforcer_Expecter) DeleteRole(role interface{}) *IEnforcer_DeleteRole_Call { + return &IEnforcer_DeleteRole_Call{Call: _e.mock.On("DeleteRole", role)} +} + +func (_c *IEnforcer_DeleteRole_Call) Run(run func(role string)) *IEnforcer_DeleteRole_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *IEnforcer_DeleteRole_Call) Return(_a0 bool, _a1 error) *IEnforcer_DeleteRole_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_DeleteRole_Call) RunAndReturn(run func(string) (bool, error)) *IEnforcer_DeleteRole_Call { + _c.Call.Return(run) + return _c +} + // DeleteRoleForUser provides a mock function with given fields: user, role, domain func (_m *IEnforcer) DeleteRoleForUser(user string, role string, domain ...string) (bool, error) { _va := make([]interface{}, len(domain)) @@ -805,6 +1652,43 @@ func (_m *IEnforcer) DeleteRoleForUser(user string, role string, domain ...strin return r0, r1 } +// IEnforcer_DeleteRoleForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteRoleForUser' +type IEnforcer_DeleteRoleForUser_Call struct { + *mock.Call +} + +// DeleteRoleForUser is a helper method to define mock.On call +// - user string +// - role string +// - domain ...string +func (_e *IEnforcer_Expecter) DeleteRoleForUser(user interface{}, role interface{}, domain ...interface{}) *IEnforcer_DeleteRoleForUser_Call { + return &IEnforcer_DeleteRoleForUser_Call{Call: _e.mock.On("DeleteRoleForUser", + append([]interface{}{user, role}, domain...)...)} +} + +func (_c *IEnforcer_DeleteRoleForUser_Call) Run(run func(user string, role string, domain ...string)) *IEnforcer_DeleteRoleForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), args[1].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_DeleteRoleForUser_Call) Return(_a0 bool, _a1 error) *IEnforcer_DeleteRoleForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_DeleteRoleForUser_Call) RunAndReturn(run func(string, string, ...string) (bool, error)) *IEnforcer_DeleteRoleForUser_Call { + _c.Call.Return(run) + return _c +} + // DeleteRoleForUserInDomain provides a mock function with given fields: user, role, domain func (_m *IEnforcer) DeleteRoleForUserInDomain(user string, role string, domain string) (bool, error) { ret := _m.Called(user, role, domain) @@ -833,6 +1717,36 @@ func (_m *IEnforcer) DeleteRoleForUserInDomain(user string, role string, domain return r0, r1 } +// IEnforcer_DeleteRoleForUserInDomain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteRoleForUserInDomain' +type IEnforcer_DeleteRoleForUserInDomain_Call struct { + *mock.Call +} + +// DeleteRoleForUserInDomain is a helper method to define mock.On call +// - user string +// - role string +// - domain string +func (_e *IEnforcer_Expecter) DeleteRoleForUserInDomain(user interface{}, role interface{}, domain interface{}) *IEnforcer_DeleteRoleForUserInDomain_Call { + return &IEnforcer_DeleteRoleForUserInDomain_Call{Call: _e.mock.On("DeleteRoleForUserInDomain", user, role, domain)} +} + +func (_c *IEnforcer_DeleteRoleForUserInDomain_Call) Run(run func(user string, role string, domain string)) *IEnforcer_DeleteRoleForUserInDomain_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *IEnforcer_DeleteRoleForUserInDomain_Call) Return(_a0 bool, _a1 error) *IEnforcer_DeleteRoleForUserInDomain_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_DeleteRoleForUserInDomain_Call) RunAndReturn(run func(string, string, string) (bool, error)) *IEnforcer_DeleteRoleForUserInDomain_Call { + _c.Call.Return(run) + return _c +} + // DeleteRolesForUser provides a mock function with given fields: user, domain func (_m *IEnforcer) DeleteRolesForUser(user string, domain ...string) (bool, error) { _va := make([]interface{}, len(domain)) @@ -868,6 +1782,42 @@ func (_m *IEnforcer) DeleteRolesForUser(user string, domain ...string) (bool, er return r0, r1 } +// IEnforcer_DeleteRolesForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteRolesForUser' +type IEnforcer_DeleteRolesForUser_Call struct { + *mock.Call +} + +// DeleteRolesForUser is a helper method to define mock.On call +// - user string +// - domain ...string +func (_e *IEnforcer_Expecter) DeleteRolesForUser(user interface{}, domain ...interface{}) *IEnforcer_DeleteRolesForUser_Call { + return &IEnforcer_DeleteRolesForUser_Call{Call: _e.mock.On("DeleteRolesForUser", + append([]interface{}{user}, domain...)...)} +} + +func (_c *IEnforcer_DeleteRolesForUser_Call) Run(run func(user string, domain ...string)) *IEnforcer_DeleteRolesForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_DeleteRolesForUser_Call) Return(_a0 bool, _a1 error) *IEnforcer_DeleteRolesForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_DeleteRolesForUser_Call) RunAndReturn(run func(string, ...string) (bool, error)) *IEnforcer_DeleteRolesForUser_Call { + _c.Call.Return(run) + return _c +} + // DeleteRolesForUserInDomain provides a mock function with given fields: user, domain func (_m *IEnforcer) DeleteRolesForUserInDomain(user string, domain string) (bool, error) { ret := _m.Called(user, domain) @@ -896,6 +1846,35 @@ func (_m *IEnforcer) DeleteRolesForUserInDomain(user string, domain string) (boo return r0, r1 } +// IEnforcer_DeleteRolesForUserInDomain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteRolesForUserInDomain' +type IEnforcer_DeleteRolesForUserInDomain_Call struct { + *mock.Call +} + +// DeleteRolesForUserInDomain is a helper method to define mock.On call +// - user string +// - domain string +func (_e *IEnforcer_Expecter) DeleteRolesForUserInDomain(user interface{}, domain interface{}) *IEnforcer_DeleteRolesForUserInDomain_Call { + return &IEnforcer_DeleteRolesForUserInDomain_Call{Call: _e.mock.On("DeleteRolesForUserInDomain", user, domain)} +} + +func (_c *IEnforcer_DeleteRolesForUserInDomain_Call) Run(run func(user string, domain string)) *IEnforcer_DeleteRolesForUserInDomain_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *IEnforcer_DeleteRolesForUserInDomain_Call) Return(_a0 bool, _a1 error) *IEnforcer_DeleteRolesForUserInDomain_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_DeleteRolesForUserInDomain_Call) RunAndReturn(run func(string, string) (bool, error)) *IEnforcer_DeleteRolesForUserInDomain_Call { + _c.Call.Return(run) + return _c +} + // DeleteUser provides a mock function with given fields: user func (_m *IEnforcer) DeleteUser(user string) (bool, error) { ret := _m.Called(user) @@ -924,31 +1903,199 @@ func (_m *IEnforcer) DeleteUser(user string) (bool, error) { return r0, r1 } +// IEnforcer_DeleteUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteUser' +type IEnforcer_DeleteUser_Call struct { + *mock.Call +} + +// DeleteUser is a helper method to define mock.On call +// - user string +func (_e *IEnforcer_Expecter) DeleteUser(user interface{}) *IEnforcer_DeleteUser_Call { + return &IEnforcer_DeleteUser_Call{Call: _e.mock.On("DeleteUser", user)} +} + +func (_c *IEnforcer_DeleteUser_Call) Run(run func(user string)) *IEnforcer_DeleteUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *IEnforcer_DeleteUser_Call) Return(_a0 bool, _a1 error) *IEnforcer_DeleteUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_DeleteUser_Call) RunAndReturn(run func(string) (bool, error)) *IEnforcer_DeleteUser_Call { + _c.Call.Return(run) + return _c +} + // EnableAutoBuildRoleLinks provides a mock function with given fields: autoBuildRoleLinks func (_m *IEnforcer) EnableAutoBuildRoleLinks(autoBuildRoleLinks bool) { _m.Called(autoBuildRoleLinks) } +// IEnforcer_EnableAutoBuildRoleLinks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnableAutoBuildRoleLinks' +type IEnforcer_EnableAutoBuildRoleLinks_Call struct { + *mock.Call +} + +// EnableAutoBuildRoleLinks is a helper method to define mock.On call +// - autoBuildRoleLinks bool +func (_e *IEnforcer_Expecter) EnableAutoBuildRoleLinks(autoBuildRoleLinks interface{}) *IEnforcer_EnableAutoBuildRoleLinks_Call { + return &IEnforcer_EnableAutoBuildRoleLinks_Call{Call: _e.mock.On("EnableAutoBuildRoleLinks", autoBuildRoleLinks)} +} + +func (_c *IEnforcer_EnableAutoBuildRoleLinks_Call) Run(run func(autoBuildRoleLinks bool)) *IEnforcer_EnableAutoBuildRoleLinks_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(bool)) + }) + return _c +} + +func (_c *IEnforcer_EnableAutoBuildRoleLinks_Call) Return() *IEnforcer_EnableAutoBuildRoleLinks_Call { + _c.Call.Return() + return _c +} + +func (_c *IEnforcer_EnableAutoBuildRoleLinks_Call) RunAndReturn(run func(bool)) *IEnforcer_EnableAutoBuildRoleLinks_Call { + _c.Call.Return(run) + return _c +} + // EnableAutoNotifyWatcher provides a mock function with given fields: enable func (_m *IEnforcer) EnableAutoNotifyWatcher(enable bool) { _m.Called(enable) } +// IEnforcer_EnableAutoNotifyWatcher_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnableAutoNotifyWatcher' +type IEnforcer_EnableAutoNotifyWatcher_Call struct { + *mock.Call +} + +// EnableAutoNotifyWatcher is a helper method to define mock.On call +// - enable bool +func (_e *IEnforcer_Expecter) EnableAutoNotifyWatcher(enable interface{}) *IEnforcer_EnableAutoNotifyWatcher_Call { + return &IEnforcer_EnableAutoNotifyWatcher_Call{Call: _e.mock.On("EnableAutoNotifyWatcher", enable)} +} + +func (_c *IEnforcer_EnableAutoNotifyWatcher_Call) Run(run func(enable bool)) *IEnforcer_EnableAutoNotifyWatcher_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(bool)) + }) + return _c +} + +func (_c *IEnforcer_EnableAutoNotifyWatcher_Call) Return() *IEnforcer_EnableAutoNotifyWatcher_Call { + _c.Call.Return() + return _c +} + +func (_c *IEnforcer_EnableAutoNotifyWatcher_Call) RunAndReturn(run func(bool)) *IEnforcer_EnableAutoNotifyWatcher_Call { + _c.Call.Return(run) + return _c +} + // EnableAutoSave provides a mock function with given fields: autoSave func (_m *IEnforcer) EnableAutoSave(autoSave bool) { _m.Called(autoSave) } +// IEnforcer_EnableAutoSave_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnableAutoSave' +type IEnforcer_EnableAutoSave_Call struct { + *mock.Call +} + +// EnableAutoSave is a helper method to define mock.On call +// - autoSave bool +func (_e *IEnforcer_Expecter) EnableAutoSave(autoSave interface{}) *IEnforcer_EnableAutoSave_Call { + return &IEnforcer_EnableAutoSave_Call{Call: _e.mock.On("EnableAutoSave", autoSave)} +} + +func (_c *IEnforcer_EnableAutoSave_Call) Run(run func(autoSave bool)) *IEnforcer_EnableAutoSave_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(bool)) + }) + return _c +} + +func (_c *IEnforcer_EnableAutoSave_Call) Return() *IEnforcer_EnableAutoSave_Call { + _c.Call.Return() + return _c +} + +func (_c *IEnforcer_EnableAutoSave_Call) RunAndReturn(run func(bool)) *IEnforcer_EnableAutoSave_Call { + _c.Call.Return(run) + return _c +} + // EnableEnforce provides a mock function with given fields: enable func (_m *IEnforcer) EnableEnforce(enable bool) { _m.Called(enable) } +// IEnforcer_EnableEnforce_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnableEnforce' +type IEnforcer_EnableEnforce_Call struct { + *mock.Call +} + +// EnableEnforce is a helper method to define mock.On call +// - enable bool +func (_e *IEnforcer_Expecter) EnableEnforce(enable interface{}) *IEnforcer_EnableEnforce_Call { + return &IEnforcer_EnableEnforce_Call{Call: _e.mock.On("EnableEnforce", enable)} +} + +func (_c *IEnforcer_EnableEnforce_Call) Run(run func(enable bool)) *IEnforcer_EnableEnforce_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(bool)) + }) + return _c +} + +func (_c *IEnforcer_EnableEnforce_Call) Return() *IEnforcer_EnableEnforce_Call { + _c.Call.Return() + return _c +} + +func (_c *IEnforcer_EnableEnforce_Call) RunAndReturn(run func(bool)) *IEnforcer_EnableEnforce_Call { + _c.Call.Return(run) + return _c +} + // EnableLog provides a mock function with given fields: enable func (_m *IEnforcer) EnableLog(enable bool) { _m.Called(enable) } +// IEnforcer_EnableLog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnableLog' +type IEnforcer_EnableLog_Call struct { + *mock.Call +} + +// EnableLog is a helper method to define mock.On call +// - enable bool +func (_e *IEnforcer_Expecter) EnableLog(enable interface{}) *IEnforcer_EnableLog_Call { + return &IEnforcer_EnableLog_Call{Call: _e.mock.On("EnableLog", enable)} +} + +func (_c *IEnforcer_EnableLog_Call) Run(run func(enable bool)) *IEnforcer_EnableLog_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(bool)) + }) + return _c +} + +func (_c *IEnforcer_EnableLog_Call) Return() *IEnforcer_EnableLog_Call { + _c.Call.Return() + return _c +} + +func (_c *IEnforcer_EnableLog_Call) RunAndReturn(run func(bool)) *IEnforcer_EnableLog_Call { + _c.Call.Return(run) + return _c +} + // Enforce provides a mock function with given fields: rvals func (_m *IEnforcer) Enforce(rvals ...interface{}) (bool, error) { var _ca []interface{} @@ -979,6 +2126,41 @@ func (_m *IEnforcer) Enforce(rvals ...interface{}) (bool, error) { return r0, r1 } +// IEnforcer_Enforce_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Enforce' +type IEnforcer_Enforce_Call struct { + *mock.Call +} + +// Enforce is a helper method to define mock.On call +// - rvals ...interface{} +func (_e *IEnforcer_Expecter) Enforce(rvals ...interface{}) *IEnforcer_Enforce_Call { + return &IEnforcer_Enforce_Call{Call: _e.mock.On("Enforce", + append([]interface{}{}, rvals...)...)} +} + +func (_c *IEnforcer_Enforce_Call) Run(run func(rvals ...interface{})) *IEnforcer_Enforce_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_Enforce_Call) Return(_a0 bool, _a1 error) *IEnforcer_Enforce_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_Enforce_Call) RunAndReturn(run func(...interface{}) (bool, error)) *IEnforcer_Enforce_Call { + _c.Call.Return(run) + return _c +} + // EnforceEx provides a mock function with given fields: rvals func (_m *IEnforcer) EnforceEx(rvals ...interface{}) (bool, []string, error) { var _ca []interface{} @@ -1018,6 +2200,41 @@ func (_m *IEnforcer) EnforceEx(rvals ...interface{}) (bool, []string, error) { return r0, r1, r2 } +// IEnforcer_EnforceEx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnforceEx' +type IEnforcer_EnforceEx_Call struct { + *mock.Call +} + +// EnforceEx is a helper method to define mock.On call +// - rvals ...interface{} +func (_e *IEnforcer_Expecter) EnforceEx(rvals ...interface{}) *IEnforcer_EnforceEx_Call { + return &IEnforcer_EnforceEx_Call{Call: _e.mock.On("EnforceEx", + append([]interface{}{}, rvals...)...)} +} + +func (_c *IEnforcer_EnforceEx_Call) Run(run func(rvals ...interface{})) *IEnforcer_EnforceEx_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_EnforceEx_Call) Return(_a0 bool, _a1 []string, _a2 error) *IEnforcer_EnforceEx_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *IEnforcer_EnforceEx_Call) RunAndReturn(run func(...interface{}) (bool, []string, error)) *IEnforcer_EnforceEx_Call { + _c.Call.Return(run) + return _c +} + // EnforceExWithMatcher provides a mock function with given fields: matcher, rvals func (_m *IEnforcer) EnforceExWithMatcher(matcher string, rvals ...interface{}) (bool, []string, error) { var _ca []interface{} @@ -1058,6 +2275,42 @@ func (_m *IEnforcer) EnforceExWithMatcher(matcher string, rvals ...interface{}) return r0, r1, r2 } +// IEnforcer_EnforceExWithMatcher_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnforceExWithMatcher' +type IEnforcer_EnforceExWithMatcher_Call struct { + *mock.Call +} + +// EnforceExWithMatcher is a helper method to define mock.On call +// - matcher string +// - rvals ...interface{} +func (_e *IEnforcer_Expecter) EnforceExWithMatcher(matcher interface{}, rvals ...interface{}) *IEnforcer_EnforceExWithMatcher_Call { + return &IEnforcer_EnforceExWithMatcher_Call{Call: _e.mock.On("EnforceExWithMatcher", + append([]interface{}{matcher}, rvals...)...)} +} + +func (_c *IEnforcer_EnforceExWithMatcher_Call) Run(run func(matcher string, rvals ...interface{})) *IEnforcer_EnforceExWithMatcher_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_EnforceExWithMatcher_Call) Return(_a0 bool, _a1 []string, _a2 error) *IEnforcer_EnforceExWithMatcher_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *IEnforcer_EnforceExWithMatcher_Call) RunAndReturn(run func(string, ...interface{}) (bool, []string, error)) *IEnforcer_EnforceExWithMatcher_Call { + _c.Call.Return(run) + return _c +} + // EnforceWithMatcher provides a mock function with given fields: matcher, rvals func (_m *IEnforcer) EnforceWithMatcher(matcher string, rvals ...interface{}) (bool, error) { var _ca []interface{} @@ -1089,6 +2342,42 @@ func (_m *IEnforcer) EnforceWithMatcher(matcher string, rvals ...interface{}) (b return r0, r1 } +// IEnforcer_EnforceWithMatcher_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnforceWithMatcher' +type IEnforcer_EnforceWithMatcher_Call struct { + *mock.Call +} + +// EnforceWithMatcher is a helper method to define mock.On call +// - matcher string +// - rvals ...interface{} +func (_e *IEnforcer_Expecter) EnforceWithMatcher(matcher interface{}, rvals ...interface{}) *IEnforcer_EnforceWithMatcher_Call { + return &IEnforcer_EnforceWithMatcher_Call{Call: _e.mock.On("EnforceWithMatcher", + append([]interface{}{matcher}, rvals...)...)} +} + +func (_c *IEnforcer_EnforceWithMatcher_Call) Run(run func(matcher string, rvals ...interface{})) *IEnforcer_EnforceWithMatcher_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_EnforceWithMatcher_Call) Return(_a0 bool, _a1 error) *IEnforcer_EnforceWithMatcher_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_EnforceWithMatcher_Call) RunAndReturn(run func(string, ...interface{}) (bool, error)) *IEnforcer_EnforceWithMatcher_Call { + _c.Call.Return(run) + return _c +} + // GetAdapter provides a mock function with given fields: func (_m *IEnforcer) GetAdapter() persist.Adapter { ret := _m.Called() @@ -1109,6 +2398,33 @@ func (_m *IEnforcer) GetAdapter() persist.Adapter { return r0 } +// IEnforcer_GetAdapter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAdapter' +type IEnforcer_GetAdapter_Call struct { + *mock.Call +} + +// GetAdapter is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) GetAdapter() *IEnforcer_GetAdapter_Call { + return &IEnforcer_GetAdapter_Call{Call: _e.mock.On("GetAdapter")} +} + +func (_c *IEnforcer_GetAdapter_Call) Run(run func()) *IEnforcer_GetAdapter_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_GetAdapter_Call) Return(_a0 persist.Adapter) *IEnforcer_GetAdapter_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_GetAdapter_Call) RunAndReturn(run func() persist.Adapter) *IEnforcer_GetAdapter_Call { + _c.Call.Return(run) + return _c +} + // GetAllActions provides a mock function with given fields: func (_m *IEnforcer) GetAllActions() ([]string, error) { ret := _m.Called() @@ -1139,6 +2455,33 @@ func (_m *IEnforcer) GetAllActions() ([]string, error) { return r0, r1 } +// IEnforcer_GetAllActions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllActions' +type IEnforcer_GetAllActions_Call struct { + *mock.Call +} + +// GetAllActions is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) GetAllActions() *IEnforcer_GetAllActions_Call { + return &IEnforcer_GetAllActions_Call{Call: _e.mock.On("GetAllActions")} +} + +func (_c *IEnforcer_GetAllActions_Call) Run(run func()) *IEnforcer_GetAllActions_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_GetAllActions_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetAllActions_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetAllActions_Call) RunAndReturn(run func() ([]string, error)) *IEnforcer_GetAllActions_Call { + _c.Call.Return(run) + return _c +} + // GetAllDomains provides a mock function with given fields: func (_m *IEnforcer) GetAllDomains() ([]string, error) { ret := _m.Called() @@ -1169,6 +2512,33 @@ func (_m *IEnforcer) GetAllDomains() ([]string, error) { return r0, r1 } +// IEnforcer_GetAllDomains_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllDomains' +type IEnforcer_GetAllDomains_Call struct { + *mock.Call +} + +// GetAllDomains is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) GetAllDomains() *IEnforcer_GetAllDomains_Call { + return &IEnforcer_GetAllDomains_Call{Call: _e.mock.On("GetAllDomains")} +} + +func (_c *IEnforcer_GetAllDomains_Call) Run(run func()) *IEnforcer_GetAllDomains_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_GetAllDomains_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetAllDomains_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetAllDomains_Call) RunAndReturn(run func() ([]string, error)) *IEnforcer_GetAllDomains_Call { + _c.Call.Return(run) + return _c +} + // GetAllNamedActions provides a mock function with given fields: ptype func (_m *IEnforcer) GetAllNamedActions(ptype string) ([]string, error) { ret := _m.Called(ptype) @@ -1199,6 +2569,34 @@ func (_m *IEnforcer) GetAllNamedActions(ptype string) ([]string, error) { return r0, r1 } +// IEnforcer_GetAllNamedActions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllNamedActions' +type IEnforcer_GetAllNamedActions_Call struct { + *mock.Call +} + +// GetAllNamedActions is a helper method to define mock.On call +// - ptype string +func (_e *IEnforcer_Expecter) GetAllNamedActions(ptype interface{}) *IEnforcer_GetAllNamedActions_Call { + return &IEnforcer_GetAllNamedActions_Call{Call: _e.mock.On("GetAllNamedActions", ptype)} +} + +func (_c *IEnforcer_GetAllNamedActions_Call) Run(run func(ptype string)) *IEnforcer_GetAllNamedActions_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *IEnforcer_GetAllNamedActions_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetAllNamedActions_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetAllNamedActions_Call) RunAndReturn(run func(string) ([]string, error)) *IEnforcer_GetAllNamedActions_Call { + _c.Call.Return(run) + return _c +} + // GetAllNamedObjects provides a mock function with given fields: ptype func (_m *IEnforcer) GetAllNamedObjects(ptype string) ([]string, error) { ret := _m.Called(ptype) @@ -1229,6 +2627,34 @@ func (_m *IEnforcer) GetAllNamedObjects(ptype string) ([]string, error) { return r0, r1 } +// IEnforcer_GetAllNamedObjects_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllNamedObjects' +type IEnforcer_GetAllNamedObjects_Call struct { + *mock.Call +} + +// GetAllNamedObjects is a helper method to define mock.On call +// - ptype string +func (_e *IEnforcer_Expecter) GetAllNamedObjects(ptype interface{}) *IEnforcer_GetAllNamedObjects_Call { + return &IEnforcer_GetAllNamedObjects_Call{Call: _e.mock.On("GetAllNamedObjects", ptype)} +} + +func (_c *IEnforcer_GetAllNamedObjects_Call) Run(run func(ptype string)) *IEnforcer_GetAllNamedObjects_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *IEnforcer_GetAllNamedObjects_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetAllNamedObjects_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetAllNamedObjects_Call) RunAndReturn(run func(string) ([]string, error)) *IEnforcer_GetAllNamedObjects_Call { + _c.Call.Return(run) + return _c +} + // GetAllNamedRoles provides a mock function with given fields: ptype func (_m *IEnforcer) GetAllNamedRoles(ptype string) ([]string, error) { ret := _m.Called(ptype) @@ -1259,6 +2685,34 @@ func (_m *IEnforcer) GetAllNamedRoles(ptype string) ([]string, error) { return r0, r1 } +// IEnforcer_GetAllNamedRoles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllNamedRoles' +type IEnforcer_GetAllNamedRoles_Call struct { + *mock.Call +} + +// GetAllNamedRoles is a helper method to define mock.On call +// - ptype string +func (_e *IEnforcer_Expecter) GetAllNamedRoles(ptype interface{}) *IEnforcer_GetAllNamedRoles_Call { + return &IEnforcer_GetAllNamedRoles_Call{Call: _e.mock.On("GetAllNamedRoles", ptype)} +} + +func (_c *IEnforcer_GetAllNamedRoles_Call) Run(run func(ptype string)) *IEnforcer_GetAllNamedRoles_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *IEnforcer_GetAllNamedRoles_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetAllNamedRoles_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetAllNamedRoles_Call) RunAndReturn(run func(string) ([]string, error)) *IEnforcer_GetAllNamedRoles_Call { + _c.Call.Return(run) + return _c +} + // GetAllNamedSubjects provides a mock function with given fields: ptype func (_m *IEnforcer) GetAllNamedSubjects(ptype string) ([]string, error) { ret := _m.Called(ptype) @@ -1289,6 +2743,34 @@ func (_m *IEnforcer) GetAllNamedSubjects(ptype string) ([]string, error) { return r0, r1 } +// IEnforcer_GetAllNamedSubjects_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllNamedSubjects' +type IEnforcer_GetAllNamedSubjects_Call struct { + *mock.Call +} + +// GetAllNamedSubjects is a helper method to define mock.On call +// - ptype string +func (_e *IEnforcer_Expecter) GetAllNamedSubjects(ptype interface{}) *IEnforcer_GetAllNamedSubjects_Call { + return &IEnforcer_GetAllNamedSubjects_Call{Call: _e.mock.On("GetAllNamedSubjects", ptype)} +} + +func (_c *IEnforcer_GetAllNamedSubjects_Call) Run(run func(ptype string)) *IEnforcer_GetAllNamedSubjects_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *IEnforcer_GetAllNamedSubjects_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetAllNamedSubjects_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetAllNamedSubjects_Call) RunAndReturn(run func(string) ([]string, error)) *IEnforcer_GetAllNamedSubjects_Call { + _c.Call.Return(run) + return _c +} + // GetAllObjects provides a mock function with given fields: func (_m *IEnforcer) GetAllObjects() ([]string, error) { ret := _m.Called() @@ -1319,6 +2801,33 @@ func (_m *IEnforcer) GetAllObjects() ([]string, error) { return r0, r1 } +// IEnforcer_GetAllObjects_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllObjects' +type IEnforcer_GetAllObjects_Call struct { + *mock.Call +} + +// GetAllObjects is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) GetAllObjects() *IEnforcer_GetAllObjects_Call { + return &IEnforcer_GetAllObjects_Call{Call: _e.mock.On("GetAllObjects")} +} + +func (_c *IEnforcer_GetAllObjects_Call) Run(run func()) *IEnforcer_GetAllObjects_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_GetAllObjects_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetAllObjects_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetAllObjects_Call) RunAndReturn(run func() ([]string, error)) *IEnforcer_GetAllObjects_Call { + _c.Call.Return(run) + return _c +} + // GetAllRoles provides a mock function with given fields: func (_m *IEnforcer) GetAllRoles() ([]string, error) { ret := _m.Called() @@ -1349,6 +2858,33 @@ func (_m *IEnforcer) GetAllRoles() ([]string, error) { return r0, r1 } +// IEnforcer_GetAllRoles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllRoles' +type IEnforcer_GetAllRoles_Call struct { + *mock.Call +} + +// GetAllRoles is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) GetAllRoles() *IEnforcer_GetAllRoles_Call { + return &IEnforcer_GetAllRoles_Call{Call: _e.mock.On("GetAllRoles")} +} + +func (_c *IEnforcer_GetAllRoles_Call) Run(run func()) *IEnforcer_GetAllRoles_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_GetAllRoles_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetAllRoles_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetAllRoles_Call) RunAndReturn(run func() ([]string, error)) *IEnforcer_GetAllRoles_Call { + _c.Call.Return(run) + return _c +} + // GetAllRolesByDomain provides a mock function with given fields: domain func (_m *IEnforcer) GetAllRolesByDomain(domain string) ([]string, error) { ret := _m.Called(domain) @@ -1379,6 +2915,34 @@ func (_m *IEnforcer) GetAllRolesByDomain(domain string) ([]string, error) { return r0, r1 } +// IEnforcer_GetAllRolesByDomain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllRolesByDomain' +type IEnforcer_GetAllRolesByDomain_Call struct { + *mock.Call +} + +// GetAllRolesByDomain is a helper method to define mock.On call +// - domain string +func (_e *IEnforcer_Expecter) GetAllRolesByDomain(domain interface{}) *IEnforcer_GetAllRolesByDomain_Call { + return &IEnforcer_GetAllRolesByDomain_Call{Call: _e.mock.On("GetAllRolesByDomain", domain)} +} + +func (_c *IEnforcer_GetAllRolesByDomain_Call) Run(run func(domain string)) *IEnforcer_GetAllRolesByDomain_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *IEnforcer_GetAllRolesByDomain_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetAllRolesByDomain_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetAllRolesByDomain_Call) RunAndReturn(run func(string) ([]string, error)) *IEnforcer_GetAllRolesByDomain_Call { + _c.Call.Return(run) + return _c +} + // GetAllSubjects provides a mock function with given fields: func (_m *IEnforcer) GetAllSubjects() ([]string, error) { ret := _m.Called() @@ -1409,6 +2973,33 @@ func (_m *IEnforcer) GetAllSubjects() ([]string, error) { return r0, r1 } +// IEnforcer_GetAllSubjects_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllSubjects' +type IEnforcer_GetAllSubjects_Call struct { + *mock.Call +} + +// GetAllSubjects is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) GetAllSubjects() *IEnforcer_GetAllSubjects_Call { + return &IEnforcer_GetAllSubjects_Call{Call: _e.mock.On("GetAllSubjects")} +} + +func (_c *IEnforcer_GetAllSubjects_Call) Run(run func()) *IEnforcer_GetAllSubjects_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_GetAllSubjects_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetAllSubjects_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetAllSubjects_Call) RunAndReturn(run func() ([]string, error)) *IEnforcer_GetAllSubjects_Call { + _c.Call.Return(run) + return _c +} + // GetAllUsersByDomain provides a mock function with given fields: domain func (_m *IEnforcer) GetAllUsersByDomain(domain string) ([]string, error) { ret := _m.Called(domain) @@ -1439,6 +3030,34 @@ func (_m *IEnforcer) GetAllUsersByDomain(domain string) ([]string, error) { return r0, r1 } +// IEnforcer_GetAllUsersByDomain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllUsersByDomain' +type IEnforcer_GetAllUsersByDomain_Call struct { + *mock.Call +} + +// GetAllUsersByDomain is a helper method to define mock.On call +// - domain string +func (_e *IEnforcer_Expecter) GetAllUsersByDomain(domain interface{}) *IEnforcer_GetAllUsersByDomain_Call { + return &IEnforcer_GetAllUsersByDomain_Call{Call: _e.mock.On("GetAllUsersByDomain", domain)} +} + +func (_c *IEnforcer_GetAllUsersByDomain_Call) Run(run func(domain string)) *IEnforcer_GetAllUsersByDomain_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *IEnforcer_GetAllUsersByDomain_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetAllUsersByDomain_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetAllUsersByDomain_Call) RunAndReturn(run func(string) ([]string, error)) *IEnforcer_GetAllUsersByDomain_Call { + _c.Call.Return(run) + return _c +} + // GetFilteredGroupingPolicy provides a mock function with given fields: fieldIndex, fieldValues func (_m *IEnforcer) GetFilteredGroupingPolicy(fieldIndex int, fieldValues ...string) ([][]string, error) { _va := make([]interface{}, len(fieldValues)) @@ -1476,6 +3095,42 @@ func (_m *IEnforcer) GetFilteredGroupingPolicy(fieldIndex int, fieldValues ...st return r0, r1 } +// IEnforcer_GetFilteredGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFilteredGroupingPolicy' +type IEnforcer_GetFilteredGroupingPolicy_Call struct { + *mock.Call +} + +// GetFilteredGroupingPolicy is a helper method to define mock.On call +// - fieldIndex int +// - fieldValues ...string +func (_e *IEnforcer_Expecter) GetFilteredGroupingPolicy(fieldIndex interface{}, fieldValues ...interface{}) *IEnforcer_GetFilteredGroupingPolicy_Call { + return &IEnforcer_GetFilteredGroupingPolicy_Call{Call: _e.mock.On("GetFilteredGroupingPolicy", + append([]interface{}{fieldIndex}, fieldValues...)...)} +} + +func (_c *IEnforcer_GetFilteredGroupingPolicy_Call) Run(run func(fieldIndex int, fieldValues ...string)) *IEnforcer_GetFilteredGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(int), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_GetFilteredGroupingPolicy_Call) Return(_a0 [][]string, _a1 error) *IEnforcer_GetFilteredGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetFilteredGroupingPolicy_Call) RunAndReturn(run func(int, ...string) ([][]string, error)) *IEnforcer_GetFilteredGroupingPolicy_Call { + _c.Call.Return(run) + return _c +} + // GetFilteredNamedGroupingPolicy provides a mock function with given fields: ptype, fieldIndex, fieldValues func (_m *IEnforcer) GetFilteredNamedGroupingPolicy(ptype string, fieldIndex int, fieldValues ...string) ([][]string, error) { _va := make([]interface{}, len(fieldValues)) @@ -1513,6 +3168,43 @@ func (_m *IEnforcer) GetFilteredNamedGroupingPolicy(ptype string, fieldIndex int return r0, r1 } +// IEnforcer_GetFilteredNamedGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFilteredNamedGroupingPolicy' +type IEnforcer_GetFilteredNamedGroupingPolicy_Call struct { + *mock.Call +} + +// GetFilteredNamedGroupingPolicy is a helper method to define mock.On call +// - ptype string +// - fieldIndex int +// - fieldValues ...string +func (_e *IEnforcer_Expecter) GetFilteredNamedGroupingPolicy(ptype interface{}, fieldIndex interface{}, fieldValues ...interface{}) *IEnforcer_GetFilteredNamedGroupingPolicy_Call { + return &IEnforcer_GetFilteredNamedGroupingPolicy_Call{Call: _e.mock.On("GetFilteredNamedGroupingPolicy", + append([]interface{}{ptype, fieldIndex}, fieldValues...)...)} +} + +func (_c *IEnforcer_GetFilteredNamedGroupingPolicy_Call) Run(run func(ptype string, fieldIndex int, fieldValues ...string)) *IEnforcer_GetFilteredNamedGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), args[1].(int), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_GetFilteredNamedGroupingPolicy_Call) Return(_a0 [][]string, _a1 error) *IEnforcer_GetFilteredNamedGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetFilteredNamedGroupingPolicy_Call) RunAndReturn(run func(string, int, ...string) ([][]string, error)) *IEnforcer_GetFilteredNamedGroupingPolicy_Call { + _c.Call.Return(run) + return _c +} + // GetFilteredNamedPolicy provides a mock function with given fields: ptype, fieldIndex, fieldValues func (_m *IEnforcer) GetFilteredNamedPolicy(ptype string, fieldIndex int, fieldValues ...string) ([][]string, error) { _va := make([]interface{}, len(fieldValues)) @@ -1550,6 +3242,43 @@ func (_m *IEnforcer) GetFilteredNamedPolicy(ptype string, fieldIndex int, fieldV return r0, r1 } +// IEnforcer_GetFilteredNamedPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFilteredNamedPolicy' +type IEnforcer_GetFilteredNamedPolicy_Call struct { + *mock.Call +} + +// GetFilteredNamedPolicy is a helper method to define mock.On call +// - ptype string +// - fieldIndex int +// - fieldValues ...string +func (_e *IEnforcer_Expecter) GetFilteredNamedPolicy(ptype interface{}, fieldIndex interface{}, fieldValues ...interface{}) *IEnforcer_GetFilteredNamedPolicy_Call { + return &IEnforcer_GetFilteredNamedPolicy_Call{Call: _e.mock.On("GetFilteredNamedPolicy", + append([]interface{}{ptype, fieldIndex}, fieldValues...)...)} +} + +func (_c *IEnforcer_GetFilteredNamedPolicy_Call) Run(run func(ptype string, fieldIndex int, fieldValues ...string)) *IEnforcer_GetFilteredNamedPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), args[1].(int), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_GetFilteredNamedPolicy_Call) Return(_a0 [][]string, _a1 error) *IEnforcer_GetFilteredNamedPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetFilteredNamedPolicy_Call) RunAndReturn(run func(string, int, ...string) ([][]string, error)) *IEnforcer_GetFilteredNamedPolicy_Call { + _c.Call.Return(run) + return _c +} + // GetFilteredPolicy provides a mock function with given fields: fieldIndex, fieldValues func (_m *IEnforcer) GetFilteredPolicy(fieldIndex int, fieldValues ...string) ([][]string, error) { _va := make([]interface{}, len(fieldValues)) @@ -1587,6 +3316,42 @@ func (_m *IEnforcer) GetFilteredPolicy(fieldIndex int, fieldValues ...string) ([ return r0, r1 } +// IEnforcer_GetFilteredPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFilteredPolicy' +type IEnforcer_GetFilteredPolicy_Call struct { + *mock.Call +} + +// GetFilteredPolicy is a helper method to define mock.On call +// - fieldIndex int +// - fieldValues ...string +func (_e *IEnforcer_Expecter) GetFilteredPolicy(fieldIndex interface{}, fieldValues ...interface{}) *IEnforcer_GetFilteredPolicy_Call { + return &IEnforcer_GetFilteredPolicy_Call{Call: _e.mock.On("GetFilteredPolicy", + append([]interface{}{fieldIndex}, fieldValues...)...)} +} + +func (_c *IEnforcer_GetFilteredPolicy_Call) Run(run func(fieldIndex int, fieldValues ...string)) *IEnforcer_GetFilteredPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(int), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_GetFilteredPolicy_Call) Return(_a0 [][]string, _a1 error) *IEnforcer_GetFilteredPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetFilteredPolicy_Call) RunAndReturn(run func(int, ...string) ([][]string, error)) *IEnforcer_GetFilteredPolicy_Call { + _c.Call.Return(run) + return _c +} + // GetGroupingPolicy provides a mock function with given fields: func (_m *IEnforcer) GetGroupingPolicy() ([][]string, error) { ret := _m.Called() @@ -1617,6 +3382,33 @@ func (_m *IEnforcer) GetGroupingPolicy() ([][]string, error) { return r0, r1 } +// IEnforcer_GetGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroupingPolicy' +type IEnforcer_GetGroupingPolicy_Call struct { + *mock.Call +} + +// GetGroupingPolicy is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) GetGroupingPolicy() *IEnforcer_GetGroupingPolicy_Call { + return &IEnforcer_GetGroupingPolicy_Call{Call: _e.mock.On("GetGroupingPolicy")} +} + +func (_c *IEnforcer_GetGroupingPolicy_Call) Run(run func()) *IEnforcer_GetGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_GetGroupingPolicy_Call) Return(_a0 [][]string, _a1 error) *IEnforcer_GetGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetGroupingPolicy_Call) RunAndReturn(run func() ([][]string, error)) *IEnforcer_GetGroupingPolicy_Call { + _c.Call.Return(run) + return _c +} + // GetImplicitPermissionsForUser provides a mock function with given fields: user, domain func (_m *IEnforcer) GetImplicitPermissionsForUser(user string, domain ...string) ([][]string, error) { _va := make([]interface{}, len(domain)) @@ -1654,6 +3446,42 @@ func (_m *IEnforcer) GetImplicitPermissionsForUser(user string, domain ...string return r0, r1 } +// IEnforcer_GetImplicitPermissionsForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetImplicitPermissionsForUser' +type IEnforcer_GetImplicitPermissionsForUser_Call struct { + *mock.Call +} + +// GetImplicitPermissionsForUser is a helper method to define mock.On call +// - user string +// - domain ...string +func (_e *IEnforcer_Expecter) GetImplicitPermissionsForUser(user interface{}, domain ...interface{}) *IEnforcer_GetImplicitPermissionsForUser_Call { + return &IEnforcer_GetImplicitPermissionsForUser_Call{Call: _e.mock.On("GetImplicitPermissionsForUser", + append([]interface{}{user}, domain...)...)} +} + +func (_c *IEnforcer_GetImplicitPermissionsForUser_Call) Run(run func(user string, domain ...string)) *IEnforcer_GetImplicitPermissionsForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_GetImplicitPermissionsForUser_Call) Return(_a0 [][]string, _a1 error) *IEnforcer_GetImplicitPermissionsForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetImplicitPermissionsForUser_Call) RunAndReturn(run func(string, ...string) ([][]string, error)) *IEnforcer_GetImplicitPermissionsForUser_Call { + _c.Call.Return(run) + return _c +} + // GetImplicitRolesForUser provides a mock function with given fields: name, domain func (_m *IEnforcer) GetImplicitRolesForUser(name string, domain ...string) ([]string, error) { _va := make([]interface{}, len(domain)) @@ -1691,6 +3519,42 @@ func (_m *IEnforcer) GetImplicitRolesForUser(name string, domain ...string) ([]s return r0, r1 } +// IEnforcer_GetImplicitRolesForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetImplicitRolesForUser' +type IEnforcer_GetImplicitRolesForUser_Call struct { + *mock.Call +} + +// GetImplicitRolesForUser is a helper method to define mock.On call +// - name string +// - domain ...string +func (_e *IEnforcer_Expecter) GetImplicitRolesForUser(name interface{}, domain ...interface{}) *IEnforcer_GetImplicitRolesForUser_Call { + return &IEnforcer_GetImplicitRolesForUser_Call{Call: _e.mock.On("GetImplicitRolesForUser", + append([]interface{}{name}, domain...)...)} +} + +func (_c *IEnforcer_GetImplicitRolesForUser_Call) Run(run func(name string, domain ...string)) *IEnforcer_GetImplicitRolesForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_GetImplicitRolesForUser_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetImplicitRolesForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetImplicitRolesForUser_Call) RunAndReturn(run func(string, ...string) ([]string, error)) *IEnforcer_GetImplicitRolesForUser_Call { + _c.Call.Return(run) + return _c +} + // GetImplicitUsersForPermission provides a mock function with given fields: permission func (_m *IEnforcer) GetImplicitUsersForPermission(permission ...string) ([]string, error) { _va := make([]interface{}, len(permission)) @@ -1727,6 +3591,41 @@ func (_m *IEnforcer) GetImplicitUsersForPermission(permission ...string) ([]stri return r0, r1 } +// IEnforcer_GetImplicitUsersForPermission_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetImplicitUsersForPermission' +type IEnforcer_GetImplicitUsersForPermission_Call struct { + *mock.Call +} + +// GetImplicitUsersForPermission is a helper method to define mock.On call +// - permission ...string +func (_e *IEnforcer_Expecter) GetImplicitUsersForPermission(permission ...interface{}) *IEnforcer_GetImplicitUsersForPermission_Call { + return &IEnforcer_GetImplicitUsersForPermission_Call{Call: _e.mock.On("GetImplicitUsersForPermission", + append([]interface{}{}, permission...)...)} +} + +func (_c *IEnforcer_GetImplicitUsersForPermission_Call) Run(run func(permission ...string)) *IEnforcer_GetImplicitUsersForPermission_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_GetImplicitUsersForPermission_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetImplicitUsersForPermission_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetImplicitUsersForPermission_Call) RunAndReturn(run func(...string) ([]string, error)) *IEnforcer_GetImplicitUsersForPermission_Call { + _c.Call.Return(run) + return _c +} + // GetModel provides a mock function with given fields: func (_m *IEnforcer) GetModel() model.Model { ret := _m.Called() @@ -1747,6 +3646,33 @@ func (_m *IEnforcer) GetModel() model.Model { return r0 } +// IEnforcer_GetModel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetModel' +type IEnforcer_GetModel_Call struct { + *mock.Call +} + +// GetModel is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) GetModel() *IEnforcer_GetModel_Call { + return &IEnforcer_GetModel_Call{Call: _e.mock.On("GetModel")} +} + +func (_c *IEnforcer_GetModel_Call) Run(run func()) *IEnforcer_GetModel_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_GetModel_Call) Return(_a0 model.Model) *IEnforcer_GetModel_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_GetModel_Call) RunAndReturn(run func() model.Model) *IEnforcer_GetModel_Call { + _c.Call.Return(run) + return _c +} + // GetNamedGroupingPolicy provides a mock function with given fields: ptype func (_m *IEnforcer) GetNamedGroupingPolicy(ptype string) ([][]string, error) { ret := _m.Called(ptype) @@ -1777,6 +3703,34 @@ func (_m *IEnforcer) GetNamedGroupingPolicy(ptype string) ([][]string, error) { return r0, r1 } +// IEnforcer_GetNamedGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNamedGroupingPolicy' +type IEnforcer_GetNamedGroupingPolicy_Call struct { + *mock.Call +} + +// GetNamedGroupingPolicy is a helper method to define mock.On call +// - ptype string +func (_e *IEnforcer_Expecter) GetNamedGroupingPolicy(ptype interface{}) *IEnforcer_GetNamedGroupingPolicy_Call { + return &IEnforcer_GetNamedGroupingPolicy_Call{Call: _e.mock.On("GetNamedGroupingPolicy", ptype)} +} + +func (_c *IEnforcer_GetNamedGroupingPolicy_Call) Run(run func(ptype string)) *IEnforcer_GetNamedGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *IEnforcer_GetNamedGroupingPolicy_Call) Return(_a0 [][]string, _a1 error) *IEnforcer_GetNamedGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetNamedGroupingPolicy_Call) RunAndReturn(run func(string) ([][]string, error)) *IEnforcer_GetNamedGroupingPolicy_Call { + _c.Call.Return(run) + return _c +} + // GetNamedPolicy provides a mock function with given fields: ptype func (_m *IEnforcer) GetNamedPolicy(ptype string) ([][]string, error) { ret := _m.Called(ptype) @@ -1807,6 +3761,34 @@ func (_m *IEnforcer) GetNamedPolicy(ptype string) ([][]string, error) { return r0, r1 } +// IEnforcer_GetNamedPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNamedPolicy' +type IEnforcer_GetNamedPolicy_Call struct { + *mock.Call +} + +// GetNamedPolicy is a helper method to define mock.On call +// - ptype string +func (_e *IEnforcer_Expecter) GetNamedPolicy(ptype interface{}) *IEnforcer_GetNamedPolicy_Call { + return &IEnforcer_GetNamedPolicy_Call{Call: _e.mock.On("GetNamedPolicy", ptype)} +} + +func (_c *IEnforcer_GetNamedPolicy_Call) Run(run func(ptype string)) *IEnforcer_GetNamedPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *IEnforcer_GetNamedPolicy_Call) Return(_a0 [][]string, _a1 error) *IEnforcer_GetNamedPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetNamedPolicy_Call) RunAndReturn(run func(string) ([][]string, error)) *IEnforcer_GetNamedPolicy_Call { + _c.Call.Return(run) + return _c +} + // GetPermissionsForUser provides a mock function with given fields: user, domain func (_m *IEnforcer) GetPermissionsForUser(user string, domain ...string) ([][]string, error) { _va := make([]interface{}, len(domain)) @@ -1844,6 +3826,42 @@ func (_m *IEnforcer) GetPermissionsForUser(user string, domain ...string) ([][]s return r0, r1 } +// IEnforcer_GetPermissionsForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPermissionsForUser' +type IEnforcer_GetPermissionsForUser_Call struct { + *mock.Call +} + +// GetPermissionsForUser is a helper method to define mock.On call +// - user string +// - domain ...string +func (_e *IEnforcer_Expecter) GetPermissionsForUser(user interface{}, domain ...interface{}) *IEnforcer_GetPermissionsForUser_Call { + return &IEnforcer_GetPermissionsForUser_Call{Call: _e.mock.On("GetPermissionsForUser", + append([]interface{}{user}, domain...)...)} +} + +func (_c *IEnforcer_GetPermissionsForUser_Call) Run(run func(user string, domain ...string)) *IEnforcer_GetPermissionsForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_GetPermissionsForUser_Call) Return(_a0 [][]string, _a1 error) *IEnforcer_GetPermissionsForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetPermissionsForUser_Call) RunAndReturn(run func(string, ...string) ([][]string, error)) *IEnforcer_GetPermissionsForUser_Call { + _c.Call.Return(run) + return _c +} + // GetPermissionsForUserInDomain provides a mock function with given fields: user, domain func (_m *IEnforcer) GetPermissionsForUserInDomain(user string, domain string) [][]string { ret := _m.Called(user, domain) @@ -1864,6 +3882,35 @@ func (_m *IEnforcer) GetPermissionsForUserInDomain(user string, domain string) [ return r0 } +// IEnforcer_GetPermissionsForUserInDomain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPermissionsForUserInDomain' +type IEnforcer_GetPermissionsForUserInDomain_Call struct { + *mock.Call +} + +// GetPermissionsForUserInDomain is a helper method to define mock.On call +// - user string +// - domain string +func (_e *IEnforcer_Expecter) GetPermissionsForUserInDomain(user interface{}, domain interface{}) *IEnforcer_GetPermissionsForUserInDomain_Call { + return &IEnforcer_GetPermissionsForUserInDomain_Call{Call: _e.mock.On("GetPermissionsForUserInDomain", user, domain)} +} + +func (_c *IEnforcer_GetPermissionsForUserInDomain_Call) Run(run func(user string, domain string)) *IEnforcer_GetPermissionsForUserInDomain_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *IEnforcer_GetPermissionsForUserInDomain_Call) Return(_a0 [][]string) *IEnforcer_GetPermissionsForUserInDomain_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_GetPermissionsForUserInDomain_Call) RunAndReturn(run func(string, string) [][]string) *IEnforcer_GetPermissionsForUserInDomain_Call { + _c.Call.Return(run) + return _c +} + // GetPolicy provides a mock function with given fields: func (_m *IEnforcer) GetPolicy() ([][]string, error) { ret := _m.Called() @@ -1894,6 +3941,33 @@ func (_m *IEnforcer) GetPolicy() ([][]string, error) { return r0, r1 } +// IEnforcer_GetPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPolicy' +type IEnforcer_GetPolicy_Call struct { + *mock.Call +} + +// GetPolicy is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) GetPolicy() *IEnforcer_GetPolicy_Call { + return &IEnforcer_GetPolicy_Call{Call: _e.mock.On("GetPolicy")} +} + +func (_c *IEnforcer_GetPolicy_Call) Run(run func()) *IEnforcer_GetPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_GetPolicy_Call) Return(_a0 [][]string, _a1 error) *IEnforcer_GetPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetPolicy_Call) RunAndReturn(run func() ([][]string, error)) *IEnforcer_GetPolicy_Call { + _c.Call.Return(run) + return _c +} + // GetRoleManager provides a mock function with given fields: func (_m *IEnforcer) GetRoleManager() rbac.RoleManager { ret := _m.Called() @@ -1914,6 +3988,33 @@ func (_m *IEnforcer) GetRoleManager() rbac.RoleManager { return r0 } +// IEnforcer_GetRoleManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRoleManager' +type IEnforcer_GetRoleManager_Call struct { + *mock.Call +} + +// GetRoleManager is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) GetRoleManager() *IEnforcer_GetRoleManager_Call { + return &IEnforcer_GetRoleManager_Call{Call: _e.mock.On("GetRoleManager")} +} + +func (_c *IEnforcer_GetRoleManager_Call) Run(run func()) *IEnforcer_GetRoleManager_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_GetRoleManager_Call) Return(_a0 rbac.RoleManager) *IEnforcer_GetRoleManager_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_GetRoleManager_Call) RunAndReturn(run func() rbac.RoleManager) *IEnforcer_GetRoleManager_Call { + _c.Call.Return(run) + return _c +} + // GetRolesForUser provides a mock function with given fields: name, domain func (_m *IEnforcer) GetRolesForUser(name string, domain ...string) ([]string, error) { _va := make([]interface{}, len(domain)) @@ -1951,6 +4052,42 @@ func (_m *IEnforcer) GetRolesForUser(name string, domain ...string) ([]string, e return r0, r1 } +// IEnforcer_GetRolesForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRolesForUser' +type IEnforcer_GetRolesForUser_Call struct { + *mock.Call +} + +// GetRolesForUser is a helper method to define mock.On call +// - name string +// - domain ...string +func (_e *IEnforcer_Expecter) GetRolesForUser(name interface{}, domain ...interface{}) *IEnforcer_GetRolesForUser_Call { + return &IEnforcer_GetRolesForUser_Call{Call: _e.mock.On("GetRolesForUser", + append([]interface{}{name}, domain...)...)} +} + +func (_c *IEnforcer_GetRolesForUser_Call) Run(run func(name string, domain ...string)) *IEnforcer_GetRolesForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_GetRolesForUser_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetRolesForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetRolesForUser_Call) RunAndReturn(run func(string, ...string) ([]string, error)) *IEnforcer_GetRolesForUser_Call { + _c.Call.Return(run) + return _c +} + // GetRolesForUserInDomain provides a mock function with given fields: name, domain func (_m *IEnforcer) GetRolesForUserInDomain(name string, domain string) []string { ret := _m.Called(name, domain) @@ -1968,7 +4105,36 @@ func (_m *IEnforcer) GetRolesForUserInDomain(name string, domain string) []strin } } - return r0 + return r0 +} + +// IEnforcer_GetRolesForUserInDomain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRolesForUserInDomain' +type IEnforcer_GetRolesForUserInDomain_Call struct { + *mock.Call +} + +// GetRolesForUserInDomain is a helper method to define mock.On call +// - name string +// - domain string +func (_e *IEnforcer_Expecter) GetRolesForUserInDomain(name interface{}, domain interface{}) *IEnforcer_GetRolesForUserInDomain_Call { + return &IEnforcer_GetRolesForUserInDomain_Call{Call: _e.mock.On("GetRolesForUserInDomain", name, domain)} +} + +func (_c *IEnforcer_GetRolesForUserInDomain_Call) Run(run func(name string, domain string)) *IEnforcer_GetRolesForUserInDomain_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *IEnforcer_GetRolesForUserInDomain_Call) Return(_a0 []string) *IEnforcer_GetRolesForUserInDomain_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_GetRolesForUserInDomain_Call) RunAndReturn(run func(string, string) []string) *IEnforcer_GetRolesForUserInDomain_Call { + _c.Call.Return(run) + return _c } // GetUsersForRole provides a mock function with given fields: name, domain @@ -2008,6 +4174,42 @@ func (_m *IEnforcer) GetUsersForRole(name string, domain ...string) ([]string, e return r0, r1 } +// IEnforcer_GetUsersForRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUsersForRole' +type IEnforcer_GetUsersForRole_Call struct { + *mock.Call +} + +// GetUsersForRole is a helper method to define mock.On call +// - name string +// - domain ...string +func (_e *IEnforcer_Expecter) GetUsersForRole(name interface{}, domain ...interface{}) *IEnforcer_GetUsersForRole_Call { + return &IEnforcer_GetUsersForRole_Call{Call: _e.mock.On("GetUsersForRole", + append([]interface{}{name}, domain...)...)} +} + +func (_c *IEnforcer_GetUsersForRole_Call) Run(run func(name string, domain ...string)) *IEnforcer_GetUsersForRole_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_GetUsersForRole_Call) Return(_a0 []string, _a1 error) *IEnforcer_GetUsersForRole_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_GetUsersForRole_Call) RunAndReturn(run func(string, ...string) ([]string, error)) *IEnforcer_GetUsersForRole_Call { + _c.Call.Return(run) + return _c +} + // GetUsersForRoleInDomain provides a mock function with given fields: name, domain func (_m *IEnforcer) GetUsersForRoleInDomain(name string, domain string) []string { ret := _m.Called(name, domain) @@ -2028,6 +4230,35 @@ func (_m *IEnforcer) GetUsersForRoleInDomain(name string, domain string) []strin return r0 } +// IEnforcer_GetUsersForRoleInDomain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUsersForRoleInDomain' +type IEnforcer_GetUsersForRoleInDomain_Call struct { + *mock.Call +} + +// GetUsersForRoleInDomain is a helper method to define mock.On call +// - name string +// - domain string +func (_e *IEnforcer_Expecter) GetUsersForRoleInDomain(name interface{}, domain interface{}) *IEnforcer_GetUsersForRoleInDomain_Call { + return &IEnforcer_GetUsersForRoleInDomain_Call{Call: _e.mock.On("GetUsersForRoleInDomain", name, domain)} +} + +func (_c *IEnforcer_GetUsersForRoleInDomain_Call) Run(run func(name string, domain string)) *IEnforcer_GetUsersForRoleInDomain_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *IEnforcer_GetUsersForRoleInDomain_Call) Return(_a0 []string) *IEnforcer_GetUsersForRoleInDomain_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_GetUsersForRoleInDomain_Call) RunAndReturn(run func(string, string) []string) *IEnforcer_GetUsersForRoleInDomain_Call { + _c.Call.Return(run) + return _c +} + // HasGroupingPolicy provides a mock function with given fields: params func (_m *IEnforcer) HasGroupingPolicy(params ...interface{}) (bool, error) { var _ca []interface{} @@ -2058,6 +4289,41 @@ func (_m *IEnforcer) HasGroupingPolicy(params ...interface{}) (bool, error) { return r0, r1 } +// IEnforcer_HasGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasGroupingPolicy' +type IEnforcer_HasGroupingPolicy_Call struct { + *mock.Call +} + +// HasGroupingPolicy is a helper method to define mock.On call +// - params ...interface{} +func (_e *IEnforcer_Expecter) HasGroupingPolicy(params ...interface{}) *IEnforcer_HasGroupingPolicy_Call { + return &IEnforcer_HasGroupingPolicy_Call{Call: _e.mock.On("HasGroupingPolicy", + append([]interface{}{}, params...)...)} +} + +func (_c *IEnforcer_HasGroupingPolicy_Call) Run(run func(params ...interface{})) *IEnforcer_HasGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_HasGroupingPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_HasGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_HasGroupingPolicy_Call) RunAndReturn(run func(...interface{}) (bool, error)) *IEnforcer_HasGroupingPolicy_Call { + _c.Call.Return(run) + return _c +} + // HasNamedGroupingPolicy provides a mock function with given fields: ptype, params func (_m *IEnforcer) HasNamedGroupingPolicy(ptype string, params ...interface{}) (bool, error) { var _ca []interface{} @@ -2089,6 +4355,42 @@ func (_m *IEnforcer) HasNamedGroupingPolicy(ptype string, params ...interface{}) return r0, r1 } +// IEnforcer_HasNamedGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasNamedGroupingPolicy' +type IEnforcer_HasNamedGroupingPolicy_Call struct { + *mock.Call +} + +// HasNamedGroupingPolicy is a helper method to define mock.On call +// - ptype string +// - params ...interface{} +func (_e *IEnforcer_Expecter) HasNamedGroupingPolicy(ptype interface{}, params ...interface{}) *IEnforcer_HasNamedGroupingPolicy_Call { + return &IEnforcer_HasNamedGroupingPolicy_Call{Call: _e.mock.On("HasNamedGroupingPolicy", + append([]interface{}{ptype}, params...)...)} +} + +func (_c *IEnforcer_HasNamedGroupingPolicy_Call) Run(run func(ptype string, params ...interface{})) *IEnforcer_HasNamedGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_HasNamedGroupingPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_HasNamedGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_HasNamedGroupingPolicy_Call) RunAndReturn(run func(string, ...interface{}) (bool, error)) *IEnforcer_HasNamedGroupingPolicy_Call { + _c.Call.Return(run) + return _c +} + // HasNamedPolicy provides a mock function with given fields: ptype, params func (_m *IEnforcer) HasNamedPolicy(ptype string, params ...interface{}) (bool, error) { var _ca []interface{} @@ -2120,6 +4422,42 @@ func (_m *IEnforcer) HasNamedPolicy(ptype string, params ...interface{}) (bool, return r0, r1 } +// IEnforcer_HasNamedPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasNamedPolicy' +type IEnforcer_HasNamedPolicy_Call struct { + *mock.Call +} + +// HasNamedPolicy is a helper method to define mock.On call +// - ptype string +// - params ...interface{} +func (_e *IEnforcer_Expecter) HasNamedPolicy(ptype interface{}, params ...interface{}) *IEnforcer_HasNamedPolicy_Call { + return &IEnforcer_HasNamedPolicy_Call{Call: _e.mock.On("HasNamedPolicy", + append([]interface{}{ptype}, params...)...)} +} + +func (_c *IEnforcer_HasNamedPolicy_Call) Run(run func(ptype string, params ...interface{})) *IEnforcer_HasNamedPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_HasNamedPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_HasNamedPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_HasNamedPolicy_Call) RunAndReturn(run func(string, ...interface{}) (bool, error)) *IEnforcer_HasNamedPolicy_Call { + _c.Call.Return(run) + return _c +} + // HasPermissionForUser provides a mock function with given fields: user, permission func (_m *IEnforcer) HasPermissionForUser(user string, permission ...string) (bool, error) { _va := make([]interface{}, len(permission)) @@ -2155,6 +4493,42 @@ func (_m *IEnforcer) HasPermissionForUser(user string, permission ...string) (bo return r0, r1 } +// IEnforcer_HasPermissionForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasPermissionForUser' +type IEnforcer_HasPermissionForUser_Call struct { + *mock.Call +} + +// HasPermissionForUser is a helper method to define mock.On call +// - user string +// - permission ...string +func (_e *IEnforcer_Expecter) HasPermissionForUser(user interface{}, permission ...interface{}) *IEnforcer_HasPermissionForUser_Call { + return &IEnforcer_HasPermissionForUser_Call{Call: _e.mock.On("HasPermissionForUser", + append([]interface{}{user}, permission...)...)} +} + +func (_c *IEnforcer_HasPermissionForUser_Call) Run(run func(user string, permission ...string)) *IEnforcer_HasPermissionForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_HasPermissionForUser_Call) Return(_a0 bool, _a1 error) *IEnforcer_HasPermissionForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_HasPermissionForUser_Call) RunAndReturn(run func(string, ...string) (bool, error)) *IEnforcer_HasPermissionForUser_Call { + _c.Call.Return(run) + return _c +} + // HasPolicy provides a mock function with given fields: params func (_m *IEnforcer) HasPolicy(params ...interface{}) (bool, error) { var _ca []interface{} @@ -2185,6 +4559,41 @@ func (_m *IEnforcer) HasPolicy(params ...interface{}) (bool, error) { return r0, r1 } +// IEnforcer_HasPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasPolicy' +type IEnforcer_HasPolicy_Call struct { + *mock.Call +} + +// HasPolicy is a helper method to define mock.On call +// - params ...interface{} +func (_e *IEnforcer_Expecter) HasPolicy(params ...interface{}) *IEnforcer_HasPolicy_Call { + return &IEnforcer_HasPolicy_Call{Call: _e.mock.On("HasPolicy", + append([]interface{}{}, params...)...)} +} + +func (_c *IEnforcer_HasPolicy_Call) Run(run func(params ...interface{})) *IEnforcer_HasPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_HasPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_HasPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_HasPolicy_Call) RunAndReturn(run func(...interface{}) (bool, error)) *IEnforcer_HasPolicy_Call { + _c.Call.Return(run) + return _c +} + // HasRoleForUser provides a mock function with given fields: name, role, domain func (_m *IEnforcer) HasRoleForUser(name string, role string, domain ...string) (bool, error) { _va := make([]interface{}, len(domain)) @@ -2220,6 +4629,43 @@ func (_m *IEnforcer) HasRoleForUser(name string, role string, domain ...string) return r0, r1 } +// IEnforcer_HasRoleForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasRoleForUser' +type IEnforcer_HasRoleForUser_Call struct { + *mock.Call +} + +// HasRoleForUser is a helper method to define mock.On call +// - name string +// - role string +// - domain ...string +func (_e *IEnforcer_Expecter) HasRoleForUser(name interface{}, role interface{}, domain ...interface{}) *IEnforcer_HasRoleForUser_Call { + return &IEnforcer_HasRoleForUser_Call{Call: _e.mock.On("HasRoleForUser", + append([]interface{}{name, role}, domain...)...)} +} + +func (_c *IEnforcer_HasRoleForUser_Call) Run(run func(name string, role string, domain ...string)) *IEnforcer_HasRoleForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), args[1].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_HasRoleForUser_Call) Return(_a0 bool, _a1 error) *IEnforcer_HasRoleForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_HasRoleForUser_Call) RunAndReturn(run func(string, string, ...string) (bool, error)) *IEnforcer_HasRoleForUser_Call { + _c.Call.Return(run) + return _c +} + // InitWithAdapter provides a mock function with given fields: modelPath, adapter func (_m *IEnforcer) InitWithAdapter(modelPath string, adapter persist.Adapter) error { ret := _m.Called(modelPath, adapter) @@ -2238,6 +4684,35 @@ func (_m *IEnforcer) InitWithAdapter(modelPath string, adapter persist.Adapter) return r0 } +// IEnforcer_InitWithAdapter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InitWithAdapter' +type IEnforcer_InitWithAdapter_Call struct { + *mock.Call +} + +// InitWithAdapter is a helper method to define mock.On call +// - modelPath string +// - adapter persist.Adapter +func (_e *IEnforcer_Expecter) InitWithAdapter(modelPath interface{}, adapter interface{}) *IEnforcer_InitWithAdapter_Call { + return &IEnforcer_InitWithAdapter_Call{Call: _e.mock.On("InitWithAdapter", modelPath, adapter)} +} + +func (_c *IEnforcer_InitWithAdapter_Call) Run(run func(modelPath string, adapter persist.Adapter)) *IEnforcer_InitWithAdapter_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(persist.Adapter)) + }) + return _c +} + +func (_c *IEnforcer_InitWithAdapter_Call) Return(_a0 error) *IEnforcer_InitWithAdapter_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_InitWithAdapter_Call) RunAndReturn(run func(string, persist.Adapter) error) *IEnforcer_InitWithAdapter_Call { + _c.Call.Return(run) + return _c +} + // InitWithFile provides a mock function with given fields: modelPath, policyPath func (_m *IEnforcer) InitWithFile(modelPath string, policyPath string) error { ret := _m.Called(modelPath, policyPath) @@ -2256,6 +4731,35 @@ func (_m *IEnforcer) InitWithFile(modelPath string, policyPath string) error { return r0 } +// IEnforcer_InitWithFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InitWithFile' +type IEnforcer_InitWithFile_Call struct { + *mock.Call +} + +// InitWithFile is a helper method to define mock.On call +// - modelPath string +// - policyPath string +func (_e *IEnforcer_Expecter) InitWithFile(modelPath interface{}, policyPath interface{}) *IEnforcer_InitWithFile_Call { + return &IEnforcer_InitWithFile_Call{Call: _e.mock.On("InitWithFile", modelPath, policyPath)} +} + +func (_c *IEnforcer_InitWithFile_Call) Run(run func(modelPath string, policyPath string)) *IEnforcer_InitWithFile_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *IEnforcer_InitWithFile_Call) Return(_a0 error) *IEnforcer_InitWithFile_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_InitWithFile_Call) RunAndReturn(run func(string, string) error) *IEnforcer_InitWithFile_Call { + _c.Call.Return(run) + return _c +} + // InitWithModelAndAdapter provides a mock function with given fields: m, adapter func (_m *IEnforcer) InitWithModelAndAdapter(m model.Model, adapter persist.Adapter) error { ret := _m.Called(m, adapter) @@ -2274,6 +4778,35 @@ func (_m *IEnforcer) InitWithModelAndAdapter(m model.Model, adapter persist.Adap return r0 } +// IEnforcer_InitWithModelAndAdapter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InitWithModelAndAdapter' +type IEnforcer_InitWithModelAndAdapter_Call struct { + *mock.Call +} + +// InitWithModelAndAdapter is a helper method to define mock.On call +// - m model.Model +// - adapter persist.Adapter +func (_e *IEnforcer_Expecter) InitWithModelAndAdapter(m interface{}, adapter interface{}) *IEnforcer_InitWithModelAndAdapter_Call { + return &IEnforcer_InitWithModelAndAdapter_Call{Call: _e.mock.On("InitWithModelAndAdapter", m, adapter)} +} + +func (_c *IEnforcer_InitWithModelAndAdapter_Call) Run(run func(m model.Model, adapter persist.Adapter)) *IEnforcer_InitWithModelAndAdapter_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(model.Model), args[1].(persist.Adapter)) + }) + return _c +} + +func (_c *IEnforcer_InitWithModelAndAdapter_Call) Return(_a0 error) *IEnforcer_InitWithModelAndAdapter_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_InitWithModelAndAdapter_Call) RunAndReturn(run func(model.Model, persist.Adapter) error) *IEnforcer_InitWithModelAndAdapter_Call { + _c.Call.Return(run) + return _c +} + // IsFiltered provides a mock function with given fields: func (_m *IEnforcer) IsFiltered() bool { ret := _m.Called() @@ -2292,6 +4825,33 @@ func (_m *IEnforcer) IsFiltered() bool { return r0 } +// IEnforcer_IsFiltered_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsFiltered' +type IEnforcer_IsFiltered_Call struct { + *mock.Call +} + +// IsFiltered is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) IsFiltered() *IEnforcer_IsFiltered_Call { + return &IEnforcer_IsFiltered_Call{Call: _e.mock.On("IsFiltered")} +} + +func (_c *IEnforcer_IsFiltered_Call) Run(run func()) *IEnforcer_IsFiltered_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_IsFiltered_Call) Return(_a0 bool) *IEnforcer_IsFiltered_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_IsFiltered_Call) RunAndReturn(run func() bool) *IEnforcer_IsFiltered_Call { + _c.Call.Return(run) + return _c +} + // LoadFilteredPolicy provides a mock function with given fields: filter func (_m *IEnforcer) LoadFilteredPolicy(filter interface{}) error { ret := _m.Called(filter) @@ -2310,6 +4870,34 @@ func (_m *IEnforcer) LoadFilteredPolicy(filter interface{}) error { return r0 } +// IEnforcer_LoadFilteredPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadFilteredPolicy' +type IEnforcer_LoadFilteredPolicy_Call struct { + *mock.Call +} + +// LoadFilteredPolicy is a helper method to define mock.On call +// - filter interface{} +func (_e *IEnforcer_Expecter) LoadFilteredPolicy(filter interface{}) *IEnforcer_LoadFilteredPolicy_Call { + return &IEnforcer_LoadFilteredPolicy_Call{Call: _e.mock.On("LoadFilteredPolicy", filter)} +} + +func (_c *IEnforcer_LoadFilteredPolicy_Call) Run(run func(filter interface{})) *IEnforcer_LoadFilteredPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(interface{})) + }) + return _c +} + +func (_c *IEnforcer_LoadFilteredPolicy_Call) Return(_a0 error) *IEnforcer_LoadFilteredPolicy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_LoadFilteredPolicy_Call) RunAndReturn(run func(interface{}) error) *IEnforcer_LoadFilteredPolicy_Call { + _c.Call.Return(run) + return _c +} + // LoadIncrementalFilteredPolicy provides a mock function with given fields: filter func (_m *IEnforcer) LoadIncrementalFilteredPolicy(filter interface{}) error { ret := _m.Called(filter) @@ -2328,6 +4916,34 @@ func (_m *IEnforcer) LoadIncrementalFilteredPolicy(filter interface{}) error { return r0 } +// IEnforcer_LoadIncrementalFilteredPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadIncrementalFilteredPolicy' +type IEnforcer_LoadIncrementalFilteredPolicy_Call struct { + *mock.Call +} + +// LoadIncrementalFilteredPolicy is a helper method to define mock.On call +// - filter interface{} +func (_e *IEnforcer_Expecter) LoadIncrementalFilteredPolicy(filter interface{}) *IEnforcer_LoadIncrementalFilteredPolicy_Call { + return &IEnforcer_LoadIncrementalFilteredPolicy_Call{Call: _e.mock.On("LoadIncrementalFilteredPolicy", filter)} +} + +func (_c *IEnforcer_LoadIncrementalFilteredPolicy_Call) Run(run func(filter interface{})) *IEnforcer_LoadIncrementalFilteredPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(interface{})) + }) + return _c +} + +func (_c *IEnforcer_LoadIncrementalFilteredPolicy_Call) Return(_a0 error) *IEnforcer_LoadIncrementalFilteredPolicy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_LoadIncrementalFilteredPolicy_Call) RunAndReturn(run func(interface{}) error) *IEnforcer_LoadIncrementalFilteredPolicy_Call { + _c.Call.Return(run) + return _c +} + // LoadModel provides a mock function with given fields: func (_m *IEnforcer) LoadModel() error { ret := _m.Called() @@ -2346,6 +4962,33 @@ func (_m *IEnforcer) LoadModel() error { return r0 } +// IEnforcer_LoadModel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadModel' +type IEnforcer_LoadModel_Call struct { + *mock.Call +} + +// LoadModel is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) LoadModel() *IEnforcer_LoadModel_Call { + return &IEnforcer_LoadModel_Call{Call: _e.mock.On("LoadModel")} +} + +func (_c *IEnforcer_LoadModel_Call) Run(run func()) *IEnforcer_LoadModel_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_LoadModel_Call) Return(_a0 error) *IEnforcer_LoadModel_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_LoadModel_Call) RunAndReturn(run func() error) *IEnforcer_LoadModel_Call { + _c.Call.Return(run) + return _c +} + // LoadPolicy provides a mock function with given fields: func (_m *IEnforcer) LoadPolicy() error { ret := _m.Called() @@ -2364,6 +5007,33 @@ func (_m *IEnforcer) LoadPolicy() error { return r0 } +// IEnforcer_LoadPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadPolicy' +type IEnforcer_LoadPolicy_Call struct { + *mock.Call +} + +// LoadPolicy is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) LoadPolicy() *IEnforcer_LoadPolicy_Call { + return &IEnforcer_LoadPolicy_Call{Call: _e.mock.On("LoadPolicy")} +} + +func (_c *IEnforcer_LoadPolicy_Call) Run(run func()) *IEnforcer_LoadPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_LoadPolicy_Call) Return(_a0 error) *IEnforcer_LoadPolicy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_LoadPolicy_Call) RunAndReturn(run func() error) *IEnforcer_LoadPolicy_Call { + _c.Call.Return(run) + return _c +} + // RemoveFilteredGroupingPolicy provides a mock function with given fields: fieldIndex, fieldValues func (_m *IEnforcer) RemoveFilteredGroupingPolicy(fieldIndex int, fieldValues ...string) (bool, error) { _va := make([]interface{}, len(fieldValues)) @@ -2399,6 +5069,42 @@ func (_m *IEnforcer) RemoveFilteredGroupingPolicy(fieldIndex int, fieldValues .. return r0, r1 } +// IEnforcer_RemoveFilteredGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveFilteredGroupingPolicy' +type IEnforcer_RemoveFilteredGroupingPolicy_Call struct { + *mock.Call +} + +// RemoveFilteredGroupingPolicy is a helper method to define mock.On call +// - fieldIndex int +// - fieldValues ...string +func (_e *IEnforcer_Expecter) RemoveFilteredGroupingPolicy(fieldIndex interface{}, fieldValues ...interface{}) *IEnforcer_RemoveFilteredGroupingPolicy_Call { + return &IEnforcer_RemoveFilteredGroupingPolicy_Call{Call: _e.mock.On("RemoveFilteredGroupingPolicy", + append([]interface{}{fieldIndex}, fieldValues...)...)} +} + +func (_c *IEnforcer_RemoveFilteredGroupingPolicy_Call) Run(run func(fieldIndex int, fieldValues ...string)) *IEnforcer_RemoveFilteredGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(int), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_RemoveFilteredGroupingPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_RemoveFilteredGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_RemoveFilteredGroupingPolicy_Call) RunAndReturn(run func(int, ...string) (bool, error)) *IEnforcer_RemoveFilteredGroupingPolicy_Call { + _c.Call.Return(run) + return _c +} + // RemoveFilteredNamedGroupingPolicy provides a mock function with given fields: ptype, fieldIndex, fieldValues func (_m *IEnforcer) RemoveFilteredNamedGroupingPolicy(ptype string, fieldIndex int, fieldValues ...string) (bool, error) { _va := make([]interface{}, len(fieldValues)) @@ -2434,6 +5140,43 @@ func (_m *IEnforcer) RemoveFilteredNamedGroupingPolicy(ptype string, fieldIndex return r0, r1 } +// IEnforcer_RemoveFilteredNamedGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveFilteredNamedGroupingPolicy' +type IEnforcer_RemoveFilteredNamedGroupingPolicy_Call struct { + *mock.Call +} + +// RemoveFilteredNamedGroupingPolicy is a helper method to define mock.On call +// - ptype string +// - fieldIndex int +// - fieldValues ...string +func (_e *IEnforcer_Expecter) RemoveFilteredNamedGroupingPolicy(ptype interface{}, fieldIndex interface{}, fieldValues ...interface{}) *IEnforcer_RemoveFilteredNamedGroupingPolicy_Call { + return &IEnforcer_RemoveFilteredNamedGroupingPolicy_Call{Call: _e.mock.On("RemoveFilteredNamedGroupingPolicy", + append([]interface{}{ptype, fieldIndex}, fieldValues...)...)} +} + +func (_c *IEnforcer_RemoveFilteredNamedGroupingPolicy_Call) Run(run func(ptype string, fieldIndex int, fieldValues ...string)) *IEnforcer_RemoveFilteredNamedGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), args[1].(int), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_RemoveFilteredNamedGroupingPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_RemoveFilteredNamedGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_RemoveFilteredNamedGroupingPolicy_Call) RunAndReturn(run func(string, int, ...string) (bool, error)) *IEnforcer_RemoveFilteredNamedGroupingPolicy_Call { + _c.Call.Return(run) + return _c +} + // RemoveFilteredNamedPolicy provides a mock function with given fields: ptype, fieldIndex, fieldValues func (_m *IEnforcer) RemoveFilteredNamedPolicy(ptype string, fieldIndex int, fieldValues ...string) (bool, error) { _va := make([]interface{}, len(fieldValues)) @@ -2469,6 +5212,43 @@ func (_m *IEnforcer) RemoveFilteredNamedPolicy(ptype string, fieldIndex int, fie return r0, r1 } +// IEnforcer_RemoveFilteredNamedPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveFilteredNamedPolicy' +type IEnforcer_RemoveFilteredNamedPolicy_Call struct { + *mock.Call +} + +// RemoveFilteredNamedPolicy is a helper method to define mock.On call +// - ptype string +// - fieldIndex int +// - fieldValues ...string +func (_e *IEnforcer_Expecter) RemoveFilteredNamedPolicy(ptype interface{}, fieldIndex interface{}, fieldValues ...interface{}) *IEnforcer_RemoveFilteredNamedPolicy_Call { + return &IEnforcer_RemoveFilteredNamedPolicy_Call{Call: _e.mock.On("RemoveFilteredNamedPolicy", + append([]interface{}{ptype, fieldIndex}, fieldValues...)...)} +} + +func (_c *IEnforcer_RemoveFilteredNamedPolicy_Call) Run(run func(ptype string, fieldIndex int, fieldValues ...string)) *IEnforcer_RemoveFilteredNamedPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), args[1].(int), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_RemoveFilteredNamedPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_RemoveFilteredNamedPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_RemoveFilteredNamedPolicy_Call) RunAndReturn(run func(string, int, ...string) (bool, error)) *IEnforcer_RemoveFilteredNamedPolicy_Call { + _c.Call.Return(run) + return _c +} + // RemoveFilteredPolicy provides a mock function with given fields: fieldIndex, fieldValues func (_m *IEnforcer) RemoveFilteredPolicy(fieldIndex int, fieldValues ...string) (bool, error) { _va := make([]interface{}, len(fieldValues)) @@ -2504,6 +5284,42 @@ func (_m *IEnforcer) RemoveFilteredPolicy(fieldIndex int, fieldValues ...string) return r0, r1 } +// IEnforcer_RemoveFilteredPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveFilteredPolicy' +type IEnforcer_RemoveFilteredPolicy_Call struct { + *mock.Call +} + +// RemoveFilteredPolicy is a helper method to define mock.On call +// - fieldIndex int +// - fieldValues ...string +func (_e *IEnforcer_Expecter) RemoveFilteredPolicy(fieldIndex interface{}, fieldValues ...interface{}) *IEnforcer_RemoveFilteredPolicy_Call { + return &IEnforcer_RemoveFilteredPolicy_Call{Call: _e.mock.On("RemoveFilteredPolicy", + append([]interface{}{fieldIndex}, fieldValues...)...)} +} + +func (_c *IEnforcer_RemoveFilteredPolicy_Call) Run(run func(fieldIndex int, fieldValues ...string)) *IEnforcer_RemoveFilteredPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(int), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_RemoveFilteredPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_RemoveFilteredPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_RemoveFilteredPolicy_Call) RunAndReturn(run func(int, ...string) (bool, error)) *IEnforcer_RemoveFilteredPolicy_Call { + _c.Call.Return(run) + return _c +} + // RemoveGroupingPolicies provides a mock function with given fields: rules func (_m *IEnforcer) RemoveGroupingPolicies(rules [][]string) (bool, error) { ret := _m.Called(rules) @@ -2532,6 +5348,34 @@ func (_m *IEnforcer) RemoveGroupingPolicies(rules [][]string) (bool, error) { return r0, r1 } +// IEnforcer_RemoveGroupingPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveGroupingPolicies' +type IEnforcer_RemoveGroupingPolicies_Call struct { + *mock.Call +} + +// RemoveGroupingPolicies is a helper method to define mock.On call +// - rules [][]string +func (_e *IEnforcer_Expecter) RemoveGroupingPolicies(rules interface{}) *IEnforcer_RemoveGroupingPolicies_Call { + return &IEnforcer_RemoveGroupingPolicies_Call{Call: _e.mock.On("RemoveGroupingPolicies", rules)} +} + +func (_c *IEnforcer_RemoveGroupingPolicies_Call) Run(run func(rules [][]string)) *IEnforcer_RemoveGroupingPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_RemoveGroupingPolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_RemoveGroupingPolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_RemoveGroupingPolicies_Call) RunAndReturn(run func([][]string) (bool, error)) *IEnforcer_RemoveGroupingPolicies_Call { + _c.Call.Return(run) + return _c +} + // RemoveGroupingPolicy provides a mock function with given fields: params func (_m *IEnforcer) RemoveGroupingPolicy(params ...interface{}) (bool, error) { var _ca []interface{} @@ -2562,6 +5406,41 @@ func (_m *IEnforcer) RemoveGroupingPolicy(params ...interface{}) (bool, error) { return r0, r1 } +// IEnforcer_RemoveGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveGroupingPolicy' +type IEnforcer_RemoveGroupingPolicy_Call struct { + *mock.Call +} + +// RemoveGroupingPolicy is a helper method to define mock.On call +// - params ...interface{} +func (_e *IEnforcer_Expecter) RemoveGroupingPolicy(params ...interface{}) *IEnforcer_RemoveGroupingPolicy_Call { + return &IEnforcer_RemoveGroupingPolicy_Call{Call: _e.mock.On("RemoveGroupingPolicy", + append([]interface{}{}, params...)...)} +} + +func (_c *IEnforcer_RemoveGroupingPolicy_Call) Run(run func(params ...interface{})) *IEnforcer_RemoveGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_RemoveGroupingPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_RemoveGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_RemoveGroupingPolicy_Call) RunAndReturn(run func(...interface{}) (bool, error)) *IEnforcer_RemoveGroupingPolicy_Call { + _c.Call.Return(run) + return _c +} + // RemoveNamedGroupingPolicies provides a mock function with given fields: ptype, rules func (_m *IEnforcer) RemoveNamedGroupingPolicies(ptype string, rules [][]string) (bool, error) { ret := _m.Called(ptype, rules) @@ -2590,6 +5469,35 @@ func (_m *IEnforcer) RemoveNamedGroupingPolicies(ptype string, rules [][]string) return r0, r1 } +// IEnforcer_RemoveNamedGroupingPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveNamedGroupingPolicies' +type IEnforcer_RemoveNamedGroupingPolicies_Call struct { + *mock.Call +} + +// RemoveNamedGroupingPolicies is a helper method to define mock.On call +// - ptype string +// - rules [][]string +func (_e *IEnforcer_Expecter) RemoveNamedGroupingPolicies(ptype interface{}, rules interface{}) *IEnforcer_RemoveNamedGroupingPolicies_Call { + return &IEnforcer_RemoveNamedGroupingPolicies_Call{Call: _e.mock.On("RemoveNamedGroupingPolicies", ptype, rules)} +} + +func (_c *IEnforcer_RemoveNamedGroupingPolicies_Call) Run(run func(ptype string, rules [][]string)) *IEnforcer_RemoveNamedGroupingPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_RemoveNamedGroupingPolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_RemoveNamedGroupingPolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_RemoveNamedGroupingPolicies_Call) RunAndReturn(run func(string, [][]string) (bool, error)) *IEnforcer_RemoveNamedGroupingPolicies_Call { + _c.Call.Return(run) + return _c +} + // RemoveNamedGroupingPolicy provides a mock function with given fields: ptype, params func (_m *IEnforcer) RemoveNamedGroupingPolicy(ptype string, params ...interface{}) (bool, error) { var _ca []interface{} @@ -2618,7 +5526,43 @@ func (_m *IEnforcer) RemoveNamedGroupingPolicy(ptype string, params ...interface r1 = ret.Error(1) } - return r0, r1 + return r0, r1 +} + +// IEnforcer_RemoveNamedGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveNamedGroupingPolicy' +type IEnforcer_RemoveNamedGroupingPolicy_Call struct { + *mock.Call +} + +// RemoveNamedGroupingPolicy is a helper method to define mock.On call +// - ptype string +// - params ...interface{} +func (_e *IEnforcer_Expecter) RemoveNamedGroupingPolicy(ptype interface{}, params ...interface{}) *IEnforcer_RemoveNamedGroupingPolicy_Call { + return &IEnforcer_RemoveNamedGroupingPolicy_Call{Call: _e.mock.On("RemoveNamedGroupingPolicy", + append([]interface{}{ptype}, params...)...)} +} + +func (_c *IEnforcer_RemoveNamedGroupingPolicy_Call) Run(run func(ptype string, params ...interface{})) *IEnforcer_RemoveNamedGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_RemoveNamedGroupingPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_RemoveNamedGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_RemoveNamedGroupingPolicy_Call) RunAndReturn(run func(string, ...interface{}) (bool, error)) *IEnforcer_RemoveNamedGroupingPolicy_Call { + _c.Call.Return(run) + return _c } // RemoveNamedPolicies provides a mock function with given fields: ptype, rules @@ -2649,6 +5593,35 @@ func (_m *IEnforcer) RemoveNamedPolicies(ptype string, rules [][]string) (bool, return r0, r1 } +// IEnforcer_RemoveNamedPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveNamedPolicies' +type IEnforcer_RemoveNamedPolicies_Call struct { + *mock.Call +} + +// RemoveNamedPolicies is a helper method to define mock.On call +// - ptype string +// - rules [][]string +func (_e *IEnforcer_Expecter) RemoveNamedPolicies(ptype interface{}, rules interface{}) *IEnforcer_RemoveNamedPolicies_Call { + return &IEnforcer_RemoveNamedPolicies_Call{Call: _e.mock.On("RemoveNamedPolicies", ptype, rules)} +} + +func (_c *IEnforcer_RemoveNamedPolicies_Call) Run(run func(ptype string, rules [][]string)) *IEnforcer_RemoveNamedPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_RemoveNamedPolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_RemoveNamedPolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_RemoveNamedPolicies_Call) RunAndReturn(run func(string, [][]string) (bool, error)) *IEnforcer_RemoveNamedPolicies_Call { + _c.Call.Return(run) + return _c +} + // RemoveNamedPolicy provides a mock function with given fields: ptype, params func (_m *IEnforcer) RemoveNamedPolicy(ptype string, params ...interface{}) (bool, error) { var _ca []interface{} @@ -2680,6 +5653,42 @@ func (_m *IEnforcer) RemoveNamedPolicy(ptype string, params ...interface{}) (boo return r0, r1 } +// IEnforcer_RemoveNamedPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveNamedPolicy' +type IEnforcer_RemoveNamedPolicy_Call struct { + *mock.Call +} + +// RemoveNamedPolicy is a helper method to define mock.On call +// - ptype string +// - params ...interface{} +func (_e *IEnforcer_Expecter) RemoveNamedPolicy(ptype interface{}, params ...interface{}) *IEnforcer_RemoveNamedPolicy_Call { + return &IEnforcer_RemoveNamedPolicy_Call{Call: _e.mock.On("RemoveNamedPolicy", + append([]interface{}{ptype}, params...)...)} +} + +func (_c *IEnforcer_RemoveNamedPolicy_Call) Run(run func(ptype string, params ...interface{})) *IEnforcer_RemoveNamedPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_RemoveNamedPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_RemoveNamedPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_RemoveNamedPolicy_Call) RunAndReturn(run func(string, ...interface{}) (bool, error)) *IEnforcer_RemoveNamedPolicy_Call { + _c.Call.Return(run) + return _c +} + // RemovePolicies provides a mock function with given fields: rules func (_m *IEnforcer) RemovePolicies(rules [][]string) (bool, error) { ret := _m.Called(rules) @@ -2708,6 +5717,34 @@ func (_m *IEnforcer) RemovePolicies(rules [][]string) (bool, error) { return r0, r1 } +// IEnforcer_RemovePolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemovePolicies' +type IEnforcer_RemovePolicies_Call struct { + *mock.Call +} + +// RemovePolicies is a helper method to define mock.On call +// - rules [][]string +func (_e *IEnforcer_Expecter) RemovePolicies(rules interface{}) *IEnforcer_RemovePolicies_Call { + return &IEnforcer_RemovePolicies_Call{Call: _e.mock.On("RemovePolicies", rules)} +} + +func (_c *IEnforcer_RemovePolicies_Call) Run(run func(rules [][]string)) *IEnforcer_RemovePolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_RemovePolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_RemovePolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_RemovePolicies_Call) RunAndReturn(run func([][]string) (bool, error)) *IEnforcer_RemovePolicies_Call { + _c.Call.Return(run) + return _c +} + // RemovePolicy provides a mock function with given fields: params func (_m *IEnforcer) RemovePolicy(params ...interface{}) (bool, error) { var _ca []interface{} @@ -2738,6 +5775,41 @@ func (_m *IEnforcer) RemovePolicy(params ...interface{}) (bool, error) { return r0, r1 } +// IEnforcer_RemovePolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemovePolicy' +type IEnforcer_RemovePolicy_Call struct { + *mock.Call +} + +// RemovePolicy is a helper method to define mock.On call +// - params ...interface{} +func (_e *IEnforcer_Expecter) RemovePolicy(params ...interface{}) *IEnforcer_RemovePolicy_Call { + return &IEnforcer_RemovePolicy_Call{Call: _e.mock.On("RemovePolicy", + append([]interface{}{}, params...)...)} +} + +func (_c *IEnforcer_RemovePolicy_Call) Run(run func(params ...interface{})) *IEnforcer_RemovePolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]interface{}, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(interface{}) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_RemovePolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_RemovePolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_RemovePolicy_Call) RunAndReturn(run func(...interface{}) (bool, error)) *IEnforcer_RemovePolicy_Call { + _c.Call.Return(run) + return _c +} + // SavePolicy provides a mock function with given fields: func (_m *IEnforcer) SavePolicy() error { ret := _m.Called() @@ -2756,6 +5828,33 @@ func (_m *IEnforcer) SavePolicy() error { return r0 } +// IEnforcer_SavePolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SavePolicy' +type IEnforcer_SavePolicy_Call struct { + *mock.Call +} + +// SavePolicy is a helper method to define mock.On call +func (_e *IEnforcer_Expecter) SavePolicy() *IEnforcer_SavePolicy_Call { + return &IEnforcer_SavePolicy_Call{Call: _e.mock.On("SavePolicy")} +} + +func (_c *IEnforcer_SavePolicy_Call) Run(run func()) *IEnforcer_SavePolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *IEnforcer_SavePolicy_Call) Return(_a0 error) *IEnforcer_SavePolicy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_SavePolicy_Call) RunAndReturn(run func() error) *IEnforcer_SavePolicy_Call { + _c.Call.Return(run) + return _c +} + // SelfAddPolicies provides a mock function with given fields: sec, ptype, rules func (_m *IEnforcer) SelfAddPolicies(sec string, ptype string, rules [][]string) (bool, error) { ret := _m.Called(sec, ptype, rules) @@ -2784,6 +5883,36 @@ func (_m *IEnforcer) SelfAddPolicies(sec string, ptype string, rules [][]string) return r0, r1 } +// IEnforcer_SelfAddPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SelfAddPolicies' +type IEnforcer_SelfAddPolicies_Call struct { + *mock.Call +} + +// SelfAddPolicies is a helper method to define mock.On call +// - sec string +// - ptype string +// - rules [][]string +func (_e *IEnforcer_Expecter) SelfAddPolicies(sec interface{}, ptype interface{}, rules interface{}) *IEnforcer_SelfAddPolicies_Call { + return &IEnforcer_SelfAddPolicies_Call{Call: _e.mock.On("SelfAddPolicies", sec, ptype, rules)} +} + +func (_c *IEnforcer_SelfAddPolicies_Call) Run(run func(sec string, ptype string, rules [][]string)) *IEnforcer_SelfAddPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_SelfAddPolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_SelfAddPolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_SelfAddPolicies_Call) RunAndReturn(run func(string, string, [][]string) (bool, error)) *IEnforcer_SelfAddPolicies_Call { + _c.Call.Return(run) + return _c +} + // SelfAddPoliciesEx provides a mock function with given fields: sec, ptype, rules func (_m *IEnforcer) SelfAddPoliciesEx(sec string, ptype string, rules [][]string) (bool, error) { ret := _m.Called(sec, ptype, rules) @@ -2812,6 +5941,36 @@ func (_m *IEnforcer) SelfAddPoliciesEx(sec string, ptype string, rules [][]strin return r0, r1 } +// IEnforcer_SelfAddPoliciesEx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SelfAddPoliciesEx' +type IEnforcer_SelfAddPoliciesEx_Call struct { + *mock.Call +} + +// SelfAddPoliciesEx is a helper method to define mock.On call +// - sec string +// - ptype string +// - rules [][]string +func (_e *IEnforcer_Expecter) SelfAddPoliciesEx(sec interface{}, ptype interface{}, rules interface{}) *IEnforcer_SelfAddPoliciesEx_Call { + return &IEnforcer_SelfAddPoliciesEx_Call{Call: _e.mock.On("SelfAddPoliciesEx", sec, ptype, rules)} +} + +func (_c *IEnforcer_SelfAddPoliciesEx_Call) Run(run func(sec string, ptype string, rules [][]string)) *IEnforcer_SelfAddPoliciesEx_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_SelfAddPoliciesEx_Call) Return(_a0 bool, _a1 error) *IEnforcer_SelfAddPoliciesEx_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_SelfAddPoliciesEx_Call) RunAndReturn(run func(string, string, [][]string) (bool, error)) *IEnforcer_SelfAddPoliciesEx_Call { + _c.Call.Return(run) + return _c +} + // SelfAddPolicy provides a mock function with given fields: sec, ptype, rule func (_m *IEnforcer) SelfAddPolicy(sec string, ptype string, rule []string) (bool, error) { ret := _m.Called(sec, ptype, rule) @@ -2840,6 +5999,36 @@ func (_m *IEnforcer) SelfAddPolicy(sec string, ptype string, rule []string) (boo return r0, r1 } +// IEnforcer_SelfAddPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SelfAddPolicy' +type IEnforcer_SelfAddPolicy_Call struct { + *mock.Call +} + +// SelfAddPolicy is a helper method to define mock.On call +// - sec string +// - ptype string +// - rule []string +func (_e *IEnforcer_Expecter) SelfAddPolicy(sec interface{}, ptype interface{}, rule interface{}) *IEnforcer_SelfAddPolicy_Call { + return &IEnforcer_SelfAddPolicy_Call{Call: _e.mock.On("SelfAddPolicy", sec, ptype, rule)} +} + +func (_c *IEnforcer_SelfAddPolicy_Call) Run(run func(sec string, ptype string, rule []string)) *IEnforcer_SelfAddPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].([]string)) + }) + return _c +} + +func (_c *IEnforcer_SelfAddPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_SelfAddPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_SelfAddPolicy_Call) RunAndReturn(run func(string, string, []string) (bool, error)) *IEnforcer_SelfAddPolicy_Call { + _c.Call.Return(run) + return _c +} + // SelfRemoveFilteredPolicy provides a mock function with given fields: sec, ptype, fieldIndex, fieldValues func (_m *IEnforcer) SelfRemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) (bool, error) { _va := make([]interface{}, len(fieldValues)) @@ -2875,6 +6064,44 @@ func (_m *IEnforcer) SelfRemoveFilteredPolicy(sec string, ptype string, fieldInd return r0, r1 } +// IEnforcer_SelfRemoveFilteredPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SelfRemoveFilteredPolicy' +type IEnforcer_SelfRemoveFilteredPolicy_Call struct { + *mock.Call +} + +// SelfRemoveFilteredPolicy is a helper method to define mock.On call +// - sec string +// - ptype string +// - fieldIndex int +// - fieldValues ...string +func (_e *IEnforcer_Expecter) SelfRemoveFilteredPolicy(sec interface{}, ptype interface{}, fieldIndex interface{}, fieldValues ...interface{}) *IEnforcer_SelfRemoveFilteredPolicy_Call { + return &IEnforcer_SelfRemoveFilteredPolicy_Call{Call: _e.mock.On("SelfRemoveFilteredPolicy", + append([]interface{}{sec, ptype, fieldIndex}, fieldValues...)...)} +} + +func (_c *IEnforcer_SelfRemoveFilteredPolicy_Call) Run(run func(sec string, ptype string, fieldIndex int, fieldValues ...string)) *IEnforcer_SelfRemoveFilteredPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-3) + for i, a := range args[3:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), args[1].(string), args[2].(int), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_SelfRemoveFilteredPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_SelfRemoveFilteredPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_SelfRemoveFilteredPolicy_Call) RunAndReturn(run func(string, string, int, ...string) (bool, error)) *IEnforcer_SelfRemoveFilteredPolicy_Call { + _c.Call.Return(run) + return _c +} + // SelfRemovePolicies provides a mock function with given fields: sec, ptype, rules func (_m *IEnforcer) SelfRemovePolicies(sec string, ptype string, rules [][]string) (bool, error) { ret := _m.Called(sec, ptype, rules) @@ -2903,6 +6130,36 @@ func (_m *IEnforcer) SelfRemovePolicies(sec string, ptype string, rules [][]stri return r0, r1 } +// IEnforcer_SelfRemovePolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SelfRemovePolicies' +type IEnforcer_SelfRemovePolicies_Call struct { + *mock.Call +} + +// SelfRemovePolicies is a helper method to define mock.On call +// - sec string +// - ptype string +// - rules [][]string +func (_e *IEnforcer_Expecter) SelfRemovePolicies(sec interface{}, ptype interface{}, rules interface{}) *IEnforcer_SelfRemovePolicies_Call { + return &IEnforcer_SelfRemovePolicies_Call{Call: _e.mock.On("SelfRemovePolicies", sec, ptype, rules)} +} + +func (_c *IEnforcer_SelfRemovePolicies_Call) Run(run func(sec string, ptype string, rules [][]string)) *IEnforcer_SelfRemovePolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_SelfRemovePolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_SelfRemovePolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_SelfRemovePolicies_Call) RunAndReturn(run func(string, string, [][]string) (bool, error)) *IEnforcer_SelfRemovePolicies_Call { + _c.Call.Return(run) + return _c +} + // SelfRemovePolicy provides a mock function with given fields: sec, ptype, rule func (_m *IEnforcer) SelfRemovePolicy(sec string, ptype string, rule []string) (bool, error) { ret := _m.Called(sec, ptype, rule) @@ -2931,6 +6188,36 @@ func (_m *IEnforcer) SelfRemovePolicy(sec string, ptype string, rule []string) ( return r0, r1 } +// IEnforcer_SelfRemovePolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SelfRemovePolicy' +type IEnforcer_SelfRemovePolicy_Call struct { + *mock.Call +} + +// SelfRemovePolicy is a helper method to define mock.On call +// - sec string +// - ptype string +// - rule []string +func (_e *IEnforcer_Expecter) SelfRemovePolicy(sec interface{}, ptype interface{}, rule interface{}) *IEnforcer_SelfRemovePolicy_Call { + return &IEnforcer_SelfRemovePolicy_Call{Call: _e.mock.On("SelfRemovePolicy", sec, ptype, rule)} +} + +func (_c *IEnforcer_SelfRemovePolicy_Call) Run(run func(sec string, ptype string, rule []string)) *IEnforcer_SelfRemovePolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].([]string)) + }) + return _c +} + +func (_c *IEnforcer_SelfRemovePolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_SelfRemovePolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_SelfRemovePolicy_Call) RunAndReturn(run func(string, string, []string) (bool, error)) *IEnforcer_SelfRemovePolicy_Call { + _c.Call.Return(run) + return _c +} + // SelfUpdatePolicies provides a mock function with given fields: sec, ptype, oldRules, newRules func (_m *IEnforcer) SelfUpdatePolicies(sec string, ptype string, oldRules [][]string, newRules [][]string) (bool, error) { ret := _m.Called(sec, ptype, oldRules, newRules) @@ -2959,6 +6246,37 @@ func (_m *IEnforcer) SelfUpdatePolicies(sec string, ptype string, oldRules [][]s return r0, r1 } +// IEnforcer_SelfUpdatePolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SelfUpdatePolicies' +type IEnforcer_SelfUpdatePolicies_Call struct { + *mock.Call +} + +// SelfUpdatePolicies is a helper method to define mock.On call +// - sec string +// - ptype string +// - oldRules [][]string +// - newRules [][]string +func (_e *IEnforcer_Expecter) SelfUpdatePolicies(sec interface{}, ptype interface{}, oldRules interface{}, newRules interface{}) *IEnforcer_SelfUpdatePolicies_Call { + return &IEnforcer_SelfUpdatePolicies_Call{Call: _e.mock.On("SelfUpdatePolicies", sec, ptype, oldRules, newRules)} +} + +func (_c *IEnforcer_SelfUpdatePolicies_Call) Run(run func(sec string, ptype string, oldRules [][]string, newRules [][]string)) *IEnforcer_SelfUpdatePolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].([][]string), args[3].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_SelfUpdatePolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_SelfUpdatePolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_SelfUpdatePolicies_Call) RunAndReturn(run func(string, string, [][]string, [][]string) (bool, error)) *IEnforcer_SelfUpdatePolicies_Call { + _c.Call.Return(run) + return _c +} + // SelfUpdatePolicy provides a mock function with given fields: sec, ptype, oldRule, newRule func (_m *IEnforcer) SelfUpdatePolicy(sec string, ptype string, oldRule []string, newRule []string) (bool, error) { ret := _m.Called(sec, ptype, oldRule, newRule) @@ -2987,26 +6305,169 @@ func (_m *IEnforcer) SelfUpdatePolicy(sec string, ptype string, oldRule []string return r0, r1 } +// IEnforcer_SelfUpdatePolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SelfUpdatePolicy' +type IEnforcer_SelfUpdatePolicy_Call struct { + *mock.Call +} + +// SelfUpdatePolicy is a helper method to define mock.On call +// - sec string +// - ptype string +// - oldRule []string +// - newRule []string +func (_e *IEnforcer_Expecter) SelfUpdatePolicy(sec interface{}, ptype interface{}, oldRule interface{}, newRule interface{}) *IEnforcer_SelfUpdatePolicy_Call { + return &IEnforcer_SelfUpdatePolicy_Call{Call: _e.mock.On("SelfUpdatePolicy", sec, ptype, oldRule, newRule)} +} + +func (_c *IEnforcer_SelfUpdatePolicy_Call) Run(run func(sec string, ptype string, oldRule []string, newRule []string)) *IEnforcer_SelfUpdatePolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].([]string), args[3].([]string)) + }) + return _c +} + +func (_c *IEnforcer_SelfUpdatePolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_SelfUpdatePolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_SelfUpdatePolicy_Call) RunAndReturn(run func(string, string, []string, []string) (bool, error)) *IEnforcer_SelfUpdatePolicy_Call { + _c.Call.Return(run) + return _c +} + // SetAdapter provides a mock function with given fields: adapter func (_m *IEnforcer) SetAdapter(adapter persist.Adapter) { _m.Called(adapter) } +// IEnforcer_SetAdapter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetAdapter' +type IEnforcer_SetAdapter_Call struct { + *mock.Call +} + +// SetAdapter is a helper method to define mock.On call +// - adapter persist.Adapter +func (_e *IEnforcer_Expecter) SetAdapter(adapter interface{}) *IEnforcer_SetAdapter_Call { + return &IEnforcer_SetAdapter_Call{Call: _e.mock.On("SetAdapter", adapter)} +} + +func (_c *IEnforcer_SetAdapter_Call) Run(run func(adapter persist.Adapter)) *IEnforcer_SetAdapter_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(persist.Adapter)) + }) + return _c +} + +func (_c *IEnforcer_SetAdapter_Call) Return() *IEnforcer_SetAdapter_Call { + _c.Call.Return() + return _c +} + +func (_c *IEnforcer_SetAdapter_Call) RunAndReturn(run func(persist.Adapter)) *IEnforcer_SetAdapter_Call { + _c.Call.Return(run) + return _c +} + // SetEffector provides a mock function with given fields: eft func (_m *IEnforcer) SetEffector(eft effector.Effector) { _m.Called(eft) } +// IEnforcer_SetEffector_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetEffector' +type IEnforcer_SetEffector_Call struct { + *mock.Call +} + +// SetEffector is a helper method to define mock.On call +// - eft effector.Effector +func (_e *IEnforcer_Expecter) SetEffector(eft interface{}) *IEnforcer_SetEffector_Call { + return &IEnforcer_SetEffector_Call{Call: _e.mock.On("SetEffector", eft)} +} + +func (_c *IEnforcer_SetEffector_Call) Run(run func(eft effector.Effector)) *IEnforcer_SetEffector_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(effector.Effector)) + }) + return _c +} + +func (_c *IEnforcer_SetEffector_Call) Return() *IEnforcer_SetEffector_Call { + _c.Call.Return() + return _c +} + +func (_c *IEnforcer_SetEffector_Call) RunAndReturn(run func(effector.Effector)) *IEnforcer_SetEffector_Call { + _c.Call.Return(run) + return _c +} + // SetModel provides a mock function with given fields: m func (_m *IEnforcer) SetModel(m model.Model) { _m.Called(m) } +// IEnforcer_SetModel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetModel' +type IEnforcer_SetModel_Call struct { + *mock.Call +} + +// SetModel is a helper method to define mock.On call +// - m model.Model +func (_e *IEnforcer_Expecter) SetModel(m interface{}) *IEnforcer_SetModel_Call { + return &IEnforcer_SetModel_Call{Call: _e.mock.On("SetModel", m)} +} + +func (_c *IEnforcer_SetModel_Call) Run(run func(m model.Model)) *IEnforcer_SetModel_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(model.Model)) + }) + return _c +} + +func (_c *IEnforcer_SetModel_Call) Return() *IEnforcer_SetModel_Call { + _c.Call.Return() + return _c +} + +func (_c *IEnforcer_SetModel_Call) RunAndReturn(run func(model.Model)) *IEnforcer_SetModel_Call { + _c.Call.Return(run) + return _c +} + // SetRoleManager provides a mock function with given fields: rm func (_m *IEnforcer) SetRoleManager(rm rbac.RoleManager) { _m.Called(rm) } +// IEnforcer_SetRoleManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetRoleManager' +type IEnforcer_SetRoleManager_Call struct { + *mock.Call +} + +// SetRoleManager is a helper method to define mock.On call +// - rm rbac.RoleManager +func (_e *IEnforcer_Expecter) SetRoleManager(rm interface{}) *IEnforcer_SetRoleManager_Call { + return &IEnforcer_SetRoleManager_Call{Call: _e.mock.On("SetRoleManager", rm)} +} + +func (_c *IEnforcer_SetRoleManager_Call) Run(run func(rm rbac.RoleManager)) *IEnforcer_SetRoleManager_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(rbac.RoleManager)) + }) + return _c +} + +func (_c *IEnforcer_SetRoleManager_Call) Return() *IEnforcer_SetRoleManager_Call { + _c.Call.Return() + return _c +} + +func (_c *IEnforcer_SetRoleManager_Call) RunAndReturn(run func(rbac.RoleManager)) *IEnforcer_SetRoleManager_Call { + _c.Call.Return(run) + return _c +} + // SetWatcher provides a mock function with given fields: watcher func (_m *IEnforcer) SetWatcher(watcher persist.Watcher) error { ret := _m.Called(watcher) @@ -3025,6 +6486,34 @@ func (_m *IEnforcer) SetWatcher(watcher persist.Watcher) error { return r0 } +// IEnforcer_SetWatcher_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetWatcher' +type IEnforcer_SetWatcher_Call struct { + *mock.Call +} + +// SetWatcher is a helper method to define mock.On call +// - watcher persist.Watcher +func (_e *IEnforcer_Expecter) SetWatcher(watcher interface{}) *IEnforcer_SetWatcher_Call { + return &IEnforcer_SetWatcher_Call{Call: _e.mock.On("SetWatcher", watcher)} +} + +func (_c *IEnforcer_SetWatcher_Call) Run(run func(watcher persist.Watcher)) *IEnforcer_SetWatcher_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(persist.Watcher)) + }) + return _c +} + +func (_c *IEnforcer_SetWatcher_Call) Return(_a0 error) *IEnforcer_SetWatcher_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *IEnforcer_SetWatcher_Call) RunAndReturn(run func(persist.Watcher) error) *IEnforcer_SetWatcher_Call { + _c.Call.Return(run) + return _c +} + // UpdateFilteredPolicies provides a mock function with given fields: newPolicies, fieldIndex, fieldValues func (_m *IEnforcer) UpdateFilteredPolicies(newPolicies [][]string, fieldIndex int, fieldValues ...string) (bool, error) { _va := make([]interface{}, len(fieldValues)) @@ -3060,6 +6549,43 @@ func (_m *IEnforcer) UpdateFilteredPolicies(newPolicies [][]string, fieldIndex i return r0, r1 } +// IEnforcer_UpdateFilteredPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateFilteredPolicies' +type IEnforcer_UpdateFilteredPolicies_Call struct { + *mock.Call +} + +// UpdateFilteredPolicies is a helper method to define mock.On call +// - newPolicies [][]string +// - fieldIndex int +// - fieldValues ...string +func (_e *IEnforcer_Expecter) UpdateFilteredPolicies(newPolicies interface{}, fieldIndex interface{}, fieldValues ...interface{}) *IEnforcer_UpdateFilteredPolicies_Call { + return &IEnforcer_UpdateFilteredPolicies_Call{Call: _e.mock.On("UpdateFilteredPolicies", + append([]interface{}{newPolicies, fieldIndex}, fieldValues...)...)} +} + +func (_c *IEnforcer_UpdateFilteredPolicies_Call) Run(run func(newPolicies [][]string, fieldIndex int, fieldValues ...string)) *IEnforcer_UpdateFilteredPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].([][]string), args[1].(int), variadicArgs...) + }) + return _c +} + +func (_c *IEnforcer_UpdateFilteredPolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_UpdateFilteredPolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_UpdateFilteredPolicies_Call) RunAndReturn(run func([][]string, int, ...string) (bool, error)) *IEnforcer_UpdateFilteredPolicies_Call { + _c.Call.Return(run) + return _c +} + // UpdateGroupingPolicies provides a mock function with given fields: oldRules, newRules func (_m *IEnforcer) UpdateGroupingPolicies(oldRules [][]string, newRules [][]string) (bool, error) { ret := _m.Called(oldRules, newRules) @@ -3088,6 +6614,35 @@ func (_m *IEnforcer) UpdateGroupingPolicies(oldRules [][]string, newRules [][]st return r0, r1 } +// IEnforcer_UpdateGroupingPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGroupingPolicies' +type IEnforcer_UpdateGroupingPolicies_Call struct { + *mock.Call +} + +// UpdateGroupingPolicies is a helper method to define mock.On call +// - oldRules [][]string +// - newRules [][]string +func (_e *IEnforcer_Expecter) UpdateGroupingPolicies(oldRules interface{}, newRules interface{}) *IEnforcer_UpdateGroupingPolicies_Call { + return &IEnforcer_UpdateGroupingPolicies_Call{Call: _e.mock.On("UpdateGroupingPolicies", oldRules, newRules)} +} + +func (_c *IEnforcer_UpdateGroupingPolicies_Call) Run(run func(oldRules [][]string, newRules [][]string)) *IEnforcer_UpdateGroupingPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([][]string), args[1].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_UpdateGroupingPolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_UpdateGroupingPolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_UpdateGroupingPolicies_Call) RunAndReturn(run func([][]string, [][]string) (bool, error)) *IEnforcer_UpdateGroupingPolicies_Call { + _c.Call.Return(run) + return _c +} + // UpdateGroupingPolicy provides a mock function with given fields: oldRule, newRule func (_m *IEnforcer) UpdateGroupingPolicy(oldRule []string, newRule []string) (bool, error) { ret := _m.Called(oldRule, newRule) @@ -3116,6 +6671,35 @@ func (_m *IEnforcer) UpdateGroupingPolicy(oldRule []string, newRule []string) (b return r0, r1 } +// IEnforcer_UpdateGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGroupingPolicy' +type IEnforcer_UpdateGroupingPolicy_Call struct { + *mock.Call +} + +// UpdateGroupingPolicy is a helper method to define mock.On call +// - oldRule []string +// - newRule []string +func (_e *IEnforcer_Expecter) UpdateGroupingPolicy(oldRule interface{}, newRule interface{}) *IEnforcer_UpdateGroupingPolicy_Call { + return &IEnforcer_UpdateGroupingPolicy_Call{Call: _e.mock.On("UpdateGroupingPolicy", oldRule, newRule)} +} + +func (_c *IEnforcer_UpdateGroupingPolicy_Call) Run(run func(oldRule []string, newRule []string)) *IEnforcer_UpdateGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]string), args[1].([]string)) + }) + return _c +} + +func (_c *IEnforcer_UpdateGroupingPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_UpdateGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_UpdateGroupingPolicy_Call) RunAndReturn(run func([]string, []string) (bool, error)) *IEnforcer_UpdateGroupingPolicy_Call { + _c.Call.Return(run) + return _c +} + // UpdateNamedGroupingPolicies provides a mock function with given fields: ptype, oldRules, newRules func (_m *IEnforcer) UpdateNamedGroupingPolicies(ptype string, oldRules [][]string, newRules [][]string) (bool, error) { ret := _m.Called(ptype, oldRules, newRules) @@ -3144,6 +6728,36 @@ func (_m *IEnforcer) UpdateNamedGroupingPolicies(ptype string, oldRules [][]stri return r0, r1 } +// IEnforcer_UpdateNamedGroupingPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateNamedGroupingPolicies' +type IEnforcer_UpdateNamedGroupingPolicies_Call struct { + *mock.Call +} + +// UpdateNamedGroupingPolicies is a helper method to define mock.On call +// - ptype string +// - oldRules [][]string +// - newRules [][]string +func (_e *IEnforcer_Expecter) UpdateNamedGroupingPolicies(ptype interface{}, oldRules interface{}, newRules interface{}) *IEnforcer_UpdateNamedGroupingPolicies_Call { + return &IEnforcer_UpdateNamedGroupingPolicies_Call{Call: _e.mock.On("UpdateNamedGroupingPolicies", ptype, oldRules, newRules)} +} + +func (_c *IEnforcer_UpdateNamedGroupingPolicies_Call) Run(run func(ptype string, oldRules [][]string, newRules [][]string)) *IEnforcer_UpdateNamedGroupingPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([][]string), args[2].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_UpdateNamedGroupingPolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_UpdateNamedGroupingPolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_UpdateNamedGroupingPolicies_Call) RunAndReturn(run func(string, [][]string, [][]string) (bool, error)) *IEnforcer_UpdateNamedGroupingPolicies_Call { + _c.Call.Return(run) + return _c +} + // UpdateNamedGroupingPolicy provides a mock function with given fields: ptype, oldRule, newRule func (_m *IEnforcer) UpdateNamedGroupingPolicy(ptype string, oldRule []string, newRule []string) (bool, error) { ret := _m.Called(ptype, oldRule, newRule) @@ -3172,6 +6786,36 @@ func (_m *IEnforcer) UpdateNamedGroupingPolicy(ptype string, oldRule []string, n return r0, r1 } +// IEnforcer_UpdateNamedGroupingPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateNamedGroupingPolicy' +type IEnforcer_UpdateNamedGroupingPolicy_Call struct { + *mock.Call +} + +// UpdateNamedGroupingPolicy is a helper method to define mock.On call +// - ptype string +// - oldRule []string +// - newRule []string +func (_e *IEnforcer_Expecter) UpdateNamedGroupingPolicy(ptype interface{}, oldRule interface{}, newRule interface{}) *IEnforcer_UpdateNamedGroupingPolicy_Call { + return &IEnforcer_UpdateNamedGroupingPolicy_Call{Call: _e.mock.On("UpdateNamedGroupingPolicy", ptype, oldRule, newRule)} +} + +func (_c *IEnforcer_UpdateNamedGroupingPolicy_Call) Run(run func(ptype string, oldRule []string, newRule []string)) *IEnforcer_UpdateNamedGroupingPolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([]string), args[2].([]string)) + }) + return _c +} + +func (_c *IEnforcer_UpdateNamedGroupingPolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_UpdateNamedGroupingPolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_UpdateNamedGroupingPolicy_Call) RunAndReturn(run func(string, []string, []string) (bool, error)) *IEnforcer_UpdateNamedGroupingPolicy_Call { + _c.Call.Return(run) + return _c +} + // UpdatePolicies provides a mock function with given fields: oldPolicies, newPolicies func (_m *IEnforcer) UpdatePolicies(oldPolicies [][]string, newPolicies [][]string) (bool, error) { ret := _m.Called(oldPolicies, newPolicies) @@ -3200,6 +6844,35 @@ func (_m *IEnforcer) UpdatePolicies(oldPolicies [][]string, newPolicies [][]stri return r0, r1 } +// IEnforcer_UpdatePolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePolicies' +type IEnforcer_UpdatePolicies_Call struct { + *mock.Call +} + +// UpdatePolicies is a helper method to define mock.On call +// - oldPolicies [][]string +// - newPolicies [][]string +func (_e *IEnforcer_Expecter) UpdatePolicies(oldPolicies interface{}, newPolicies interface{}) *IEnforcer_UpdatePolicies_Call { + return &IEnforcer_UpdatePolicies_Call{Call: _e.mock.On("UpdatePolicies", oldPolicies, newPolicies)} +} + +func (_c *IEnforcer_UpdatePolicies_Call) Run(run func(oldPolicies [][]string, newPolicies [][]string)) *IEnforcer_UpdatePolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([][]string), args[1].([][]string)) + }) + return _c +} + +func (_c *IEnforcer_UpdatePolicies_Call) Return(_a0 bool, _a1 error) *IEnforcer_UpdatePolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_UpdatePolicies_Call) RunAndReturn(run func([][]string, [][]string) (bool, error)) *IEnforcer_UpdatePolicies_Call { + _c.Call.Return(run) + return _c +} + // UpdatePolicy provides a mock function with given fields: oldPolicy, newPolicy func (_m *IEnforcer) UpdatePolicy(oldPolicy []string, newPolicy []string) (bool, error) { ret := _m.Called(oldPolicy, newPolicy) @@ -3228,6 +6901,35 @@ func (_m *IEnforcer) UpdatePolicy(oldPolicy []string, newPolicy []string) (bool, return r0, r1 } +// IEnforcer_UpdatePolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePolicy' +type IEnforcer_UpdatePolicy_Call struct { + *mock.Call +} + +// UpdatePolicy is a helper method to define mock.On call +// - oldPolicy []string +// - newPolicy []string +func (_e *IEnforcer_Expecter) UpdatePolicy(oldPolicy interface{}, newPolicy interface{}) *IEnforcer_UpdatePolicy_Call { + return &IEnforcer_UpdatePolicy_Call{Call: _e.mock.On("UpdatePolicy", oldPolicy, newPolicy)} +} + +func (_c *IEnforcer_UpdatePolicy_Call) Run(run func(oldPolicy []string, newPolicy []string)) *IEnforcer_UpdatePolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]string), args[1].([]string)) + }) + return _c +} + +func (_c *IEnforcer_UpdatePolicy_Call) Return(_a0 bool, _a1 error) *IEnforcer_UpdatePolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IEnforcer_UpdatePolicy_Call) RunAndReturn(run func([]string, []string) (bool, error)) *IEnforcer_UpdatePolicy_Call { + _c.Call.Return(run) + return _c +} + // NewIEnforcer creates a new instance of IEnforcer. 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 NewIEnforcer(t interface { diff --git a/pkg/rbac/rbac.go b/pkg/rbac/rbac.go index 2281db814..2f3b54c5a 100644 --- a/pkg/rbac/rbac.go +++ b/pkg/rbac/rbac.go @@ -71,7 +71,7 @@ const ( // This informer reloads the policy whenever the ConfigMap is updated. func refreshEnforcerInBackground( ctx context.Context, - kubeClient *kubernetes.Kubernetes, + kubeClient kubernetes.KubernetesConnector, enforcer *casbin.Enforcer, l *zap.SugaredLogger, ) error { @@ -139,7 +139,7 @@ func NewEnforcerFromFilePath(filePath string) (*casbin.Enforcer, error) { } // NewEnforcer creates a new Casbin enforcer with the RBAC model and ConfigMap adapter. -func NewEnforcer(ctx context.Context, kubeClient *kubernetes.Kubernetes, l *zap.SugaredLogger) (*casbin.Enforcer, error) { +func NewEnforcer(ctx context.Context, kubeClient kubernetes.KubernetesConnector, l *zap.SugaredLogger) (*casbin.Enforcer, error) { cmReq := types.NamespacedName{ Namespace: common.SystemNamespace, Name: common.EverestRBACConfigMapName,