From dbfee26d47e3e9984077ff74bd418cacbc4b8e6b Mon Sep 17 00:00:00 2001 From: Murat Kabilov <murat@kabilov.com> Date: Mon, 17 Jul 2017 17:28:05 +0200 Subject: [PATCH] use teams api client interface instead of pointer --- pkg/cluster/cluster.go | 2 +- pkg/controller/controller.go | 4 ++-- pkg/util/teams/teams.go | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index e62f0b16..9b8f2918 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -39,7 +39,7 @@ type Config struct { KubeClient *kubernetes.Clientset //TODO: move clients to the better place? RestClient *rest.RESTClient RestConfig *rest.Config - TeamsAPIClient *teams.API + TeamsAPIClient teams.Client OpConfig config.Config InfrastructureRoles map[string]spec.PgUser // inherited from the controller } diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index b0e0962b..2cac1d7c 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -20,8 +20,8 @@ import ( type Config struct { RestConfig *rest.Config KubeClient *kubernetes.Clientset - RestClient *rest.RESTClient - TeamsAPIClient *teams.API + RestClient rest.Interface + TeamsAPIClient teams.Client InfrastructureRoles map[string]spec.PgUser } diff --git a/pkg/util/teams/teams.go b/pkg/util/teams/teams.go index b3d80349..ac32ea7e 100644 --- a/pkg/util/teams/teams.go +++ b/pkg/util/teams/teams.go @@ -39,6 +39,10 @@ type team struct { InfrastructureAccounts []infrastructureAccount `json:"infrastructure-accounts"` } +type Client interface { + TeamInfo(string, string) (*team, error) +} + type httpClient interface { Do(req *http.Request) (*http.Response, error) } -- GitLab