svrs

package
v0.0.0-...-53d016b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAppSvr = new(AppSvr)
View Source
var DefaultAuditSvr = new(AuditSvr)
View Source
var DefaultBuildSvr = new(BuildSvr)
View Source
var DefaultClusterSvr = new(ClusterSvr)
View Source
var DefaultDeploymentSvr = new(DeploymentSvr)
View Source
var DefaultEnvSvr = new(EnvSvr)
View Source
var DefaultJobStepSvr = new(JobStepSvr)
View Source
var DefaultJobSvr = new(JobSvr)
View Source
var DefaultMemberSvr = new(MemberSvr)
View Source
var (
	DefaultNotifySvr = new(NotifySvr)
)
View Source
var DefaultPkgSvr = new(PkgSvr)
View Source
var DefaultProjectRolePermSvr = new(ProjectRolePermSvr)
View Source
var DefaultProjectRoleSvr = new(ProjectRoleSvr)
View Source
var DefaultProjectSvr = new(ProjectSvr)
View Source
var (
	DefaultSystemSvr = new(SystemSvr)
)
View Source
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

func (t *AppSvr) CreateAndInitEnvCluster(entity *AppEntity) (int64, error)

create app and init env and cluster for app

func (*AppSvr) CreateByEntity

func (t *AppSvr) CreateByEntity(entity *AppEntity) (int64, error)

func (*AppSvr) DeleteById

func (t *AppSvr) DeleteById(id int64) error

func (*AppSvr) GetAppIdsByProjectId

func (t *AppSvr) GetAppIdsByProjectId(projectId int64) ([]int64, error)

func (*AppSvr) GetBranchesByAppId

func (t *AppSvr) GetBranchesByAppId(appId int64) ([]string, error)

func (*AppSvr) GetById

func (t *AppSvr) GetById(id int64) (*AppEntity, error)

func (*AppSvr) GetByIds

func (t *AppSvr) GetByIds(ids []int64) (map[int64]AppEntity, error)

func (*AppSvr) GetByName

func (t *AppSvr) GetByName(name string) (*AppEntity, error)

func (*AppSvr) GetGitClientByApp

func (t *AppSvr) GetGitClientByApp(app *AppEntity) (*git.Client, error)

func (*AppSvr) InitTemporaryWorkspaceForBuild

func (t *AppSvr) InitTemporaryWorkspaceForBuild(repoWorkspaces, tempBuildPath string) ([]byte, error)

func (*AppSvr) IsExist

func (t *AppSvr) IsExist(name string, excludeId ...int64) (bool, error)

func (*AppSvr) ListAllByProjectId

func (t *AppSvr) ListAllByProjectId(projectId int64) ([]AppEntity, error)

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) RunBuild

func (t *AppSvr) RunBuild(buildWorkspace string, cmdBuild string, timeout int) ([]byte, error)

func (*AppSvr) UpdateById

func (t *AppSvr) UpdateById(id int64, params dbx.Params) error

type AuditSvr

type AuditSvr struct{}

func (*AuditSvr) FullFillList

func (t *AuditSvr) FullFillList(list []AuditEntity, uid int64) ([]map[string]interface{}, error)

func (*AuditSvr) GetByProjectIdsAndStatus

func (t *AuditSvr) GetByProjectIdsAndStatus(projectIds []int64, status []int, page, pagesize int, datetime ...string) ([]AuditEntity, error)

func (*AuditSvr) GetByUid

func (t *AuditSvr) GetByUid(uid int64, page, pagesize int) ([]AuditEntity, error)

func (*AuditSvr) GetCountByProjectIdsAndStatus

func (t *AuditSvr) GetCountByProjectIdsAndStatus(projectIds []int64, status []int, datetime ...string) (int, error)

func (*AuditSvr) GetCountByUid

func (t *AuditSvr) GetCountByUid(uid int64) (int, error)

func (*AuditSvr) UpdateStatusById

func (t *AuditSvr) UpdateStatusById(id int64, status int, auditUid int64) error

type BaseSvr

type BaseSvr struct {
}

type BuildSvr

type BuildSvr struct {
}

func (*BuildSvr) CountByAppIds

func (t *BuildSvr) CountByAppIds(appIds []int64) (int, error)

func (*BuildSvr) Create

func (t *BuildSvr) Create(uid, appId int64, branch string) (int64, error)

func (*BuildSvr) DealBuild

func (t *BuildSvr) DealBuild(entity *BuildEntity) error

encapsulate different build type (jenkins or local)

func (*BuildSvr) GetById

func (t *BuildSvr) GetById(id int64) (*BuildEntity, error)

func (*BuildSvr) GetWaitToBuilds

func (t *BuildSvr) GetWaitToBuilds(seconds int64) ([]BuildEntity, error)

get build tasks created nearly n seconds and status = BUILD_STATUS_CREATED

func (*BuildSvr) GetWaitToNotifyList

func (t *BuildSvr) GetWaitToNotifyList() ([]BuildEntity, error)

get builds which are waiting to notify

func (*BuildSvr) ListDetailPageByAppIds

func (t *BuildSvr) ListDetailPageByAppIds(appIds []int64, page, pagesize int) ([]map[string]interface{}, error)

func (*BuildSvr) ListPageByAppId

func (t *BuildSvr) ListPageByAppId(appIds []int64, page, pagesize int) ([]BuildEntity, error)

func (*BuildSvr) UpdatePushSuccAndInsertPkg

func (t *BuildSvr) UpdatePushSuccAndInsertPkg(build *BuildEntity, packageName string) error

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) IsExist

