github.com/kiali/kiali@v1.84.0/kubernetes/kubetest/mock_kubernetes.go (about) 1 package kubetest 2 3 import ( 4 "context" 5 "io" 6 7 apps_v1 "k8s.io/api/apps/v1" 8 auth_v1 "k8s.io/api/authorization/v1" 9 batch_v1 "k8s.io/api/batch/v1" 10 core_v1 "k8s.io/api/core/v1" 11 "k8s.io/client-go/kubernetes" 12 ) 13 14 func (o *K8SClientMock) Kube() kubernetes.Interface { 15 return nil 16 } 17 18 func (o *K8SClientMock) GetClusterServicesByLabels(labelsSelector string) ([]core_v1.Service, error) { 19 args := o.Called(labelsSelector) 20 return args.Get(0).([]core_v1.Service), args.Error(1) 21 } 22 23 func (o *K8SClientMock) GetConfigMap(namespace, name string) (*core_v1.ConfigMap, error) { 24 args := o.Called(namespace, name) 25 return args.Get(0).(*core_v1.ConfigMap), args.Error(1) 26 } 27 28 func (o *K8SClientMock) GetCronJobs(namespace string) ([]batch_v1.CronJob, error) { 29 args := o.Called(namespace) 30 return args.Get(0).([]batch_v1.CronJob), args.Error(1) 31 } 32 33 func (o *K8SClientMock) GetDaemonSet(namespace string, name string) (*apps_v1.DaemonSet, error) { 34 args := o.Called(namespace, name) 35 return args.Get(0).(*apps_v1.DaemonSet), args.Error(1) 36 } 37 38 func (o *K8SClientMock) GetDaemonSets(namespace string) ([]apps_v1.DaemonSet, error) { 39 args := o.Called(namespace) 40 return args.Get(0).([]apps_v1.DaemonSet), args.Error(1) 41 } 42 43 func (o *K8SClientMock) GetDeployment(namespace string, name string) (*apps_v1.Deployment, error) { 44 args := o.Called(namespace, name) 45 return args.Get(0).(*apps_v1.Deployment), args.Error(1) 46 } 47 48 func (o *K8SClientMock) GetDeployments(namespace string) ([]apps_v1.Deployment, error) { 49 args := o.Called(namespace) 50 return args.Get(0).([]apps_v1.Deployment), args.Error(1) 51 } 52 53 func (o *K8SClientMock) GetDeploymentsByLabel(namespace string, labelSelector string) ([]apps_v1.Deployment, error) { 54 args := o.Called(namespace, labelSelector) 55 return args.Get(0).([]apps_v1.Deployment), args.Error(1) 56 } 57 58 func (o *K8SClientMock) GetEndpoints(namespace string, name string) (*core_v1.Endpoints, error) { 59 args := o.Called(namespace, name) 60 return args.Get(0).(*core_v1.Endpoints), args.Error(1) 61 } 62 63 func (o *K8SClientMock) GetJobs(namespace string) ([]batch_v1.Job, error) { 64 args := o.Called(namespace) 65 return args.Get(0).([]batch_v1.Job), args.Error(1) 66 } 67 68 func (o *K8SClientMock) GetNamespace(namespace string) (*core_v1.Namespace, error) { 69 args := o.Called(namespace) 70 return args.Get(0).(*core_v1.Namespace), args.Error(1) 71 } 72 73 func (o *K8SClientMock) GetNamespaces(labelSelector string) ([]core_v1.Namespace, error) { 74 args := o.Called(labelSelector) 75 return args.Get(0).([]core_v1.Namespace), args.Error(1) 76 } 77 78 func (o *K8SClientMock) GetNamespaceClusters(namespace string) ([]core_v1.Namespace, error) { 79 args := o.Called(namespace) 80 return args.Get(0).([]core_v1.Namespace), args.Error(1) 81 } 82 83 func (o *K8SClientMock) GetNamespacesByCluster(namespace string) ([]core_v1.Namespace, error) { 84 args := o.Called(namespace) 85 return args.Get(0).([]core_v1.Namespace), args.Error(1) 86 } 87 88 func (o *K8SClientMock) GetPods(namespace, labelSelector string) ([]core_v1.Pod, error) { 89 args := o.Called(namespace, labelSelector) 90 return args.Get(0).([]core_v1.Pod), args.Error(1) 91 } 92 93 func (o *K8SClientMock) GetPod(namespace, name string) (*core_v1.Pod, error) { 94 args := o.Called(namespace, name) 95 return args.Get(0).(*core_v1.Pod), args.Error(1) 96 } 97 98 func (o *K8SClientMock) GetReplicationControllers(namespace string) ([]core_v1.ReplicationController, error) { 99 args := o.Called(namespace) 100 return args.Get(0).([]core_v1.ReplicationController), args.Error(1) 101 } 102 103 func (o *K8SClientMock) GetReplicaSets(namespace string) ([]apps_v1.ReplicaSet, error) { 104 args := o.Called(namespace) 105 return args.Get(0).([]apps_v1.ReplicaSet), args.Error(1) 106 } 107 108 func (o *K8SClientMock) GetSecret(namespace, name string) (*core_v1.Secret, error) { 109 args := o.Called(namespace, name) 110 return args.Get(0).(*core_v1.Secret), args.Error(1) 111 } 112 113 func (o *K8SClientMock) GetSecrets(namespace string, labelSelector string) ([]core_v1.Secret, error) { 114 args := o.Called(namespace, labelSelector) 115 return args.Get(0).([]core_v1.Secret), args.Error(1) 116 } 117 118 func (o *K8SClientMock) GetSelfSubjectAccessReview(ctx context.Context, namespace, api, resourceType string, verbs []string) ([]*auth_v1.SelfSubjectAccessReview, error) { 119 args := o.Called(ctx, namespace, api, resourceType, verbs) 120 return args.Get(0).([]*auth_v1.SelfSubjectAccessReview), args.Error(1) 121 } 122 123 func (o *K8SClientMock) GetService(namespace string, name string) (*core_v1.Service, error) { 124 args := o.Called(namespace, name) 125 return args.Get(0).(*core_v1.Service), args.Error(1) 126 } 127 128 func (o *K8SClientMock) GetServices(namespace string, selectorLabels map[string]string) ([]core_v1.Service, error) { 129 args := o.Called(namespace, selectorLabels) 130 return args.Get(0).([]core_v1.Service), args.Error(1) 131 } 132 133 func (o *K8SClientMock) GetServicesByLabels(namespace string, labelsSelector string) ([]core_v1.Service, error) { 134 args := o.Called(namespace, labelsSelector) 135 return args.Get(0).([]core_v1.Service), args.Error(1) 136 } 137 138 func (o *K8SClientMock) GetStatefulSet(namespace string, name string) (*apps_v1.StatefulSet, error) { 139 args := o.Called(namespace, name) 140 return args.Get(0).(*apps_v1.StatefulSet), args.Error(1) 141 } 142 143 func (o *K8SClientMock) GetStatefulSets(namespace string) ([]apps_v1.StatefulSet, error) { 144 args := o.Called(namespace) 145 return args.Get(0).([]apps_v1.StatefulSet), args.Error(1) 146 } 147 148 func (o *K8SClientMock) StreamPodLogs(namespace, name string, opts *core_v1.PodLogOptions) (io.ReadCloser, error) { 149 args := o.Called(namespace, name, opts) 150 return args.Get(0).(io.ReadCloser), args.Error(1) 151 } 152 153 func (o *K8SClientMock) UpdateNamespace(namespace string, jsonPatch string) (*core_v1.Namespace, error) { 154 args := o.Called(namespace, jsonPatch) 155 return args.Get(0).(*core_v1.Namespace), args.Error(1) 156 } 157 158 func (o *K8SClientMock) UpdateWorkload(namespace string, name string, workloadType string, jsonPatch string, patchType string) error { 159 args := o.Called(namespace, name, workloadType, jsonPatch, patchType) 160 return args.Error(1) 161 } 162 163 func (o *K8SClientMock) UpdateService(namespace string, name string, jsonPatch string, patchType string) error { 164 args := o.Called(namespace, name, jsonPatch, patchType) 165 return args.Error(1) 166 }