2018-03-14 14:12:26 +08:00
|
|
|
// Copyright (C) 2014-2018 Goodrain Co., Ltd.
|
2017-11-07 11:40:44 +08:00
|
|
|
// RAINBOND, Application Management Platform
|
2018-03-14 14:33:31 +08:00
|
|
|
|
2017-11-07 11:40:44 +08:00
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version. For any non-GPL usage of Rainbond,
|
|
|
|
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
|
|
|
|
// must be obtained first.
|
2018-03-14 14:33:31 +08:00
|
|
|
|
2017-11-07 11:40:44 +08:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
2018-03-14 14:33:31 +08:00
|
|
|
|
2017-11-07 11:40:44 +08:00
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
package dao
|
|
|
|
|
2018-05-11 13:44:15 +08:00
|
|
|
import (
|
2019-04-08 16:15:26 +08:00
|
|
|
"errors"
|
2018-05-11 13:44:15 +08:00
|
|
|
"time"
|
2019-06-14 15:19:53 +08:00
|
|
|
|
|
|
|
"github.com/goodrain/rainbond/db/model"
|
2019-04-08 16:15:26 +08:00
|
|
|
)
|
2018-05-11 13:44:15 +08:00
|
|
|
|
2019-04-08 16:15:26 +08:00
|
|
|
var (
|
|
|
|
// VolumeNotFound volume not found error, happens when haven't find any matched data
|
|
|
|
VolumeNotFound = errors.New("Volume not found.")
|
2018-05-11 13:44:15 +08:00
|
|
|
)
|
2017-11-07 11:40:44 +08:00
|
|
|
|
|
|
|
//Dao 数据持久化层接口
|
|
|
|
type Dao interface {
|
|
|
|
AddModel(model.Interface) error
|
|
|
|
UpdateModel(model.Interface) error
|
|
|
|
}
|
|
|
|
|
|
|
|
//DelDao 删除接口
|
|
|
|
type DelDao interface {
|
|
|
|
DeleteModel(serviceID string, arg ...interface{}) error
|
|
|
|
}
|
|
|
|
|
2020-02-21 22:43:28 +08:00
|
|
|
// EnterpriseDao enterprise dao
|
|
|
|
type EnterpriseDao interface {
|
|
|
|
GetEnterpriseTenants(enterpriseID string) ([]*model.Tenants, error)
|
|
|
|
}
|
|
|
|
|
2017-11-07 11:40:44 +08:00
|
|
|
//TenantDao tenant dao
|
|
|
|
type TenantDao interface {
|
|
|
|
Dao
|
|
|
|
GetTenantByUUID(uuid string) (*model.Tenants, error)
|
|
|
|
GetTenantIDByName(tenantName string) (*model.Tenants, error)
|
2019-08-01 17:19:22 +08:00
|
|
|
GetALLTenants(query string) ([]*model.Tenants, error)
|
|
|
|
GetTenantByEid(eid, query string) ([]*model.Tenants, error)
|
2018-01-02 18:02:08 +08:00
|
|
|
GetPagedTenants(offset, len int) ([]*model.Tenants, error)
|
2018-03-13 16:55:53 +08:00
|
|
|
GetTenantIDsByNames(names []string) ([]string, error)
|
2018-11-13 13:41:20 +08:00
|
|
|
GetTenantLimitsByNames(names []string) (map[string]int, error)
|
2018-08-03 15:17:10 +08:00
|
|
|
GetTenantByUUIDIsExist(uuid string) bool
|
2019-11-05 11:43:10 +08:00
|
|
|
DelByTenantID(tenantID string) error
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
2018-11-26 20:37:50 +08:00
|
|
|
//AppDao tenant dao
|
2018-05-10 17:45:23 +08:00
|
|
|
type AppDao interface {
|
|
|
|
Dao
|
2018-05-21 22:15:46 +08:00
|
|
|
GetByEventId(eventID string) (*model.AppStatus, error)
|
|
|
|
DeleteModelByEventId(eventID string) error
|
2018-05-10 17:45:23 +08:00
|
|
|
}
|
|
|
|
|
2020-09-23 15:30:31 +08:00
|
|
|
//ApplicationDao tenant Application Dao
|
|
|
|
type ApplicationDao interface {
|
2020-09-17 15:45:46 +08:00
|
|
|
Dao
|
2020-09-20 02:07:10 +08:00
|
|
|
ListApps(tenantID, appName string, page, pageSize int) ([]*model.Application, int64, error)
|
2020-09-18 11:26:01 +08:00
|
|
|
GetAppByID(appID string) (*model.Application, error)
|
2020-09-18 18:08:32 +08:00
|
|
|
DeleteApp(appID string) error
|
2020-09-17 15:45:46 +08:00
|
|
|
}
|
|
|
|
|
2020-09-23 15:30:31 +08:00
|
|
|
//AppConfigGroupDao Application config group Dao
|
|
|
|
type AppConfigGroupDao interface {
|
2020-09-21 18:33:10 +08:00
|
|
|
Dao
|
2020-09-23 21:41:13 +08:00
|
|
|
GetConfigGroupByID(appID, configGroupName string) (*model.ApplicationConfigGroup, error)
|
2020-09-24 10:05:54 +08:00
|
|
|
GetConfigGroupsByAppID(appID string, page, pageSize int) ([]*model.ApplicationConfigGroup, int64, error)
|
2020-09-23 22:23:02 +08:00
|
|
|
DeleteConfigGroup(appID, configGroupName string) error
|
2020-09-21 18:33:10 +08:00
|
|
|
}
|
|
|
|
|
2020-09-23 15:30:31 +08:00
|
|
|
//AppConfigGroupServiceDao service config group Dao
|
|
|
|
type AppConfigGroupServiceDao interface {
|
2020-09-22 14:37:52 +08:00
|
|
|
Dao
|
2020-09-24 10:05:54 +08:00
|
|
|
GetConfigGroupServicesByID(appID, configGroupName string) ([]*model.ServiceConfigGroup, error)
|
|
|
|
DeleteConfigGroupService(appID, configGroupName string) error
|
2020-09-22 14:37:52 +08:00
|
|
|
}
|
|
|
|
|
2020-09-23 15:30:31 +08:00
|
|
|
//AppConfigGroupItemDao Application config item group Dao
|
|
|
|
type AppConfigGroupItemDao interface {
|
2020-09-22 14:37:52 +08:00
|
|
|
Dao
|
2020-09-24 10:05:54 +08:00
|
|
|
GetConfigGroupItemsByID(appID, configGroupName string) ([]*model.ConfigItem, error)
|
2020-09-24 13:06:22 +08:00
|
|
|
DeleteConfigGroupItem(appID, configGroupName string) error
|
2020-09-22 14:37:52 +08:00
|
|
|
}
|
|
|
|
|
2019-12-12 11:59:02 +08:00
|
|
|
// VolumeTypeDao volume type dao
|
|
|
|
type VolumeTypeDao interface {
|
|
|
|
Dao
|
2019-12-18 10:18:26 +08:00
|
|
|
DeleteModelByVolumeTypes(volumeType string) error
|
2019-12-12 11:59:02 +08:00
|
|
|
GetAllVolumeTypes() ([]*model.TenantServiceVolumeType, error)
|
2019-12-18 18:20:03 +08:00
|
|
|
GetAllVolumeTypesByPage(page int, pageSize int) ([]*model.TenantServiceVolumeType, error)
|
2019-12-12 11:59:02 +08:00
|
|
|
GetVolumeTypeByType(vt string) (*model.TenantServiceVolumeType, error)
|
2019-12-19 18:03:46 +08:00
|
|
|
CreateOrUpdateVolumeType(vt *model.TenantServiceVolumeType) (*model.TenantServiceVolumeType, error)
|
2019-12-12 11:59:02 +08:00
|
|
|
}
|
|
|
|
|
2017-11-07 11:40:44 +08:00
|
|
|
//LicenseDao LicenseDao
|
|
|
|
type LicenseDao interface {
|
|
|
|
Dao
|
|
|
|
//DeleteLicense(token string) error
|
|
|
|
ListLicenses() ([]*model.LicenseInfo, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
//TenantServiceDao TenantServiceDao
|
|
|
|
type TenantServiceDao interface {
|
|
|
|
Dao
|
|
|
|
GetServiceByID(serviceID string) (*model.TenantServices, error)
|
2018-08-30 17:49:54 +08:00
|
|
|
GetServiceByServiceAlias(serviceAlias string) (*model.TenantServices, error)
|
2018-08-03 15:17:10 +08:00
|
|
|
GetServiceByIDs(serviceIDs []string) ([]*model.TenantServices, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
GetServiceAliasByIDs(uids []string) ([]*model.TenantServices, error)
|
|
|
|
GetServiceByTenantIDAndServiceAlias(tenantID, serviceName string) (*model.TenantServices, error)
|
|
|
|
SetTenantServiceStatus(serviceID, status string) error
|
|
|
|
GetServicesByTenantID(tenantID string) ([]*model.TenantServices, error)
|
2018-04-26 12:46:26 +08:00
|
|
|
GetServicesByTenantIDs(tenantIDs []string) ([]*model.TenantServices, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
GetServicesAllInfoByTenantID(tenantID string) ([]*model.TenantServices, error)
|
2020-09-18 17:02:28 +08:00
|
|
|
GetServicesInfoByAppID(appID string, page, pageSize int) ([]*model.TenantServices, int64, error)
|
2020-09-19 22:06:53 +08:00
|
|
|
CountServiceByAppID(appID string) (int64, error)
|
2020-09-23 14:48:53 +08:00
|
|
|
GetServiceIDsByAppID(appID string) (re []model.ServiceID)
|
2020-09-23 15:51:34 +08:00
|
|
|
GetServicesByServiceIDs(serviceIDs []string) ([]*model.TenantServices, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
DeleteServiceByServiceID(serviceID string) error
|
2018-04-26 12:46:26 +08:00
|
|
|
GetServiceMemoryByTenantIDs(tenantIDs, serviceIDs []string) (map[string]map[string]interface{}, error)
|
2018-03-13 16:55:53 +08:00
|
|
|
GetServiceMemoryByServiceIDs(serviceIDs []string) (map[string]map[string]interface{}, error)
|
2018-05-24 09:41:47 +08:00
|
|
|
GetPagedTenantService(offset, len int, serviceIDs []string) ([]map[string]interface{}, int, error)
|
2018-06-22 12:44:20 +08:00
|
|
|
GetAllServicesID() ([]*model.TenantServices, error)
|
2018-12-04 15:09:00 +08:00
|
|
|
UpdateDeployVersion(serviceID, deployversion string) error
|
2019-02-28 11:50:54 +08:00
|
|
|
ListThirdPartyServices() ([]*model.TenantServices, error)
|
2019-11-05 11:43:10 +08:00
|
|
|
ListServicesByTenantID(tenantID string) ([]*model.TenantServices, error)
|
2020-02-18 22:41:18 +08:00
|
|
|
GetServiceTypeById(serviceID string) (*model.TenantServices, error)
|
2020-09-27 16:27:46 +08:00
|
|
|
ListByAppID(appID string) ([]*model.TenantServices, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//TenantServiceDeleteDao TenantServiceDeleteDao
|
|
|
|
type TenantServiceDeleteDao interface {
|
|
|
|
Dao
|
2018-06-14 14:32:36 +08:00
|
|
|
GetTenantServicesDeleteByCreateTime(createTime time.Time) ([]*model.TenantServicesDelete, error)
|
|
|
|
DeleteTenantServicesDelete(record *model.TenantServicesDelete) error
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//TenantServicesPortDao TenantServicesPortDao
|
|
|
|
type TenantServicesPortDao interface {
|
|
|
|
Dao
|
|
|
|
DelDao
|
|
|
|
GetPortsByServiceID(serviceID string) ([]*model.TenantServicesPort, error)
|
|
|
|
GetOuterPorts(serviceID string) ([]*model.TenantServicesPort, error)
|
|
|
|
GetInnerPorts(serviceID string) ([]*model.TenantServicesPort, error)
|
|
|
|
GetPort(serviceID string, port int) (*model.TenantServicesPort, error)
|
2019-03-09 21:54:17 +08:00
|
|
|
GetOpenedPorts(serviceID string) ([]*model.TenantServicesPort, error)
|
2019-02-25 20:04:48 +08:00
|
|
|
//GetDepUDPPort get all depend service udp port info
|
|
|
|
GetDepUDPPort(serviceID string) ([]*model.TenantServicesPort, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
DELPortsByServiceID(serviceID string) error
|
2019-02-28 11:50:54 +08:00
|
|
|
HasOpenPort(sid string) bool
|
2019-04-30 14:50:33 +08:00
|
|
|
DelByServiceID(sid string) error
|
2019-12-06 11:24:45 +08:00
|
|
|
ListInnerPortsByServiceIDs(serviceIDs []string) ([]*model.TenantServicesPort, error)
|
2020-09-27 16:27:46 +08:00
|
|
|
ListByK8sServiceNames(serviceIDs []string) ([]*model.TenantServicesPort, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//TenantPluginDao TenantPluginDao
|
|
|
|
type TenantPluginDao interface {
|
|
|
|
Dao
|
2018-01-18 13:45:24 +08:00
|
|
|
GetPluginByID(pluginID, tenantID string) (*model.TenantPlugin, error)
|
|
|
|
DeletePluginByID(pluginID, tenantID string) error
|
2017-11-07 19:11:49 +08:00
|
|
|
GetPluginsByTenantID(tenantID string) ([]*model.TenantPlugin, error)
|
2019-10-13 19:56:13 +08:00
|
|
|
ListByIDs(ids []string) ([]*model.TenantPlugin, error)
|
2019-11-05 11:43:10 +08:00
|
|
|
ListByTenantID(tenantID string) ([]*model.TenantPlugin, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//TenantPluginDefaultENVDao TenantPluginDefaultENVDao
|
|
|
|
type TenantPluginDefaultENVDao interface {
|
|
|
|
Dao
|
2017-12-12 12:52:29 +08:00
|
|
|
GetDefaultENVByName(pluginID, name, versionID string) (*model.TenantPluginDefaultENV, error)
|
|
|
|
GetDefaultENVSByPluginID(pluginID, versionID string) ([]*model.TenantPluginDefaultENV, error)
|
|
|
|
//GetDefaultENVSByPluginIDCantBeSet(pluginID string) ([]*model.TenantPluginDefaultENV, error)
|
|
|
|
DeleteDefaultENVByName(pluginID, name, versionID string) error
|
2017-11-07 11:40:44 +08:00
|
|
|
DeleteAllDefaultENVByPluginID(PluginID string) error
|
2017-12-12 12:52:29 +08:00
|
|
|
DeleteDefaultENVByPluginIDAndVersionID(pluginID, versionID string) error
|
|
|
|
GetALLMasterDefultENVs(pluginID string) ([]*model.TenantPluginDefaultENV, error)
|
|
|
|
GetDefaultEnvWhichCanBeSetByPluginID(pluginID, versionID string) ([]*model.TenantPluginDefaultENV, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//TenantPluginBuildVersionDao TenantPluginBuildVersionDao
|
|
|
|
type TenantPluginBuildVersionDao interface {
|
|
|
|
Dao
|
|
|
|
DeleteBuildVersionByVersionID(versionID string) error
|
|
|
|
DeleteBuildVersionByPluginID(pluginID string) error
|
|
|
|
GetBuildVersionByPluginID(pluginID string) ([]*model.TenantPluginBuildVersion, error)
|
|
|
|
GetBuildVersionByVersionID(pluginID, versionID string) (*model.TenantPluginBuildVersion, error)
|
2018-05-29 12:51:10 +08:00
|
|
|
GetLastBuildVersionByVersionID(pluginID, versionID string) (*model.TenantPluginBuildVersion, error)
|
|
|
|
GetBuildVersionByDeployVersion(pluginID, versionID, deployVersion string) (*model.TenantPluginBuildVersion, error)
|
2019-10-13 19:56:13 +08:00
|
|
|
ListSuccessfulOnesByPluginIDs(pluginIDs []string) ([]*model.TenantPluginBuildVersion, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//TenantPluginVersionEnvDao TenantPluginVersionEnvDao
|
|
|
|
type TenantPluginVersionEnvDao interface {
|
|
|
|
Dao
|
|
|
|
DeleteEnvByEnvName(envName, pluginID, serviceID string) error
|
|
|
|
DeleteEnvByPluginID(serviceID, pluginID string) error
|
|
|
|
DeleteEnvByServiceID(serviceID string) error
|
|
|
|
GetVersionEnvByServiceID(serviceID string, pluginID string) ([]*model.TenantPluginVersionEnv, error)
|
2019-10-13 19:56:13 +08:00
|
|
|
ListByServiceID(serviceID string) ([]*model.TenantPluginVersionEnv, error)
|
2017-11-09 18:31:31 +08:00
|
|
|
GetVersionEnvByEnvName(serviceID, pluginID, envName string) (*model.TenantPluginVersionEnv, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
2019-02-15 17:20:08 +08:00
|
|
|
//TenantPluginVersionConfigDao service plugin config that can be dynamic discovery dao interface
|
|
|
|
type TenantPluginVersionConfigDao interface {
|
|
|
|
Dao
|
|
|
|
GetPluginConfig(serviceID, pluginID string) (*model.TenantPluginVersionDiscoverConfig, error)
|
2019-03-01 15:13:14 +08:00
|
|
|
GetPluginConfigs(serviceID string) ([]*model.TenantPluginVersionDiscoverConfig, error)
|
2019-02-15 17:20:08 +08:00
|
|
|
DeletePluginConfig(serviceID, pluginID string) error
|
|
|
|
DeletePluginConfigByServiceID(serviceID string) error
|
|
|
|
}
|
|
|
|
|
2017-11-07 11:40:44 +08:00
|
|
|
//TenantServicePluginRelationDao TenantServicePluginRelationDao
|
|
|
|
type TenantServicePluginRelationDao interface {
|
|
|
|
Dao
|
|
|
|
DeleteRelationByServiceIDAndPluginID(serviceID, pluginID string) error
|
|
|
|
DeleteALLRelationByServiceID(serviceID string) error
|
|
|
|
DeleteALLRelationByPluginID(pluginID string) error
|
|
|
|
GetALLRelationByServiceID(serviceID string) ([]*model.TenantServicePluginRelation, error)
|
2017-11-07 19:11:49 +08:00
|
|
|
GetRelateionByServiceIDAndPluginID(serviceID, pluginID string) (*model.TenantServicePluginRelation, error)
|
2017-11-29 15:41:01 +08:00
|
|
|
CheckSomeModelPluginByServiceID(serviceID, pluginModel string) (bool, error)
|
2017-12-01 12:40:49 +08:00
|
|
|
CheckSomeModelLikePluginByServiceID(serviceID, pluginModel string) (bool, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//TenantServiceRelationDao TenantServiceRelationDao
|
|
|
|
type TenantServiceRelationDao interface {
|
|
|
|
Dao
|
|
|
|
DelDao
|
|
|
|
GetTenantServiceRelations(serviceID string) ([]*model.TenantServiceRelation, error)
|
2019-12-06 13:30:17 +08:00
|
|
|
ListByServiceIDs(serviceIDs []string) ([]*model.TenantServiceRelation, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
GetTenantServiceRelationsByDependServiceID(dependServiceID string) ([]*model.TenantServiceRelation, error)
|
|
|
|
HaveRelations(serviceID string) bool
|
|
|
|
DELRelationsByServiceID(serviceID string) error
|
|
|
|
DeleteRelationByDepID(serviceID, depID string) error
|
|
|
|
}
|
|
|
|
|
2017-11-30 15:03:10 +08:00
|
|
|
//TenantServicesStreamPluginPortDao TenantServicesStreamPluginPortDao
|
|
|
|
type TenantServicesStreamPluginPortDao interface {
|
|
|
|
Dao
|
2019-06-14 15:19:53 +08:00
|
|
|
GetPluginMappingPorts(serviceID string) ([]*model.TenantServicesStreamPluginPort, error)
|
2017-11-30 15:03:10 +08:00
|
|
|
SetPluginMappingPort(
|
|
|
|
tenantID string,
|
|
|
|
serviceID string,
|
|
|
|
pluginModel string,
|
|
|
|
containerPort int,
|
|
|
|
) (int, error)
|
|
|
|
DeletePluginMappingPortByContainerPort(
|
|
|
|
serviceID string,
|
|
|
|
pluginModel string,
|
|
|
|
containerPort int,
|
|
|
|
) error
|
|
|
|
DeleteAllPluginMappingPortByServiceID(serviceID string) error
|
|
|
|
GetPluginMappingPortByServiceIDAndContainerPort(
|
|
|
|
serviceID string,
|
|
|
|
pluginModel string,
|
|
|
|
containerPort int,
|
|
|
|
) (*model.TenantServicesStreamPluginPort, error)
|
2019-10-13 19:56:13 +08:00
|
|
|
ListByServiceID(sid string) ([]*model.TenantServicesStreamPluginPort, error)
|
2017-11-30 15:03:10 +08:00
|
|
|
}
|
|
|
|
|
2017-11-07 11:40:44 +08:00
|
|
|
//TenantServiceEnvVarDao TenantServiceEnvVarDao
|
|
|
|
type TenantServiceEnvVarDao interface {
|
|
|
|
Dao
|
|
|
|
DelDao
|
|
|
|
//service_id__in=sids, scope__in=("outer", "both")
|
|
|
|
GetDependServiceEnvs(serviceIDs []string, scopes []string) ([]*model.TenantServiceEnvVar, error)
|
|
|
|
GetServiceEnvs(serviceID string, scopes []string) ([]*model.TenantServiceEnvVar, error)
|
|
|
|
GetEnv(serviceID, envName string) (*model.TenantServiceEnvVar, error)
|
|
|
|
DELServiceEnvsByServiceID(serviceID string) error
|
2019-04-30 14:50:33 +08:00
|
|
|
DelByServiceIDAndScope(sid, scope string) error
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//TenantServiceMountRelationDao TenantServiceMountRelationDao
|
|
|
|
type TenantServiceMountRelationDao interface {
|
|
|
|
Dao
|
|
|
|
GetTenantServiceMountRelationsByService(serviceID string) ([]*model.TenantServiceMountRelation, error)
|
|
|
|
DElTenantServiceMountRelationByServiceAndName(serviceID, mntDir string) error
|
|
|
|
DELTenantServiceMountRelationByServiceID(serviceID string) error
|
|
|
|
DElTenantServiceMountRelationByDepService(serviceID, depServiceID string) error
|
|
|
|
}
|
|
|
|
|
|
|
|
//TenantServiceVolumeDao TenantServiceVolumeDao
|
|
|
|
type TenantServiceVolumeDao interface {
|
|
|
|
Dao
|
|
|
|
DelDao
|
|
|
|
GetTenantServiceVolumesByServiceID(serviceID string) ([]*model.TenantServiceVolume, error)
|
|
|
|
DeleteTenantServiceVolumesByServiceID(serviceID string) error
|
|
|
|
DeleteByServiceIDAndVolumePath(serviceID string, volumePath string) error
|
|
|
|
GetVolumeByServiceIDAndName(serviceID, name string) (*model.TenantServiceVolume, error)
|
2018-01-23 18:07:02 +08:00
|
|
|
GetAllVolumes() ([]*model.TenantServiceVolume, error)
|
2019-03-05 15:00:39 +08:00
|
|
|
GetVolumeByID(id int) (*model.TenantServiceVolume, error)
|
2019-04-30 14:50:33 +08:00
|
|
|
DelShareableBySID(sid string) error
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
2019-02-15 17:20:08 +08:00
|
|
|
//TenantServiceConfigFileDao tenant service config file dao interface
|
2019-01-06 22:13:19 +08:00
|
|
|
type TenantServiceConfigFileDao interface {
|
|
|
|
Dao
|
2020-04-04 19:48:37 +08:00
|
|
|
GetConfigFileByServiceID(serviceID string) ([]*model.TenantServiceConfigFile, error)
|
2019-03-06 14:06:42 +08:00
|
|
|
GetByVolumeName(sid, volumeName string) (*model.TenantServiceConfigFile, error)
|
|
|
|
DelByVolumeID(sid string, volumeName string) error
|
2019-03-16 21:34:07 +08:00
|
|
|
DelByServiceID(sid string) error
|
2019-01-06 22:13:19 +08:00
|
|
|
}
|
|
|
|
|
2017-11-07 11:40:44 +08:00
|
|
|
//TenantServiceLBMappingPortDao vs lb mapping port dao
|
|
|
|
type TenantServiceLBMappingPortDao interface {
|
|
|
|
Dao
|
|
|
|
GetTenantServiceLBMappingPort(serviceID string, containerPort int) (*model.TenantServiceLBMappingPort, error)
|
2018-11-26 11:30:58 +08:00
|
|
|
GetLBMappingPortByServiceIDAndPort(serviceID string, port int) (*model.TenantServiceLBMappingPort, error)
|
2018-05-23 11:08:44 +08:00
|
|
|
GetTenantServiceLBMappingPortByService(serviceID string) ([]*model.TenantServiceLBMappingPort, error)
|
2018-11-26 02:19:08 +08:00
|
|
|
GetLBPortsASC() ([]*model.TenantServiceLBMappingPort, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
CreateTenantServiceLBMappingPort(serviceID string, containerPort int) (*model.TenantServiceLBMappingPort, error)
|
|
|
|
DELServiceLBMappingPortByServiceID(serviceID string) error
|
2018-06-07 13:02:24 +08:00
|
|
|
DELServiceLBMappingPortByServiceIDAndPort(serviceID string, lbPort int) error
|
|
|
|
GetLBPortByTenantAndPort(tenantID string, lbport int) (*model.TenantServiceLBMappingPort, error)
|
2018-11-26 11:30:58 +08:00
|
|
|
PortExists(port int) bool
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//TenantServiceLabelDao TenantServiceLabelDao
|
|
|
|
type TenantServiceLabelDao interface {
|
|
|
|
Dao
|
|
|
|
DelDao
|
|
|
|
GetTenantServiceLabel(serviceID string) ([]*model.TenantServiceLable, error)
|
2018-02-26 17:34:27 +08:00
|
|
|
DeleteLabelByServiceID(serviceID string) error
|
2017-11-07 11:40:44 +08:00
|
|
|
GetTenantServiceNodeSelectorLabel(serviceID string) ([]*model.TenantServiceLable, error)
|
2018-12-04 11:54:43 +08:00
|
|
|
GetTenantNodeAffinityLabel(serviceID string) (*model.TenantServiceLable, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
GetTenantServiceAffinityLabel(serviceID string) ([]*model.TenantServiceLable, error)
|
|
|
|
GetTenantServiceTypeLabel(serviceID string) (*model.TenantServiceLable, error)
|
2018-12-04 15:20:59 +08:00
|
|
|
DelTenantServiceLabelsByLabelValuesAndServiceID(serviceID string) error
|
2018-12-04 17:55:45 +08:00
|
|
|
DelTenantServiceLabelsByServiceIDKey(serviceID string, labelKey string) error
|
|
|
|
DelTenantServiceLabelsByServiceIDKeyValue(serviceID string, labelKey string, labelValue string) error
|
|
|
|
GetLabelByNodeSelectorKey(serviceID string, labelValue string) (*model.TenantServiceLable, error)
|
2020-01-18 09:25:21 +08:00
|
|
|
GetPrivilegedLabel(serviceID string) (*model.TenantServiceLable, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//LocalSchedulerDao 本地调度信息
|
|
|
|
type LocalSchedulerDao interface {
|
|
|
|
Dao
|
|
|
|
GetLocalScheduler(serviceID string) ([]*model.LocalScheduler, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
//ServiceProbeDao ServiceProbeDao
|
|
|
|
type ServiceProbeDao interface {
|
|
|
|
Dao
|
|
|
|
DelDao
|
2018-11-22 14:33:29 +08:00
|
|
|
GetServiceProbes(serviceID string) ([]*model.TenantServiceProbe, error)
|
|
|
|
GetServiceUsedProbe(serviceID, mode string) (*model.TenantServiceProbe, error)
|
2017-11-07 11:40:44 +08:00
|
|
|
DELServiceProbesByServiceID(serviceID string) error
|
2019-04-30 14:50:33 +08:00
|
|
|
DelByServiceID(sid string) error
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
|
2017-11-15 15:14:34 +08:00
|
|
|
//CodeCheckResultDao CodeCheckResultDao
|
2017-11-14 18:54:27 +08:00
|
|
|
type CodeCheckResultDao interface {
|
|
|
|
Dao
|
|
|
|
GetCodeCheckResult(serviceID string) (*model.CodeCheckResult, error)
|
2019-10-29 18:36:15 +08:00
|
|
|
DeleteByServiceID(serviceID string) error
|
2017-11-14 18:54:27 +08:00
|
|
|
}
|
2017-11-15 15:14:34 +08:00
|
|
|
|
2017-11-29 15:41:01 +08:00
|
|
|
//EventDao EventDao
|
2017-11-16 16:30:22 +08:00
|
|
|
type EventDao interface {
|
|
|
|
Dao
|
|
|
|
GetEventByEventID(eventID string) (*model.ServiceEvent, error)
|
2018-02-06 14:59:21 +08:00
|
|
|
GetEventByEventIDs(eventIDs []string) ([]*model.ServiceEvent, error)
|
2017-11-16 16:30:22 +08:00
|
|
|
GetEventByServiceID(serviceID string) ([]*model.ServiceEvent, error)
|
2018-08-03 15:17:10 +08:00
|
|
|
DelEventByServiceID(serviceID string) error
|
2019-10-30 10:23:28 +08:00
|
|
|
ListByTargetID(targetID string) ([]*model.ServiceEvent, error)
|
2019-08-23 20:33:38 +08:00
|
|
|
GetEventsByTarget(target, targetID string, offset, liimt int) ([]*model.ServiceEvent, int, error)
|
|
|
|
GetEventsByTenantID(tenantID string, offset, limit int) ([]*model.ServiceEvent, int, error)
|
2019-08-24 19:02:24 +08:00
|
|
|
GetLastASyncEvent(target, targetID string) (*model.ServiceEvent, error)
|
2019-08-29 14:15:46 +08:00
|
|
|
UnfinishedEvents(target, targetID string, optTypes ...string) ([]*model.ServiceEvent, error)
|
|
|
|
LatestFailurePodEvent(podName string) (*model.ServiceEvent, error)
|
2017-11-20 17:29:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//VersionInfoDao VersionInfoDao
|
|
|
|
type VersionInfoDao interface {
|
|
|
|
Dao
|
2019-10-30 10:23:28 +08:00
|
|
|
ListSuccessfulOnes() ([]*model.VersionInfo, error)
|
2017-11-20 17:29:39 +08:00
|
|
|
GetVersionByEventID(eventID string) (*model.VersionInfo, error)
|
2017-12-12 12:52:29 +08:00
|
|
|
GetVersionByDeployVersion(version, serviceID string) (*model.VersionInfo, error)
|
2017-11-24 11:21:51 +08:00
|
|
|
GetVersionByServiceID(serviceID string) ([]*model.VersionInfo, error)
|
2019-06-24 18:09:50 +08:00
|
|
|
GetLatestScsVersion(sid string) (*model.VersionInfo, error)
|
2019-01-25 14:00:26 +08:00
|
|
|
GetAllVersionByServiceID(serviceID string) ([]*model.VersionInfo, error)
|
2017-11-30 11:35:22 +08:00
|
|
|
DeleteVersionByEventID(eventID string) error
|
2018-05-28 12:18:29 +08:00
|
|
|
DeleteVersionByServiceID(serviceID string) error
|
2019-02-15 17:20:08 +08:00
|
|
|
GetVersionInfo(timePoint time.Time, serviceIDList []string) ([]*model.VersionInfo, error)
|
2018-06-08 14:44:27 +08:00
|
|
|
DeleteVersionInfo(obj *model.VersionInfo) error
|
2019-02-15 17:20:08 +08:00
|
|
|
DeleteFailureVersionInfo(timePoint time.Time, status string, serviceIDList []string) error
|
2018-06-08 16:49:49 +08:00
|
|
|
SearchVersionInfo() ([]*model.VersionInfo, error)
|
2017-11-29 15:41:01 +08:00
|
|
|
}
|
2017-12-03 19:11:16 +08:00
|
|
|
|
|
|
|
//RegionUserInfoDao UserRegionInfoDao
|
|
|
|
type RegionUserInfoDao interface {
|
|
|
|
Dao
|
|
|
|
GetALLTokenInValidityPeriod() ([]*model.RegionUserInfo, error)
|
|
|
|
GetTokenByEid(eid string) (*model.RegionUserInfo, error)
|
2018-04-20 14:34:29 +08:00
|
|
|
GetTokenByTokenID(token string) (*model.RegionUserInfo, error)
|
2017-12-03 19:11:16 +08:00
|
|
|
}
|
2017-12-07 09:56:08 +08:00
|
|
|
|
|
|
|
//RegionAPIClassDao RegionAPIClassDao
|
|
|
|
type RegionAPIClassDao interface {
|
|
|
|
Dao
|
|
|
|
GetPrefixesByClass(apiClass string) ([]*model.RegionAPIClass, error)
|
|
|
|
DeletePrefixInClass(apiClass, prefix string) error
|
|
|
|
}
|
2018-01-02 18:02:08 +08:00
|
|
|
|
|
|
|
//RegionProcotolsDao RegionProcotolsDao
|
|
|
|
type RegionProcotolsDao interface {
|
|
|
|
Dao
|
|
|
|
GetAllSupportProtocol(version string) ([]*model.RegionProcotols, error)
|
|
|
|
GetProtocolGroupByProtocolChild(version, protocolChild string) (*model.RegionProcotols, error)
|
|
|
|
}
|
2018-05-11 13:44:15 +08:00
|
|
|
|
|
|
|
//NotificationEventDao NotificationEventDao
|
|
|
|
type NotificationEventDao interface {
|
|
|
|
Dao
|
|
|
|
GetNotificationEventByHash(hash string) (*model.NotificationEvent, error)
|
|
|
|
GetNotificationEventByKind(kind, kindID string) ([]*model.NotificationEvent, error)
|
|
|
|
GetNotificationEventByTime(start, end time.Time) ([]*model.NotificationEvent, error)
|
|
|
|
GetNotificationEventNotHandle() ([]*model.NotificationEvent, error)
|
|
|
|
}
|
2018-05-23 11:08:44 +08:00
|
|
|
|
|
|
|
//AppBackupDao group app backup history
|
|
|
|
type AppBackupDao interface {
|
|
|
|
Dao
|
|
|
|
CheckHistory(groupID, version string) bool
|
|
|
|
GetAppBackups(groupID string) ([]*model.AppBackup, error)
|
|
|
|
DeleteAppBackup(backupID string) error
|
|
|
|
GetAppBackup(backupID string) (*model.AppBackup, error)
|
2018-06-07 13:18:53 +08:00
|
|
|
GetDeleteAppBackup(backupID string) (*model.AppBackup, error)
|
|
|
|
GetDeleteAppBackups() ([]*model.AppBackup, error)
|
2018-05-23 11:08:44 +08:00
|
|
|
}
|
2018-11-14 23:08:30 +08:00
|
|
|
|
|
|
|
//ServiceSourceDao service source dao
|
|
|
|
type ServiceSourceDao interface {
|
|
|
|
Dao
|
|
|
|
GetServiceSource(serviceID string) ([]*model.ServiceSourceConfig, error)
|
|
|
|
}
|
2018-11-18 11:53:11 +08:00
|
|
|
|
|
|
|
// CertificateDao -
|
|
|
|
type CertificateDao interface {
|
|
|
|
Dao
|
2018-11-29 18:12:26 +08:00
|
|
|
AddOrUpdate(mo model.Interface) error
|
2018-11-18 11:53:11 +08:00
|
|
|
GetCertificateByID(certificateID string) (*model.Certificate, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
// RuleExtensionDao -
|
|
|
|
type RuleExtensionDao interface {
|
|
|
|
Dao
|
2018-11-21 17:15:40 +08:00
|
|
|
GetRuleExtensionByRuleID(ruleID string) ([]*model.RuleExtension, error)
|
|
|
|
DeleteRuleExtensionByRuleID(ruleID string) error
|
2018-11-18 11:53:11 +08:00
|
|
|
}
|
|
|
|
|
2018-11-26 20:37:50 +08:00
|
|
|
// HTTPRuleDao -
|
|
|
|
type HTTPRuleDao interface {
|
2018-11-18 11:53:11 +08:00
|
|
|
Dao
|
2019-02-15 17:20:08 +08:00
|
|
|
GetHTTPRuleByID(id string) (*model.HTTPRule, error)
|
|
|
|
GetHTTPRuleByServiceIDAndContainerPort(serviceID string, containerPort int) ([]*model.HTTPRule, error)
|
2020-03-10 23:46:20 +08:00
|
|
|
GetHTTPRulesByCertificateID(certificateID string) ([]*model.HTTPRule, error)
|
2019-02-15 17:20:08 +08:00
|
|
|
DeleteHTTPRuleByID(id string) error
|
|
|
|
DeleteHTTPRuleByServiceID(serviceID string) error
|
2018-12-28 12:33:37 +08:00
|
|
|
ListByServiceID(serviceID string) ([]*model.HTTPRule, error)
|
2019-12-10 17:56:47 +08:00
|
|
|
ListByCertID(certID string) ([]*model.HTTPRule, error)
|
2018-11-18 11:53:11 +08:00
|
|
|
}
|
|
|
|
|
2018-11-26 20:37:50 +08:00
|
|
|
// TCPRuleDao -
|
|
|
|
type TCPRuleDao interface {
|
2018-11-18 11:53:11 +08:00
|
|
|
Dao
|
2019-02-15 17:20:08 +08:00
|
|
|
GetTCPRuleByServiceIDAndContainerPort(serviceID string, containerPort int) ([]*model.TCPRule, error)
|
|
|
|
GetTCPRuleByID(id string) (*model.TCPRule, error)
|
2019-03-16 21:34:07 +08:00
|
|
|
GetTCPRuleByServiceID(sid string) ([]*model.TCPRule, error)
|
|
|
|
DeleteByID(uuid string) error
|
2019-02-15 17:20:08 +08:00
|
|
|
DeleteTCPRuleByServiceID(serviceID string) error
|
2018-12-28 12:33:37 +08:00
|
|
|
ListByServiceID(serviceID string) ([]*model.TCPRule, error)
|
2019-09-18 17:56:52 +08:00
|
|
|
GetUsedPortsByIP(ip string) ([]*model.TCPRule, error)
|
2019-01-07 18:26:18 +08:00
|
|
|
}
|
2019-02-24 05:13:54 +08:00
|
|
|
|
2019-03-01 14:27:03 +08:00
|
|
|
// EndpointsDao is an interface for defining method
|
2019-02-24 05:13:54 +08:00
|
|
|
// for operating table 3rd_party_svc_endpoints.
|
|
|
|
type EndpointsDao interface {
|
|
|
|
Dao
|
|
|
|
GetByUUID(uuid string) (*model.Endpoint, error)
|
|
|
|
DelByUUID(uuid string) error
|
2019-02-28 11:50:54 +08:00
|
|
|
List(sid string) ([]*model.Endpoint, error)
|
|
|
|
ListIsOnline(sid string) ([]*model.Endpoint, error)
|
2019-03-16 21:34:07 +08:00
|
|
|
DeleteByServiceID(sid string) error
|
2019-02-24 21:10:13 +08:00
|
|
|
}
|
|
|
|
|
2019-02-28 11:50:54 +08:00
|
|
|
// ThirdPartySvcDiscoveryCfgDao is an interface for defining method
|
2019-02-25 01:07:37 +08:00
|
|
|
// for operating table 3rd_party_svc_discovery_cfg.
|
2019-02-28 11:50:54 +08:00
|
|
|
type ThirdPartySvcDiscoveryCfgDao interface {
|
2019-02-25 01:07:37 +08:00
|
|
|
Dao
|
2019-02-28 11:50:54 +08:00
|
|
|
GetByServiceID(sid string) (*model.ThirdPartySvcDiscoveryCfg, error)
|
2019-03-16 21:34:07 +08:00
|
|
|
DeleteByServiceID(sid string) error
|
2019-02-28 11:50:54 +08:00
|
|
|
}
|
2019-03-11 01:07:10 +08:00
|
|
|
|
|
|
|
// GwRuleConfigDao is the interface that wraps the required methods to execute
|
|
|
|
// curd for table gateway_rule_config.
|
|
|
|
type GwRuleConfigDao interface {
|
|
|
|
Dao
|
|
|
|
DeleteByRuleID(rid string) error
|
2019-03-13 14:40:30 +08:00
|
|
|
ListByRuleID(rid string) ([]*model.GwRuleConfig, error)
|
2019-03-11 01:07:10 +08:00
|
|
|
}
|
2019-11-13 11:05:25 +08:00
|
|
|
|
|
|
|
// TenantServceAutoscalerRulesDao -
|
|
|
|
type TenantServceAutoscalerRulesDao interface {
|
|
|
|
Dao
|
|
|
|
GetByRuleID(ruleID string) (*model.TenantServiceAutoscalerRules, error)
|
|
|
|
ListByServiceID(serviceID string) ([]*model.TenantServiceAutoscalerRules, error)
|
2019-11-13 18:48:51 +08:00
|
|
|
ListEnableOnesByServiceID(serviceID string) ([]*model.TenantServiceAutoscalerRules, error)
|
2019-11-13 11:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// TenantServceAutoscalerRuleMetricsDao -
|
|
|
|
type TenantServceAutoscalerRuleMetricsDao interface {
|
|
|
|
Dao
|
|
|
|
UpdateOrCreate(metric *model.TenantServiceAutoscalerRuleMetrics) error
|
|
|
|
ListByRuleID(ruleID string) ([]*model.TenantServiceAutoscalerRuleMetrics, error)
|
2019-11-28 17:21:05 +08:00
|
|
|
DeleteByRuleID(ruldID string) error
|
2019-11-13 11:05:25 +08:00
|
|
|
}
|
2019-11-14 15:30:40 +08:00
|
|
|
|
|
|
|
// TenantServiceScalingRecordsDao -
|
|
|
|
type TenantServiceScalingRecordsDao interface {
|
2019-11-21 15:14:09 +08:00
|
|
|
Dao
|
2019-11-14 15:30:40 +08:00
|
|
|
UpdateOrCreate(new *model.TenantServiceScalingRecords) error
|
|
|
|
ListByServiceID(serviceID string, offset, limit int) ([]*model.TenantServiceScalingRecords, error)
|
|
|
|
CountByServiceID(serviceID string) (int, error)
|
|
|
|
}
|
2020-09-19 17:17:28 +08:00
|
|
|
|
|
|
|
// TenantServiceMonitorDao -
|
|
|
|
type TenantServiceMonitorDao interface {
|
|
|
|
Dao
|
|
|
|
GetByName(serviceID, name string) (*model.TenantServiceMonitor, error)
|
|
|
|
GetByServiceID(serviceID string) ([]*model.TenantServiceMonitor, error)
|
|
|
|
DeleteServiceMonitor(mo *model.TenantServiceMonitor) error
|
|
|
|
DeleteServiceMonitorByServiceID(serviceID string) error
|
|
|
|
}
|