From bfc522a89cdd392588d96f451fa04ef5e342c349 Mon Sep 17 00:00:00 2001 From: Qiu Jian Date: Mon, 22 Mar 2021 09:58:26 +0800 Subject: [PATCH] fix(apigateway): use info response service type of console endpoints --- pkg/apigateway/handler/auth.go | 1 + pkg/mcclient/token.go | 2 ++ pkg/mcclient/token3.go | 7 +++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/apigateway/handler/auth.go b/pkg/apigateway/handler/auth.go index f8f1b31581..f6aaa3b749 100644 --- a/pkg/apigateway/handler/auth.go +++ b/pkg/apigateway/handler/auth.go @@ -1006,6 +1006,7 @@ func getUserInfo2(s *mcclient.ClientSession, uid string, pid string, loginIp str item := jsonutils.NewDict() item.Add(jsonutils.NewString(ep.Url), "url") item.Add(jsonutils.NewString(ep.Name), "name") + item.Add(jsonutils.NewString(ep.Service), "service") menus.Add(item) } diff --git a/pkg/mcclient/token.go b/pkg/mcclient/token.go index 2194fe5227..a3dce5d743 100644 --- a/pkg/mcclient/token.go +++ b/pkg/mcclient/token.go @@ -26,6 +26,8 @@ import ( type ExternalService struct { Name string Url string + + Service string } type Endpoint struct { diff --git a/pkg/mcclient/token3.go b/pkg/mcclient/token3.go index 4d698623d4..1bb11c1b96 100644 --- a/pkg/mcclient/token3.go +++ b/pkg/mcclient/token3.go @@ -316,8 +316,11 @@ func (catalog KeystoneServiceCatalogV3) GetServicesByInterface(region string, in if catalog[i].Endpoints[j].RegionId == region && catalog[i].Endpoints[j].Interface == infType && len(catalog[i].Endpoints[j].Name) > 0 { - srv := ExternalService{Name: catalog[i].Endpoints[j].Name, - Url: catalog[i].Endpoints[j].Url} + srv := ExternalService{ + Name: catalog[i].Endpoints[j].Name, + Url: catalog[i].Endpoints[j].Url, + Service: catalog[i].Type, + } services = append(services, srv) } }