Documentation ¶
Index ¶
- Variables
- type AppSvr
- func (t *AppSvr) CloneOrFetchRepository(app *AppEntity, checkout string, isBranch ...bool) (string, error)
- func (t *AppSvr) CreateAndInitEnvCluster(entity *AppEntity) (int64, error)
- func (t *AppSvr) CreateByEntity(entity *AppEntity) (int64, error)
- func (t *AppSvr) DeleteById(id int64) error
- func (t *AppSvr) GetAppIdsByProjectId(projectId int64) ([]int64, error)
- func (t *AppSvr) GetBranchesByAppId(appId int64) ([]string, error)
- func (t *AppSvr) GetById(id int64) (*AppEntity, error)
- func (t *AppSvr) GetByIds(ids []int64) (map[int64]AppEntity, error)
- func (t *AppSvr) GetByName(name string) (*AppEntity, error)
- func (t *AppSvr) GetGitClientByApp(app *AppEntity) (*git.Client, error)
- func (t *AppSvr) InitTemporaryWorkspaceForBuild(repoWorkspaces, tempBuildPath string) ([]byte, error)
- func (t *AppSvr) IsExist(name string, excludeId ...int64) (bool, error)
- func (t *AppSvr) ListAllByProjectId(projectId int64) ([]AppEntity, error)
- func (t *AppSvr) PackVersionPackage(buildId int64, branch, commit string, app *AppEntity) ([]byte, string, string, error)
- func (t *AppSvr) RunBuild(buildWorkspace string, cmdBuild string, timeout int) ([]byte, error)
- func (t *AppSvr) UpdateById(id int64, params dbx.Params) error
- type AuditSvr
- func (t *AuditSvr) FullFillList(list []AuditEntity, uid int64) ([]map[string]interface{}, error)
- func (t *AuditSvr) GetByProjectIdsAndStatus(projectIds []int64, status []int, page, pagesize int, datetime ...string) ([]AuditEntity, error)
- func (t *AuditSvr) GetByUid(uid int64, page, pagesize int) ([]AuditEntity, error)
- func (t *AuditSvr) GetCountByProjectIdsAndStatus(projectIds []int64, status []int, datetime ...string) (int, error)
- func (t *AuditSvr) GetCountByUid(uid int64) (int, error)
- func (t *AuditSvr) UpdateStatusById(id int64, status int, auditUid int64) error
- type BaseSvr
- type BuildSvr
- func (t *BuildSvr) CountByAppIds(appIds []int64) (int, error)
- func (t *BuildSvr) Create(uid, appId int64, branch string) (int64, error)
- func (t *BuildSvr) DealBuild(entity *BuildEntity) error
- func (t *BuildSvr) GetById(id int64) (*BuildEntity, error)
- func (t *BuildSvr) GetWaitToBuilds(seconds int64) ([]BuildEntity, error)
- func (t *BuildSvr) GetWaitToNotifyList() ([]BuildEntity, error)
- func (t *BuildSvr) ListDetailPageByAppIds(appIds []int64, page, pagesize int) ([]map[string]interface{}, error)
- func (t *BuildSvr) ListPageByAppId(appIds []int64, page, pagesize int) ([]BuildEntity, error)
- func (t *BuildSvr) UpdatePushSuccAndInsertPkg(build *BuildEntity, packageName string) error
- type ClusterSvr
- func (t *ClusterSvr) CreateByEntity(entity *ClusterEntity) (int64, error)
- func (t *ClusterSvr) GetByEnvIds(envIds []int64) (map[int64][]ClusterEntity, error)
- func (t *ClusterSvr) GetById(id int64) (*ClusterEntity, error)
- func (t *ClusterSvr) GetByIds(ids []int64) (map[int64]ClusterEntity, error)
- func (t *ClusterSvr) GetByName(appId int64, name string) (*ClusterEntity, error)
- func (t *ClusterSvr) IsExist(appId int64, name string, excludeId ...int64) (bool, error)
- func (t *ClusterSvr) ListByEnvId(envId int64) ([]ClusterEntity, error)
- type ConsumeTimer
- type DeploymentSvr
- func (t *DeploymentSvr) CountByAppIds(appIds []int64) (int, error)
- func (t *DeploymentSvr) CreateAndInitJob(entity *DeploymentEntity) (int64, error)
- func (t *DeploymentSvr) GetByIds(ids []int64) (map[int64]DeploymentEntity, error)
- func (t *DeploymentSvr) ListPageDetailByAppIds(appIds []int64, page, pagesize int) ([]map[string]interface{}, error)
- func (t *DeploymentSvr) TryUpdateDeploymentStatus(id int64) error
- type EnvSvr
- func (t *EnvSvr) CreateAndInitDefaultCluster(entity *EnvEntity) (int64, error)
- func (t *EnvSvr) CreateByEntity(entity *EnvEntity) (int64, error)
- func (t *EnvSvr) GetByAppIds(appIds []int64) (map[int64][]EnvEntity, error)
- func (t *EnvSvr) GetById(id int64) (*EnvEntity, error)
- func (t *EnvSvr) GetByIds(ids []int64) (map[int64]EnvEntity, error)
- func (t *EnvSvr) GetByName(appId int64, name string) (*EnvEntity, error)
- func (t *EnvSvr) IsExist(appId int64, name string, excludeId ...int64) (bool, error)
- func (t *EnvSvr) ListAllByAppId(appId int64) ([]EnvEntity, error)
- type JobFlow
- type JobStepSvr
- type JobSvr
- type MemberSvr
- func (t *MemberSvr) Add(projectId, uid, projectRoleId int64) (int64, error)
- func (t *MemberSvr) DeleteById(id int64) error
- func (t *MemberSvr) GetAllByProjectId(projectId int64) ([]MemberEntity, error)
- func (t *MemberSvr) GetAllByUid(uid int64) ([]MemberEntity, error)
- func (t *MemberSvr) GetAllDetailByProjectId(projectId int64) ([]map[string]interface{}, error)
- func (t *MemberSvr) GetByProjectIdUid(projectId, uid int64) (*MemberEntity, error)
- func (t *MemberSvr) GetByProjectIdsAndUid(projectIds []int64, uid int64) ([]MemberEntity, error)
- func (t *MemberSvr) GetProjectIdsByUid(uid int64) ([]int64, error)
- func (t *MemberSvr) GetProjectPermAuditByProjectIdsUid(projectIds []int64, uid int64) (map[int64]bool, error)
- func (t *MemberSvr) HasAllPermission(uid, projectId int64) bool
- func (t *MemberSvr) HasBasePermission(uid, projectId int64) bool
- func (t *MemberSvr) HasMediumPermission(uid, projectId int64) bool
- func (t *MemberSvr) IsExist(projectId, uid int64) (bool, error)
- func (t *MemberSvr) UpdateById(id int64, params dbx.Params) error
- type NotifyItem
- type NotifySvr
- type PkgSvr
- type ProjectRolePermSvr
- func (t *ProjectRolePermSvr) BatchUpdate(projectRoleId int64, projectRoleName string, perms []string) error
- func (t *ProjectRolePermSvr) Create(projectRoleId int64, perm string) (int64, error)
- func (t *ProjectRolePermSvr) CreateProjectRoleAndBindPerms(projectRoleName string, perms []string) error
- func (t *ProjectRolePermSvr) DeleteById(id int64) error
- func (t *ProjectRolePermSvr) GetAllProjectRoleIdMap() (map[int64][]ProjectRolePermEntity, error)
- func (t *ProjectRolePermSvr) GetById(id int64) (*ProjectRolePermEntity, error)
- func (t *ProjectRolePermSvr) GetByProjectRoleIdPerm(projectRoleId int64, perm string) (*ProjectRolePermEntity, error)
- func (t *ProjectRolePermSvr) IsExist(projectRoleId int64, perm string) (bool, error)
- func (t *ProjectRolePermSvr) ListAll(projectRoleId ...int64) ([]ProjectRolePermEntity, error)
- type ProjectRoleSvr
- func (t *ProjectRoleSvr) Create(name string) (int64, error)
- func (t *ProjectRoleSvr) DeleteById(id int64) error
- func (t *ProjectRoleSvr) GetById(id int64) (*ProjectRoleEntity, error)
- func (t *ProjectRoleSvr) GetByName(name string) (*ProjectRoleEntity, error)
- func (t *ProjectRoleSvr) IsExist(name string, excludeId ...int64) (bool, error)
- func (t *ProjectRoleSvr) ListAll() ([]ProjectRoleEntity, error)
- func (t *ProjectRoleSvr) ListMapAll() (map[int64]ProjectRoleEntity, error)
- type ProjectSvr
- func (t *ProjectSvr) Create(uid int64, name, description string) (int64, error)
- func (t *ProjectSvr) DeleteById(id int64) error
- func (t *ProjectSvr) GetById(id int64) (*ProjectEntity, error)
- func (t *ProjectSvr) GetByIds(ids []int64) (map[int64]ProjectEntity, error)
- func (t *ProjectSvr) GetByName(name string) (*ProjectEntity, error)
- func (t *ProjectSvr) IsExist(name string, excludeId ...int64) (bool, error)
- func (t *ProjectSvr) ListAllByUid(uid int64) ([]ProjectEntity, error)
- type SystemSvr
- type UserSvr
- func (t *UserSvr) GetAll() ([]UserEntity, error)
- func (t *UserSvr) GetById(id int64) (*UserEntity, error)
- func (t *UserSvr) GetByUids(uids []int64) (map[int64]UserEntity, error)
- func (t *UserSvr) GetByUsername(username string) (*UserEntity, error)
- func (t *UserSvr) GetByUsernamePassword(username, password string) (*UserEntity, error)
- func (t *UserSvr) Register(username, email, password string) (int64, error)
Constants ¶
This section is empty.
Variables ¶
var DefaultAppSvr = new(AppSvr)
var DefaultAuditSvr = new(AuditSvr)
var DefaultBuildSvr = new(BuildSvr)
var DefaultClusterSvr = new(ClusterSvr)
var DefaultDeploymentSvr = new(DeploymentSvr)
var DefaultEnvSvr = new(EnvSvr)
var DefaultJobStepSvr = new(JobStepSvr)
var DefaultJobSvr = new(JobSvr)
var DefaultMemberSvr = new(MemberSvr)
var (
DefaultNotifySvr = new(NotifySvr)
)
var DefaultPkgSvr = new(PkgSvr)
var DefaultProjectRolePermSvr = new(ProjectRolePermSvr)
var DefaultProjectRoleSvr = new(ProjectRoleSvr)
var DefaultProjectSvr = new(ProjectSvr)
var (
DefaultSystemSvr = new(SystemSvr)
)
var DefaultUserSvr = new(UserSvr)
Functions ¶
This section is empty.
Types ¶
type AppSvr ¶
type AppSvr struct{}
func (*AppSvr) CloneOrFetchRepository ¶
func (t *AppSvr) CloneOrFetchRepository(app *AppEntity, checkout string, isBranch ...bool) (string, error)
clone or fetch repository if repository hasn't been clone, clone it from repo_url into repo_workspace. if it already has been cloned, fetch (update) repository.
func (*AppSvr) CreateAndInitEnvCluster ¶
create app and init env and cluster for app
func (*AppSvr) CreateByEntity ¶
func (*AppSvr) DeleteById ¶
func (*AppSvr) GetAppIdsByProjectId ¶
func (*AppSvr) GetBranchesByAppId ¶
func (*AppSvr) GetGitClientByApp ¶
func (*AppSvr) InitTemporaryWorkspaceForBuild ¶
func (*AppSvr) ListAllByProjectId ¶
func (*AppSvr) PackVersionPackage ¶
func (t *AppSvr) PackVersionPackage(buildId int64, branch, commit string, app *AppEntity) ([]byte, string, string, error)
pack version package and save to local package path
func (*AppSvr) UpdateById ¶
type AuditSvr ¶
type AuditSvr struct{}
func (*AuditSvr) FullFillList ¶
func (*AuditSvr) GetByProjectIdsAndStatus ¶
func (*AuditSvr) GetCountByProjectIdsAndStatus ¶
type BuildSvr ¶
type BuildSvr struct { }
func (*BuildSvr) GetWaitToBuilds ¶
get build tasks created nearly n seconds and status = BUILD_STATUS_CREATED
func (*BuildSvr) GetWaitToNotifyList ¶
get builds which are waiting to notify
func (*BuildSvr) ListDetailPageByAppIds ¶
func (*BuildSvr) ListPageByAppId ¶
func (*BuildSvr) UpdatePushSuccAndInsertPkg ¶
update package push success and insert package record
type ClusterSvr ¶
type ClusterSvr struct{}
func (*ClusterSvr) CreateByEntity ¶
func (t *ClusterSvr) CreateByEntity(entity *ClusterEntity) (int64, error)
func (*ClusterSvr) GetByEnvIds ¶
func (t *ClusterSvr) GetByEnvIds(envIds []int64) (map[int64][]ClusterEntity, error)
func (*ClusterSvr) GetById ¶
func (t *ClusterSvr) GetById(id int64) (*ClusterEntity, error)
func (*ClusterSvr) GetByIds ¶
func (t *ClusterSvr) GetByIds(ids []int64) (map[int64]ClusterEntity, error)
func (*ClusterSvr) GetByName ¶
func (t *ClusterSvr) GetByName(appId int64, name string) (*ClusterEntity, error)
func (*ClusterSvr) ListByEnvId ¶
func (t *ClusterSvr) ListByEnvId(envId int64) ([]ClusterEntity, error)
type ConsumeTimer ¶
type ConsumeTimer struct {
// contains filtered or unexported fields
}
func NewConsumeTimer ¶
func NewConsumeTimer(jobFlow *JobFlow, step int) *ConsumeTimer
type DeploymentSvr ¶
type DeploymentSvr struct{}
func (*DeploymentSvr) CountByAppIds ¶
func (t *DeploymentSvr) CountByAppIds(appIds []int64) (int, error)
func (*DeploymentSvr) CreateAndInitJob ¶
func (t *DeploymentSvr) CreateAndInitJob(entity *DeploymentEntity) (int64, error)
create deployment and init deployment jobs
func (*DeploymentSvr) GetByIds ¶
func (t *DeploymentSvr) GetByIds(ids []int64) (map[int64]DeploymentEntity, error)
func (*DeploymentSvr) ListPageDetailByAppIds ¶
func (t *DeploymentSvr) ListPageDetailByAppIds(appIds []int64, page, pagesize int) ([]map[string]interface{}, error)
func (*DeploymentSvr) TryUpdateDeploymentStatus ¶
func (t *DeploymentSvr) TryUpdateDeploymentStatus(id int64) error
@TODO try to update deployment status
type EnvSvr ¶
type EnvSvr struct{}
func (*EnvSvr) CreateAndInitDefaultCluster ¶
func (*EnvSvr) CreateByEntity ¶
func (*EnvSvr) GetByAppIds ¶
func (*EnvSvr) ListAllByAppId ¶
type JobFlow ¶
type JobFlow struct { Deploy *DeploymentEntity Job *JobEntity App *AppEntity }
Deploy job flow
func NewJobFlow ¶
func NewJobFlow(deploy *DeploymentEntity, job *JobEntity, app *AppEntity) *JobFlow
type JobStepSvr ¶
type JobStepSvr struct{}
func (*JobStepSvr) CreateByJob ¶
func (t *JobStepSvr) CreateByJob(job *JobEntity, step int) (int64, error)
func (*JobStepSvr) GetByJobId ¶
func (t *JobStepSvr) GetByJobId(jobId int64) ([]JobStepEntity, error)
func (*JobStepSvr) UpdateByJobIdStep ¶
func (t *JobStepSvr) UpdateByJobIdStep(jobId int64, step int, params dbx.Params) error
type JobSvr ¶
type JobSvr struct{}
func (*JobSvr) DealJob ¶
func (t *JobSvr) DealJob(job *JobEntity)
deal deploy jobs which status = JOB_STATUS_READY
func (*JobSvr) GetByDeploymentIds ¶
func (*JobSvr) GetWaitToJobs ¶
get deploy tasks created nearly n seconds and status = DEPLOYMENT_STATUS_CREATED
type MemberSvr ¶
type MemberSvr struct { }
func (*MemberSvr) DeleteById ¶
func (*MemberSvr) GetAllByProjectId ¶
func (*MemberSvr) GetAllByUid ¶
func (*MemberSvr) GetAllDetailByProjectId ¶
get all members with member related info, e.g: user's detail and project role info
func (*MemberSvr) GetByProjectIdUid ¶
func (*MemberSvr) GetByProjectIdsAndUid ¶
func (*MemberSvr) GetProjectIdsByUid ¶
func (*MemberSvr) GetProjectPermAuditByProjectIdsUid ¶
func (*MemberSvr) HasAllPermission ¶
MediumPermission, e.g: Developer [project] 1. View project detail 2. Modify project info [app] 1. View apps / environments / clusters / deployments 2. Edit apps / environments / clusters / deployments 3. Add apps / environments / clusters / deployments 4. Delete apps / environments / clusters / deployments 5. Deploy apps 6. Config whether the app's environment need to be audited 7. Deployment audit
func (*MemberSvr) HasBasePermission ¶
BasePermission, e.g: Tester [project] 1. View project detail [app] 1. View apps / environments / clusters / deployments 2. Deploy apps
func (*MemberSvr) HasMediumPermission ¶
MediumPermission, e.g: Developer [project] 1. View project detail [app] 1. View apps / environments / clusters / deployments 2. Edit apps / environments / clusters / deployments 3. Add apps / environments / clusters / deployments 4. Deploy apps
func (*MemberSvr) UpdateById ¶
type NotifyItem ¶
notify item in chan queue
type NotifySvr ¶
type NotifySvr struct{}
func (*NotifySvr) CommitNotify ¶
func (t *NotifySvr) CommitNotify(notify *NotifyItem)
func (*NotifySvr) CommitNotifyByUid ¶
type ProjectRolePermSvr ¶
type ProjectRolePermSvr struct { }
func (*ProjectRolePermSvr) BatchUpdate ¶
func (t *ProjectRolePermSvr) BatchUpdate(projectRoleId int64, projectRoleName string, perms []string) error
Batch update project_role_id perms transaction operations: 1. delete all old records 2. insert all new records
func (*ProjectRolePermSvr) Create ¶
func (t *ProjectRolePermSvr) Create(projectRoleId int64, perm string) (int64, error)
func (*ProjectRolePermSvr) CreateProjectRoleAndBindPerms ¶
func (t *ProjectRolePermSvr) CreateProjectRoleAndBindPerms(projectRoleName string, perms []string) error
create project role and bind role permissions with transaction
func (*ProjectRolePermSvr) DeleteById ¶
func (t *ProjectRolePermSvr) DeleteById(id int64) error
func (*ProjectRolePermSvr) GetAllProjectRoleIdMap ¶
func (t *ProjectRolePermSvr) GetAllProjectRoleIdMap() (map[int64][]ProjectRolePermEntity, error)
func (*ProjectRolePermSvr) GetById ¶
func (t *ProjectRolePermSvr) GetById(id int64) (*ProjectRolePermEntity, error)
func (*ProjectRolePermSvr) GetByProjectRoleIdPerm ¶
func (t *ProjectRolePermSvr) GetByProjectRoleIdPerm(projectRoleId int64, perm string) (*ProjectRolePermEntity, error)
func (*ProjectRolePermSvr) IsExist ¶
func (t *ProjectRolePermSvr) IsExist(projectRoleId int64, perm string) (bool, error)
func (*ProjectRolePermSvr) ListAll ¶
func (t *ProjectRolePermSvr) ListAll(projectRoleId ...int64) ([]ProjectRolePermEntity, error)
type ProjectRoleSvr ¶
type ProjectRoleSvr struct { }
func (*ProjectRoleSvr) DeleteById ¶
func (t *ProjectRoleSvr) DeleteById(id int64) error
func (*ProjectRoleSvr) GetById ¶
func (t *ProjectRoleSvr) GetById(id int64) (*ProjectRoleEntity, error)
func (*ProjectRoleSvr) GetByName ¶
func (t *ProjectRoleSvr) GetByName(name string) (*ProjectRoleEntity, error)
func (*ProjectRoleSvr) IsExist ¶
func (t *ProjectRoleSvr) IsExist(name string, excludeId ...int64) (bool, error)
func (*ProjectRoleSvr) ListAll ¶
func (t *ProjectRoleSvr) ListAll() ([]ProjectRoleEntity, error)
func (*ProjectRoleSvr) ListMapAll ¶
func (t *ProjectRoleSvr) ListMapAll() (map[int64]ProjectRoleEntity, error)
list all project roles with map[project_role_id]ProjectRoleEntity
type ProjectSvr ¶
type ProjectSvr struct { }
func (*ProjectSvr) Create ¶
func (t *ProjectSvr) Create(uid int64, name, description string) (int64, error)
Create project and member relation with transaction
func (*ProjectSvr) DeleteById ¶
func (t *ProjectSvr) DeleteById(id int64) error
func (*ProjectSvr) GetById ¶
func (t *ProjectSvr) GetById(id int64) (*ProjectEntity, error)
func (*ProjectSvr) GetByIds ¶
func (t *ProjectSvr) GetByIds(ids []int64) (map[int64]ProjectEntity, error)
func (*ProjectSvr) GetByName ¶
func (t *ProjectSvr) GetByName(name string) (*ProjectEntity, error)
func (*ProjectSvr) IsExist ¶
func (t *ProjectSvr) IsExist(name string, excludeId ...int64) (bool, error)
func (*ProjectSvr) ListAllByUid ¶
func (t *ProjectSvr) ListAllByUid(uid int64) ([]ProjectEntity, error)
type SystemSvr ¶
type SystemSvr struct{}
func (*SystemSvr) Get ¶
func (t *SystemSvr) Get() *entities.SystemEntity
@TODO reset system while change system configuration
type UserSvr ¶
type UserSvr struct { }