From 2f0ea5241dd90c76cd2f0fdc47d413dfb43cf290 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Tue, 10 Dec 2019 17:56:47 +0800 Subject: [PATCH] update ingress after updating the certificate --- api/api/api_interface.go | 1 + api/api_routers/version2/v2Routers.go | 8 ++++ api/controller/gateway.go | 54 ++++++++++++++++++++++++++- api/handler/gateway_action.go | 24 ++++++++++++ api/handler/gateway_handler.go | 2 + api/model/gateway_model.go | 8 ++++ db/dao/dao.go | 1 + db/dao/dao_mock.go | 45 ++++++++++++++++++++++ db/mysql/dao/gateway.go | 11 +++++- event/manager_mock.go | 28 ++++++++++++++ worker/appm/store/mock_store.go | 32 ++++++++++++++++ 11 files changed, 212 insertions(+), 2 deletions(-) diff --git a/api/api/api_interface.go b/api/api/api_interface.go index 1e0353bf7..9e719b654 100644 --- a/api/api/api_interface.go +++ b/api/api/api_interface.go @@ -142,6 +142,7 @@ type Gatewayer interface { TCPRule(w http.ResponseWriter, r *http.Request) GetAvailablePort(w http.ResponseWriter, r *http.Request) RuleConfig(w http.ResponseWriter, r *http.Request) + Certificate(w http.ResponseWriter, r *http.Request) } // ThirdPartyServicer is an interface for defining methods for third-party service. diff --git a/api/api_routers/version2/v2Routers.go b/api/api_routers/version2/v2Routers.go index d615e28d9..88e4eabe9 100644 --- a/api/api_routers/version2/v2Routers.go +++ b/api/api_routers/version2/v2Routers.go @@ -128,6 +128,7 @@ func (v2 *V2) tenantNameRouter() chi.Router { r.Post("/tcp-rule", controller.GetManager().TCPRule) r.Delete("/tcp-rule", controller.GetManager().TCPRule) r.Put("/tcp-rule", controller.GetManager().TCPRule) + r.Mount("/gateway", v2.gatewayRouter()) //batch operation r.Post("/batchoperation", controller.BatchOperation) @@ -135,6 +136,13 @@ func (v2 *V2) tenantNameRouter() chi.Router { return r } +func (v2 *V2) gatewayRouter() chi.Router { + r := chi.NewRouter() + r.Put("/certificate", controller.GetManager().Certificate) + + return r +} + func (v2 *V2) serviceRouter() chi.Router { r := chi.NewRouter() //初始化应用信息 diff --git a/api/controller/gateway.go b/api/controller/gateway.go index d690c143b..f6ed9f490 100644 --- a/api/controller/gateway.go +++ b/api/controller/gateway.go @@ -25,13 +25,16 @@ import ( "strings" "github.com/Sirupsen/logrus" + "github.com/jinzhu/gorm" + k8svalidation "k8s.io/apimachinery/pkg/util/validation" + "github.com/goodrain/rainbond/api/handler" "github.com/goodrain/rainbond/api/middleware" api_model "github.com/goodrain/rainbond/api/model" "github.com/goodrain/rainbond/cmd/api/option" "github.com/goodrain/rainbond/mq/client" + "github.com/goodrain/rainbond/util" httputil "github.com/goodrain/rainbond/util/http" - k8svalidation "k8s.io/apimachinery/pkg/util/validation" ) // GatewayStruct - @@ -373,6 +376,55 @@ func (g *GatewayStruct) RuleConfig(w http.ResponseWriter, r *http.Request) { httputil.ReturnSuccess(r, w, "success") } +// Certificate - +func (g *GatewayStruct) Certificate(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case "PUT": + g.updCertificate(w, r) + } +} + +//updCertificate updates certificate and refresh http rules based on certificate id +func (g *GatewayStruct) updCertificate(w http.ResponseWriter, r *http.Request) { + var req api_model.UpdCertificateReq + ok := httputil.ValidatorRequestStructAndErrorResponse(r, w, &req, nil) + if !ok { + return + } + + if err := handler.GetGatewayHandler().UpdCertificate(&req); err != nil { + logrus.Errorf("update certificate: %v", err) + if err == gorm.ErrRecordNotFound { + httputil.ReturnError(r, w, 404, err.Error()) + return + } + httputil.ReturnError(r, w, 500, err.Error()) + return + } + + // list related http rules + rules, err := handler.GetGatewayHandler().ListHTTPRulesByCertID(req.CertificateID) + if err != nil { + msg := "certificate id: %s; list http rules: %v" + logrus.Errorf(msg, req.CertificateID, err) + httputil.ReturnError(r, w, 500, fmt.Sprintf(msg, req.CertificateID, err)) + return + } + + for _, rule := range rules { + eventID := util.NewUUID() + if err := handler.GetGatewayHandler().SendTask(map[string]interface{}{ + "service_id": rule.ServiceID, + "action": "update-rule-config", + "event_id": eventID, + }); err != nil { + logrus.Warningf("send runtime message about gateway failure %v", err) + } + } + + httputil.ReturnSuccess(r, w, nil) +} + //GetGatewayIPs get gateway ips func GetGatewayIPs(w http.ResponseWriter, r *http.Request) { ips := handler.GetGatewayHandler().GetGatewayIPs() diff --git a/api/handler/gateway_action.go b/api/handler/gateway_action.go index a3e359edd..74e38f37f 100644 --- a/api/handler/gateway_action.go +++ b/api/handler/gateway_action.go @@ -644,6 +644,30 @@ func (g *GatewayAction) RuleConfig(req *apimodel.RuleConfigReq) error { return nil } +// UpdCertificate - +func (g *GatewayAction) UpdCertificate(req *apimodel.UpdCertificateReq) error { + cert, err := db.GetManager().CertificateDao().GetCertificateByID(req.CertificateID) + if err != nil { + msg := "retrieve certificate: %v" + return fmt.Errorf(msg, err) + } + + cert.CertificateName = req.CertificateName + cert.Certificate = req.Certificate + cert.PrivateKey = req.PrivateKey + if err := db.GetManager().CertificateDao().UpdateModel(cert); err != nil { + msg := "update certificate: %v" + return fmt.Errorf(msg, err) + } + + return nil +} + +// ListHTTPRulesByCertID - +func (g *GatewayAction) ListHTTPRulesByCertID(certID string) ([]*model.HTTPRule, error) { + return db.GetManager().HTTPRuleDao().ListByCertID(certID) +} + //IPAndAvailablePort ip and advice available port type IPAndAvailablePort struct { IP string `json:"ip"` diff --git a/api/handler/gateway_handler.go b/api/handler/gateway_handler.go index 3aafb1ab9..3f0849fa2 100644 --- a/api/handler/gateway_handler.go +++ b/api/handler/gateway_handler.go @@ -43,5 +43,7 @@ type GatewayHandler interface { TCPIPPortExists(ip string, port int) bool SendTask(in map[string]interface{}) error RuleConfig(req *apimodel.RuleConfigReq) error + UpdCertificate(req *apimodel.UpdCertificateReq) error GetGatewayIPs() []IPAndAvailablePort + ListHTTPRulesByCertID(certID string) ([]*dbmodel.HTTPRule, error) } diff --git a/api/model/gateway_model.go b/api/model/gateway_model.go index 0b5b90905..69d7ea3b1 100644 --- a/api/model/gateway_model.go +++ b/api/model/gateway_model.go @@ -141,3 +141,11 @@ type Rewrite struct { Replacement string `json:"replacement"` Flag string `json:"flag" validate:"flag|in:last,break,redirect,permanent"` } + +// UpdCertificateReq - +type UpdCertificateReq struct { + CertificateID string `json:"certificate_id"` + CertificateName string `json:"certificate_name"` + Certificate string `json:"certificate"` + PrivateKey string `json:"private_key"` +} diff --git a/db/dao/dao.go b/db/dao/dao.go index 5171c4b58..ee6d1bc6f 100644 --- a/db/dao/dao.go +++ b/db/dao/dao.go @@ -410,6 +410,7 @@ type HTTPRuleDao interface { DeleteHTTPRuleByID(id string) error DeleteHTTPRuleByServiceID(serviceID string) error ListByServiceID(serviceID string) ([]*model.HTTPRule, error) + ListByCertID(certID string) ([]*model.HTTPRule, error) } // TCPRuleDao - diff --git a/db/dao/dao_mock.go b/db/dao/dao_mock.go index 9d80406a0..47c1932b7 100644 --- a/db/dao/dao_mock.go +++ b/db/dao/dao_mock.go @@ -991,6 +991,21 @@ func (mr *MockTenantServicesPortDaoMockRecorder) DelByServiceID(sid interface{}) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DelByServiceID", reflect.TypeOf((*MockTenantServicesPortDao)(nil).DelByServiceID), sid) } +// ListInnerPortsByServiceIDs mocks base method +func (m *MockTenantServicesPortDao) ListInnerPortsByServiceIDs(serviceIDs []string) ([]*model.TenantServicesPort, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListInnerPortsByServiceIDs", serviceIDs) + ret0, _ := ret[0].([]*model.TenantServicesPort) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListInnerPortsByServiceIDs indicates an expected call of ListInnerPortsByServiceIDs +func (mr *MockTenantServicesPortDaoMockRecorder) ListInnerPortsByServiceIDs(serviceIDs interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInnerPortsByServiceIDs", reflect.TypeOf((*MockTenantServicesPortDao)(nil).ListInnerPortsByServiceIDs), serviceIDs) +} + // MockTenantPluginDao is a mock of TenantPluginDao interface type MockTenantPluginDao struct { ctrl *gomock.Controller @@ -1893,6 +1908,21 @@ func (mr *MockTenantServiceRelationDaoMockRecorder) GetTenantServiceRelations(se return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTenantServiceRelations", reflect.TypeOf((*MockTenantServiceRelationDao)(nil).GetTenantServiceRelations), serviceID) } +// ListByServiceIDs mocks base method +func (m *MockTenantServiceRelationDao) ListByServiceIDs(serviceIDs []string) ([]*model.TenantServiceRelation, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListByServiceIDs", serviceIDs) + ret0, _ := ret[0].([]*model.TenantServiceRelation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListByServiceIDs indicates an expected call of ListByServiceIDs +func (mr *MockTenantServiceRelationDaoMockRecorder) ListByServiceIDs(serviceIDs interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListByServiceIDs", reflect.TypeOf((*MockTenantServiceRelationDao)(nil).ListByServiceIDs), serviceIDs) +} + // GetTenantServiceRelationsByDependServiceID mocks base method func (m *MockTenantServiceRelationDao) GetTenantServiceRelationsByDependServiceID(dependServiceID string) ([]*model.TenantServiceRelation, error) { m.ctrl.T.Helper() @@ -4540,6 +4570,21 @@ func (mr *MockHTTPRuleDaoMockRecorder) ListByServiceID(serviceID interface{}) *g return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListByServiceID", reflect.TypeOf((*MockHTTPRuleDao)(nil).ListByServiceID), serviceID) } +// ListByCertID mocks base method +func (m *MockHTTPRuleDao) ListByCertID(certID string) ([]*model.HTTPRule, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListByCertID", certID) + ret0, _ := ret[0].([]*model.HTTPRule) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListByCertID indicates an expected call of ListByCertID +func (mr *MockHTTPRuleDaoMockRecorder) ListByCertID(certID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListByCertID", reflect.TypeOf((*MockHTTPRuleDao)(nil).ListByCertID), certID) +} + // MockTCPRuleDao is a mock of TCPRuleDao interface type MockTCPRuleDao struct { ctrl *gomock.Controller diff --git a/db/mysql/dao/gateway.go b/db/mysql/dao/gateway.go index be8729633..b1f2d4f87 100644 --- a/db/mysql/dao/gateway.go +++ b/db/mysql/dao/gateway.go @@ -58,7 +58,7 @@ func (c *CertificateDaoImpl) UpdateModel(mo model.Interface) error { } return c.DB.Table(cert.TableName()). Where("uuid = ?", cert.UUID). - Update(cert).Error + Save(cert).Error } //AddOrUpdate add or update Certificate @@ -225,6 +225,15 @@ func (h *HTTPRuleDaoImpl) ListByServiceID(serviceID string) ([]*model.HTTPRule, return rules, nil } +// ListByCertID lists all HTTPRules matching certificate id +func (h *HTTPRuleDaoImpl) ListByCertID(certID string) ([]*model.HTTPRule, error) { + var rules []*model.HTTPRule + if err := h.DB.Where("certificate_id = ?", certID).Find(&rules).Error; err != nil { + return nil, err + } + return rules, nil +} + // TCPRuleDaoTmpl is a implementation of TcpRuleDao type TCPRuleDaoTmpl struct { DB *gorm.DB diff --git a/event/manager_mock.go b/event/manager_mock.go index 58d8c6b4a..cfeb06f6c 100644 --- a/event/manager_mock.go +++ b/event/manager_mock.go @@ -35,6 +35,7 @@ func (m *MockManager) EXPECT() *MockManagerMockRecorder { // GetLogger mocks base method func (m *MockManager) GetLogger(eventID string) Logger { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetLogger", eventID) ret0, _ := ret[0].(Logger) return ret0 @@ -42,11 +43,13 @@ func (m *MockManager) GetLogger(eventID string) Logger { // GetLogger indicates an expected call of GetLogger func (mr *MockManagerMockRecorder) GetLogger(eventID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLogger", reflect.TypeOf((*MockManager)(nil).GetLogger), eventID) } // Start mocks base method func (m *MockManager) Start() error { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Start") ret0, _ := ret[0].(error) return ret0 @@ -54,11 +57,13 @@ func (m *MockManager) Start() error { // Start indicates an expected call of Start func (mr *MockManagerMockRecorder) Start() *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*MockManager)(nil).Start)) } // Close mocks base method func (m *MockManager) Close() error { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Close") ret0, _ := ret[0].(error) return ret0 @@ -66,16 +71,19 @@ func (m *MockManager) Close() error { // Close indicates an expected call of Close func (mr *MockManagerMockRecorder) Close() *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockManager)(nil).Close)) } // ReleaseLogger mocks base method func (m *MockManager) ReleaseLogger(arg0 Logger) { + m.ctrl.T.Helper() m.ctrl.Call(m, "ReleaseLogger", arg0) } // ReleaseLogger indicates an expected call of ReleaseLogger func (mr *MockManagerMockRecorder) ReleaseLogger(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReleaseLogger", reflect.TypeOf((*MockManager)(nil).ReleaseLogger), arg0) } @@ -104,36 +112,43 @@ func (m *MockLogger) EXPECT() *MockLoggerMockRecorder { // Info mocks base method func (m *MockLogger) Info(arg0 string, arg1 map[string]string) { + m.ctrl.T.Helper() m.ctrl.Call(m, "Info", arg0, arg1) } // Info indicates an expected call of Info func (mr *MockLoggerMockRecorder) Info(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Info", reflect.TypeOf((*MockLogger)(nil).Info), arg0, arg1) } // Error mocks base method func (m *MockLogger) Error(arg0 string, arg1 map[string]string) { + m.ctrl.T.Helper() m.ctrl.Call(m, "Error", arg0, arg1) } // Error indicates an expected call of Error func (mr *MockLoggerMockRecorder) Error(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Error", reflect.TypeOf((*MockLogger)(nil).Error), arg0, arg1) } // Debug mocks base method func (m *MockLogger) Debug(arg0 string, arg1 map[string]string) { + m.ctrl.T.Helper() m.ctrl.Call(m, "Debug", arg0, arg1) } // Debug indicates an expected call of Debug func (mr *MockLoggerMockRecorder) Debug(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Debug", reflect.TypeOf((*MockLogger)(nil).Debug), arg0, arg1) } // Event mocks base method func (m *MockLogger) Event() string { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Event") ret0, _ := ret[0].(string) return ret0 @@ -141,11 +156,13 @@ func (m *MockLogger) Event() string { // Event indicates an expected call of Event func (mr *MockLoggerMockRecorder) Event() *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Event", reflect.TypeOf((*MockLogger)(nil).Event)) } // CreateTime mocks base method func (m *MockLogger) CreateTime() time.Time { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateTime") ret0, _ := ret[0].(time.Time) return ret0 @@ -153,11 +170,13 @@ func (m *MockLogger) CreateTime() time.Time { // CreateTime indicates an expected call of CreateTime func (mr *MockLoggerMockRecorder) CreateTime() *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTime", reflect.TypeOf((*MockLogger)(nil).CreateTime)) } // GetChan mocks base method func (m *MockLogger) GetChan() chan []byte { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetChan") ret0, _ := ret[0].(chan []byte) return ret0 @@ -165,21 +184,25 @@ func (m *MockLogger) GetChan() chan []byte { // GetChan indicates an expected call of GetChan func (mr *MockLoggerMockRecorder) GetChan() *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetChan", reflect.TypeOf((*MockLogger)(nil).GetChan)) } // SetChan mocks base method func (m *MockLogger) SetChan(arg0 chan []byte) { + m.ctrl.T.Helper() m.ctrl.Call(m, "SetChan", arg0) } // SetChan indicates an expected call of SetChan func (mr *MockLoggerMockRecorder) SetChan(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetChan", reflect.TypeOf((*MockLogger)(nil).SetChan), arg0) } // GetWriter mocks base method func (m *MockLogger) GetWriter(step, level string) LoggerWriter { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetWriter", step, level) ret0, _ := ret[0].(LoggerWriter) return ret0 @@ -187,6 +210,7 @@ func (m *MockLogger) GetWriter(step, level string) LoggerWriter { // GetWriter indicates an expected call of GetWriter func (mr *MockLoggerMockRecorder) GetWriter(step, level interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWriter", reflect.TypeOf((*MockLogger)(nil).GetWriter), step, level) } @@ -215,6 +239,7 @@ func (m *MockLoggerWriter) EXPECT() *MockLoggerWriterMockRecorder { // Write mocks base method func (m *MockLoggerWriter) Write(p []byte) (int, error) { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Write", p) ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) @@ -223,15 +248,18 @@ func (m *MockLoggerWriter) Write(p []byte) (int, error) { // Write indicates an expected call of Write func (mr *MockLoggerWriterMockRecorder) Write(p interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockLoggerWriter)(nil).Write), p) } // SetFormat mocks base method func (m *MockLoggerWriter) SetFormat(arg0 map[string]interface{}) { + m.ctrl.T.Helper() m.ctrl.Call(m, "SetFormat", arg0) } // SetFormat indicates an expected call of SetFormat func (mr *MockLoggerWriterMockRecorder) SetFormat(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetFormat", reflect.TypeOf((*MockLoggerWriter)(nil).SetFormat), arg0) } diff --git a/worker/appm/store/mock_store.go b/worker/appm/store/mock_store.go index d9e3b8e3d..0bb7bf175 100644 --- a/worker/appm/store/mock_store.go +++ b/worker/appm/store/mock_store.go @@ -38,6 +38,7 @@ func (m *MockStorer) EXPECT() *MockStorerMockRecorder { // Start mocks base method func (m *MockStorer) Start() error { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Start") ret0, _ := ret[0].(error) return ret0 @@ -45,11 +46,13 @@ func (m *MockStorer) Start() error { // Start indicates an expected call of Start func (mr *MockStorerMockRecorder) Start() *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*MockStorer)(nil).Start)) } // Ready mocks base method func (m *MockStorer) Ready() bool { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Ready") ret0, _ := ret[0].(bool) return ret0 @@ -57,21 +60,25 @@ func (m *MockStorer) Ready() bool { // Ready indicates an expected call of Ready func (mr *MockStorerMockRecorder) Ready() *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ready", reflect.TypeOf((*MockStorer)(nil).Ready)) } // RegistAppService mocks base method func (m *MockStorer) RegistAppService(arg0 *v1.AppService) { + m.ctrl.T.Helper() m.ctrl.Call(m, "RegistAppService", arg0) } // RegistAppService indicates an expected call of RegistAppService func (mr *MockStorerMockRecorder) RegistAppService(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegistAppService", reflect.TypeOf((*MockStorer)(nil).RegistAppService), arg0) } // GetAppService mocks base method func (m *MockStorer) GetAppService(serviceID string) *v1.AppService { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAppService", serviceID) ret0, _ := ret[0].(*v1.AppService) return ret0 @@ -79,11 +86,13 @@ func (m *MockStorer) GetAppService(serviceID string) *v1.AppService { // GetAppService indicates an expected call of GetAppService func (mr *MockStorerMockRecorder) GetAppService(serviceID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAppService", reflect.TypeOf((*MockStorer)(nil).GetAppService), serviceID) } // UpdateGetAppService mocks base method func (m *MockStorer) UpdateGetAppService(serviceID string) *v1.AppService { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateGetAppService", serviceID) ret0, _ := ret[0].(*v1.AppService) return ret0 @@ -91,11 +100,13 @@ func (m *MockStorer) UpdateGetAppService(serviceID string) *v1.AppService { // UpdateGetAppService indicates an expected call of UpdateGetAppService func (mr *MockStorerMockRecorder) UpdateGetAppService(serviceID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGetAppService", reflect.TypeOf((*MockStorer)(nil).UpdateGetAppService), serviceID) } // GetAllAppServices mocks base method func (m *MockStorer) GetAllAppServices() []*v1.AppService { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAllAppServices") ret0, _ := ret[0].([]*v1.AppService) return ret0 @@ -103,11 +114,13 @@ func (m *MockStorer) GetAllAppServices() []*v1.AppService { // GetAllAppServices indicates an expected call of GetAllAppServices func (mr *MockStorerMockRecorder) GetAllAppServices() *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllAppServices", reflect.TypeOf((*MockStorer)(nil).GetAllAppServices)) } // GetAppServiceStatus mocks base method func (m *MockStorer) GetAppServiceStatus(serviceID string) string { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAppServiceStatus", serviceID) ret0, _ := ret[0].(string) return ret0 @@ -115,11 +128,13 @@ func (m *MockStorer) GetAppServiceStatus(serviceID string) string { // GetAppServiceStatus indicates an expected call of GetAppServiceStatus func (mr *MockStorerMockRecorder) GetAppServiceStatus(serviceID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAppServiceStatus", reflect.TypeOf((*MockStorer)(nil).GetAppServiceStatus), serviceID) } // GetAppServicesStatus mocks base method func (m *MockStorer) GetAppServicesStatus(serviceIDs []string) map[string]string { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAppServicesStatus", serviceIDs) ret0, _ := ret[0].(map[string]string) return ret0 @@ -127,11 +142,13 @@ func (m *MockStorer) GetAppServicesStatus(serviceIDs []string) map[string]string // GetAppServicesStatus indicates an expected call of GetAppServicesStatus func (mr *MockStorerMockRecorder) GetAppServicesStatus(serviceIDs interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAppServicesStatus", reflect.TypeOf((*MockStorer)(nil).GetAppServicesStatus), serviceIDs) } // GetTenantResource mocks base method func (m *MockStorer) GetTenantResource(tenantID string) *v1.TenantResource { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTenantResource", tenantID) ret0, _ := ret[0].(*v1.TenantResource) return ret0 @@ -139,11 +156,13 @@ func (m *MockStorer) GetTenantResource(tenantID string) *v1.TenantResource { // GetTenantResource indicates an expected call of GetTenantResource func (mr *MockStorerMockRecorder) GetTenantResource(tenantID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTenantResource", reflect.TypeOf((*MockStorer)(nil).GetTenantResource), tenantID) } // GetTenantRunningApp mocks base method func (m *MockStorer) GetTenantRunningApp(tenantID string) []*v1.AppService { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTenantRunningApp", tenantID) ret0, _ := ret[0].([]*v1.AppService) return ret0 @@ -151,11 +170,13 @@ func (m *MockStorer) GetTenantRunningApp(tenantID string) []*v1.AppService { // GetTenantRunningApp indicates an expected call of GetTenantRunningApp func (mr *MockStorerMockRecorder) GetTenantRunningApp(tenantID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTenantRunningApp", reflect.TypeOf((*MockStorer)(nil).GetTenantRunningApp), tenantID) } // GetNeedBillingStatus mocks base method func (m *MockStorer) GetNeedBillingStatus(serviceIDs []string) map[string]string { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetNeedBillingStatus", serviceIDs) ret0, _ := ret[0].(map[string]string) return ret0 @@ -163,21 +184,25 @@ func (m *MockStorer) GetNeedBillingStatus(serviceIDs []string) map[string]string // GetNeedBillingStatus indicates an expected call of GetNeedBillingStatus func (mr *MockStorerMockRecorder) GetNeedBillingStatus(serviceIDs interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNeedBillingStatus", reflect.TypeOf((*MockStorer)(nil).GetNeedBillingStatus), serviceIDs) } // OnDelete mocks base method func (m *MockStorer) OnDelete(obj interface{}) { + m.ctrl.T.Helper() m.ctrl.Call(m, "OnDelete", obj) } // OnDelete indicates an expected call of OnDelete func (mr *MockStorerMockRecorder) OnDelete(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnDelete", reflect.TypeOf((*MockStorer)(nil).OnDelete), obj) } // GetPodLister mocks base method func (m *MockStorer) GetPodLister() v11.PodLister { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetPodLister") ret0, _ := ret[0].(v11.PodLister) return ret0 @@ -185,31 +210,37 @@ func (m *MockStorer) GetPodLister() v11.PodLister { // GetPodLister indicates an expected call of GetPodLister func (mr *MockStorerMockRecorder) GetPodLister() *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPodLister", reflect.TypeOf((*MockStorer)(nil).GetPodLister)) } // RegistPodUpdateListener mocks base method func (m *MockStorer) RegistPodUpdateListener(arg0 string, arg1 chan<- *v10.Pod) { + m.ctrl.T.Helper() m.ctrl.Call(m, "RegistPodUpdateListener", arg0, arg1) } // RegistPodUpdateListener indicates an expected call of RegistPodUpdateListener func (mr *MockStorerMockRecorder) RegistPodUpdateListener(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegistPodUpdateListener", reflect.TypeOf((*MockStorer)(nil).RegistPodUpdateListener), arg0, arg1) } // UnRegistPodUpdateListener mocks base method func (m *MockStorer) UnRegistPodUpdateListener(arg0 string) { + m.ctrl.T.Helper() m.ctrl.Call(m, "UnRegistPodUpdateListener", arg0) } // UnRegistPodUpdateListener indicates an expected call of UnRegistPodUpdateListener func (mr *MockStorerMockRecorder) UnRegistPodUpdateListener(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnRegistPodUpdateListener", reflect.TypeOf((*MockStorer)(nil).UnRegistPodUpdateListener), arg0) } // InitOneThirdPartService mocks base method func (m *MockStorer) InitOneThirdPartService(service *model.TenantServices) error { + m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InitOneThirdPartService", service) ret0, _ := ret[0].(error) return ret0 @@ -217,5 +248,6 @@ func (m *MockStorer) InitOneThirdPartService(service *model.TenantServices) erro // InitOneThirdPartService indicates an expected call of InitOneThirdPartService func (mr *MockStorerMockRecorder) InitOneThirdPartService(service interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitOneThirdPartService", reflect.TypeOf((*MockStorer)(nil).InitOneThirdPartService), service) }