func (t *ClusterSvr) IsExist(appId int64, name string, excludeId ...int64) (bool, 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 (t *EnvSvr) CreateAndInitDefaultCluster(entity *EnvEntity) (int64, error)

func (*EnvSvr) CreateByEntity

func (t *EnvSvr) CreateByEntity(entity *EnvEntity) (int64, error)

func (*EnvSvr) GetByAppIds

func (t *EnvSvr) GetByAppIds(appIds []int64) (map[int64][]EnvEntity, error)

func (*EnvSvr) GetById

func (t *EnvSvr) GetById(id int64) (*EnvEntity, error)

func (*EnvSvr) GetByIds

func (t *EnvSvr) GetByIds(ids []int64) (map[int64]EnvEntity, error)

func (*EnvSvr) GetByName

func (t *EnvSvr) GetByName(appId int64, name string) (*EnvEntity, error)

func (*EnvSvr) IsExist

func (t *EnvSvr) IsExist(appId int64, name string, excludeId ...int64) (bool, error)

func (*EnvSvr) ListAllByAppId

func (t *EnvSvr) ListAllByAppId(appId int64) ([]EnvEntity, error)

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

func (*JobFlow) Do

func (t *JobFlow) Do() error

do deploy works

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 (t *JobSvr) GetByDeploymentIds(deploymentIds []int64) (map[int64][]JobEntity, error)

func (*JobSvr) GetWaitToJobs

func (t *JobSvr) GetWaitToJobs(seconds int64) ([]JobEntity, error)

get deploy tasks created nearly n seconds and status = DEPLOYMENT_STATUS_CREATED

func (*JobSvr) Start

func (t *JobSvr) Start(jobId int64) error

type MemberSvr

type MemberSvr struct {
}

func (*MemberSvr) Add

func (t *MemberSvr) Add(projectId, uid, projectRoleId int64) (int64, error)

func (*MemberSvr) DeleteById

func (t *MemberSvr) DeleteById(id int64) error

func (*MemberSvr) GetAllByProjectId

func (t *MemberSvr) GetAllByProjectId(projectId int64) ([]MemberEntity, error)

func (*MemberSvr) GetAllByUid

func (t *MemberSvr) GetAllByUid(uid int64) ([]MemberEntity, error)

func (*MemberSvr) GetAllDetailByProjectId

func (t *MemberSvr) GetAllDetailByProjectId(projectId int64) ([]map[string]interface{}, error)

get all members with member related info, e.g: user's detail and project role info

func (*MemberSvr) GetByProjectIdUid

func (t *MemberSvr) GetByProjectIdUid(projectId, uid int64) (*MemberEntity, error)

func (*MemberSvr) GetByProjectIdsAndUid

func (t *MemberSvr) GetByProjectIdsAndUid(projectIds []int64, uid int64) ([]MemberEntity, error)

func (*MemberSvr) GetProjectIdsByUid

func (t *MemberSvr) GetProjectIdsByUid(uid int64) ([]int64, error)

func (*MemberSvr) GetProjectPermAuditByProjectIdsUid

func (t *MemberSvr) GetProjectPermAuditByProjectIdsUid(projectIds []int64, uid int64) (map[int64]bool, error)

func (*MemberSvr) HasAllPermission

func (t *MemberSvr) HasAllPermission(uid, projectId int64) bool

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

func (t *MemberSvr) HasBasePermission(uid, projectId int64) bool

BasePermission, e.g: Tester [project] 1. View project detail [app] 1. View apps / environments / clusters / deployments 2. Deploy apps

func (*MemberSvr) HasMediumPermission

func (t *MemberSvr) HasMediumPermission(uid, projectId int64) bool

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) IsExist

func (t *MemberSvr) IsExist(projectId, uid int64) (bool, error)

func (*MemberSvr) UpdateById

func (t *MemberSvr) UpdateById(id int64, params dbx.Params) error

type NotifyItem

type NotifyItem struct {
	Message string   `json:"message"`
	Users   []string `json:"users"`
}

notify item in chan queue

type NotifySvr

type NotifySvr struct{}

func (*NotifySvr) CommitNotify

func (t *NotifySvr) CommitNotify(notify *NotifyItem)

func (*NotifySvr) CommitNotifyByUid

func (t *NotifySvr) CommitNotifyByUid(uid int64, message string) error

func (*NotifySvr) Consume

func (t *NotifySvr) Consume()

consume from notification queue

type PkgSvr

type PkgSvr struct{}

func (*PkgSvr) GetById

func (t *PkgSvr) GetById(id int64) (*PkgEntity, error)

func (*PkgSvr) GetLatestListByEnvId

func (t *PkgSvr) GetLatestListByEnvId(appId int64, branch []string, storageType string, limit ...int) ([]PkgEntity, error)

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) Create

func (t *ProjectRoleSvr) Create(name string) (int64, error)

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 {
}

func (*UserSvr) GetAll

func (t *UserSvr) GetAll() ([]UserEntity, error)

func (*UserSvr) GetById

func (t *UserSvr) GetById(id int64) (*UserEntity, error)

func (*UserSvr) GetByUids

func (t *UserSvr) GetByUids(uids []int64) (map[int64]UserEntity, error)

Get by uid, and return map[uid]UserEntity

func (*UserSvr) GetByUsername

func (t *UserSvr) GetByUsername(username string) (*UserEntity, error)

func (*UserSvr) GetByUsernamePassword

func (t *UserSvr) GetByUsernamePassword(username, password string) (*UserEntity, error)

func (*UserSvr) Register

func (t *UserSvr) Register(username, email, password string) (int64, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL