 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- type AddAppServiceRequest
- type AppInterface
- type Application
- type ApplicationReadyAudit
- type ApplicationStatus
- type CodeRepository
- type CreateApplicationRequest
- type CreateApplicationSpec
- type CreateServiceRequest
- type DeleteApplicationRequest
- type DeleteServiceRequest
- type DescribeApplicationRequest
- type DescribeServiceRequest
- type ImageRepository
- type LANGUAGE
- type QueryApplicationRequest
- type QueryApplicationRequestSpec
- type QueryServiceRequest
- type SCM_PROVIDER
- type Service
- type ServiceInterface
- type TYPE
- type UpdateApplicationRequest
- type UpdateServiceRequest
Constants ¶
      View Source
      
  
const (
	APP_NAME = "application"
)
    Variables ¶
      View Source
      
  var ( TYPE_NAME = map[TYPE]string{ TYPE_SOURCE_CODE: "SOURCE_CODE", TYPE_CONTAINER_IMAGE: "CONTAINER_IMAGE", TYPE_OTHER: "OTHER", } TYPE_VALUE = map[string]TYPE{ "SOURCE_CODE": TYPE_SOURCE_CODE, "CONTAINER_IMAGE": TYPE_CONTAINER_IMAGE, "OTHER": TYPE_OTHER, } )
Enum value maps for Type.
Functions ¶
This section is empty.
Types ¶
type AddAppServiceRequest ¶
type AddAppServiceRequest struct {
}
    type AppInterface ¶
type AppInterface interface {
	// 创建应用
	CreateApplication(context.Context, *CreateApplicationRequest) (*Application, error)
	// 查询应用
	QueryApplication(context.Context, *QueryApplicationRequest) (*types.Set[*Application], error)
	// 更新应用
	UpdateApplication(context.Context, *UpdateApplicationRequest) (*Application, error)
	// 删除应用
	DeleteApplication(context.Context, *DeleteApplicationRequest) (*Application, error)
	// 获取应用
	DescribeApplication(context.Context, *DescribeApplicationRequest) (*Application, error)
	ServiceInterface
}
    func GetService ¶
func GetService() AppInterface
type Application ¶
type Application struct {
	// 对象Id
	Id string `json:"id" bson:"_id" gorm:"column:id;primaryKey"`
	// 更新时间
	UpdateAt *time.Time `json:"update_at" bson:"update_at" gorm:"column:update_at"`
	// 更新人
	UpdateBy string `json:"update_by" bson:"update_by" gorm:"column:update_by;type:varchar(60)"`
	// 创建请求
	CreateApplicationRequest
	// 应用状态
	ApplicationStatus
	// 应用关联的服务
	Services []*Service `json:"services" gorm:"-"`
}
    func NewApplication ¶
func NewApplication(req CreateApplicationRequest) (*Application, error)
func (*Application) AddService ¶
func (a *Application) AddService(services ...*Service) *Application
func (*Application) BuildId ¶
func (a *Application) BuildId()
func (*Application) SetReady ¶
func (a *Application) SetReady(v bool) *Application
func (*Application) String ¶
func (a *Application) String() string
func (*Application) TableName ¶
func (a *Application) TableName() string
type ApplicationReadyAudit ¶
type ApplicationReadyAudit struct {
	// 评审角色, Dev, Test, Ops
	RoleName string `json:"role_name"`
	// 评审人
	AuditBy string `json:"audit_by"`
	// 评审时间
	AuditAt time.Time `json:"audit_at"`
	// 是否就绪
	Ready bool `json:"ready"`
	// 评审建议
	Message string `json:"message"`
}
    参与应用准备就绪的评审方
type ApplicationStatus ¶
type CodeRepository ¶
type CodeRepository struct {
	// 仓库提供商
	Provider SCM_PROVIDER `json:"provider" bson:"provider" gorm:"column:provider;type:varchar(60)"`
	// token 操作仓库, 比如设置回调
	Token string `json:"token" bson:"token" gorm:"column:token;type:varchar(100)"`
	// 仓库对应的项目Id
	ProjectId string `json:"project_id" bson:"project_id" gorm:"column:project_id;type:varchar(120)"`
	// 仓库对应空间
	Namespace string `json:"namespace" bson:"namespace" gorm:"column:namespace;type:varchar(100)"`
	// 仓库web url地址
	WebUrl string `json:"web_url" bson:"web_url" gorm:"column:web_url;type:varchar(200)"`
	// 仓库ssh url地址
	SshUrl string `json:"ssh_url" bson:"ssh_url" gorm:"column:ssh_url;type:varchar(200)"`
	// 仓库http url地址
	HttpUrl string `json:"http_url" bson:"http_url" gorm:"column:http_url;type:varchar(200)"`
	// 源代码使用的编程语言, 构建时, 不同语言有不同的构建环境
	Language *LANGUAGE `json:"language" bson:"language" gorm:"column:language;type:varchar(60)"`
	// 开启Hook设置
	EnableHook bool `json:"enable_hook" bson:"enable_hook" gorm:"column:enable_hook"`
	// Hook设置
	HookConfig string `json:"hook_config" bson:"hook_config" gorm:"column:hook_config;type:text"`
	// scm设置Hook后返回的id, 用于删除应用时,取消hook使用
	HookId string `json:"hook_id" bson:"hook_id" gorm:"column:hook_id;type:text"`
	// 仓库的创建时间
	CreatedAt time.Time `json:"created_at" bson:"created_at" gorm:"column:created_at"`
}
    服务代码仓库信息
type CreateApplicationRequest ¶
type CreateApplicationRequest struct {
	// 创建人
	CreateBy string `json:"create_by" gorm:"column:create_by;type:varchar(60)" description:"创建人"`
	// 创建时间
	CreateAt time.Time `json:"create_at" gorm:"column:create_at" description:"创建时间"`
	// 资源范围, Namespace是继承的, Scope是API添加的
	policy.ResourceLabel
	// 应用创建参数
	CreateApplicationSpec
}
    func NewCreateApplicationRequest ¶
func NewCreateApplicationRequest() *CreateApplicationRequest
func (*CreateApplicationRequest) GetImageRepositoryPrimaryAddress ¶
func (a *CreateApplicationRequest) GetImageRepositoryPrimaryAddress() string
func (*CreateApplicationRequest) Validate ¶
func (a *CreateApplicationRequest) Validate() error
type CreateApplicationSpec ¶
type CreateApplicationSpec struct {
	// 应用名称
	Name string `json:"name" bson:"name" gorm:"column:name;type:varchar(120)" description:"应用名称"`
	// 应用描述
	Description string `json:"description" bson:"description" gorm:"column:description;type:text" description:"应用描述"`
	// 应用图标
	Icon string `json:"icon" bson:"icon" gorm:"column:icons;type:text" description:"应用图标"`
	// 应用类型
	Type TYPE `json:"type" bson:"type" gorm:"column:type;type:tinyint(2)" description:"应用类型, SOURCE_CODE, CONTAINER_IMAGE, OTHER"`
	// 应用代码仓库信息
	CodeRepository CodeRepository `json:"code_repository" bson:",inline" gorm:"embedded" description:"应用代码仓库信息"`
	// 应用镜像仓库信息
	ImageRepository []ImageRepository `` /* 145-byte string literal not displayed */
	// 应用所有者
	Owner string `json:"owner" bson:"owner" gorm:"column:owner;type:varchar(120)" description:"应用所有者"`
	// 应用等级, 评估这个应用的重要程度
	Level *uint32 `json:"level" bson:"level" gorm:"column:level" description:"应用等级, 评估这个应用的重要程度"`
	// 应用优先级, 应用启动的先后顺序
	Priority *uint32 `json:"priority" bson:"priority" gorm:"column:priority" description:"应用优先级, 应用启动的先后顺序"`
	// 额外的其他属性
	Extras map[string]string `json:"extras" form:"extras" bson:"extras" gorm:"column:extras;type:json;serializer:json;"`
	// 指定应用的评审方
	Audits []ApplicationReadyAudit `json:"audits" bson:"audits" gorm:"column:audits;type:json;serializer:json" description:"参与应用准备就绪的评审方"`
}
    type CreateServiceRequest ¶
type CreateServiceRequest struct {
	// 所属应用
	ApplicationName string `json:"application_name" gorm:"column:application_name;type:varchar(60)"`
	// 单仓单服, 服务名称就是 仓库的名称
	// 单仓多服, 服务名称 需要用户自己定义, 子应用目录名称
	Name string `json:"name" gorm:"column:name;type:varchar(60)"`
}
    func NewCreateServiceRequest ¶
func NewCreateServiceRequest(app_name, serviceName string) *CreateServiceRequest
type DeleteApplicationRequest ¶
type DeleteApplicationRequest struct {
	DescribeApplicationRequest
}
    type DeleteServiceRequest ¶
type DeleteServiceRequest struct {
}
    type DescribeApplicationRequest ¶
type DescribeApplicationRequest struct {
	policy.ResourceScope
	// 应用ID
	Id string `json:"id" bson:"_id"`
}
    type DescribeServiceRequest ¶
type DescribeServiceRequest struct {
	ServiceId string `json:"service_id"`
}
    func NewDescribeServiceRequest ¶
func NewDescribeServiceRequest(serviceId string) *DescribeServiceRequest
type ImageRepository ¶
type ImageRepository struct {
	// 服务镜像地址, 比如 gcr.lank8s.cn/kaniko-project/executor
	Address string `json:"address" bson:"address"`
	// 是不是主仓库
	IsPrimary bool `json:"is_primary" bson:"is_primary"`
}
    镜像仓库
type LANGUAGE ¶
type LANGUAGE string
const ( LANGUAGE_JAVA LANGUAGE = "java" LANGUAGE_JAVASCRIPT LANGUAGE = "javascript" LANGUAGE_GOLANG LANGUAGE = "golang" LANGUAGE_PYTHON LANGUAGE = "python" LANGUAGE_PHP LANGUAGE = "php" LANGUAGE_C_SHARP LANGUAGE = "csharp" LANGUAGE_C LANGUAGE = "c" LANGUAGE_C_PLUS_PLUS LANGUAGE = "cpp" LANGUAGE_SWIFT LANGUAGE = "swift" LANGUAGE_OBJECT_C LANGUAGE = "objectivec" LANGUAGE_RUST LANGUAGE = "rust" LANGUAGE_RUBY LANGUAGE = "ruby" LANGUAGE_DART LANGUAGE = "dart" LANGUAGE_KOTLIN LANGUAGE = "kotlin" LANGUAGE_SHELL LANGUAGE = "shell" LANGUAGE_POWER_SHELL LANGUAGE = "powershell" )
type QueryApplicationRequest ¶
type QueryApplicationRequest struct {
	policy.ResourceScope
	QueryApplicationRequestSpec
}
    func NewQueryApplicationRequest ¶
func NewQueryApplicationRequest() *QueryApplicationRequest
type QueryApplicationRequestSpec ¶
type QueryApplicationRequestSpec struct {
	*request.PageRequest
	// 应用ID
	Id string `json:"id" bson:"_id"`
	// 应用名称
	Name string `json:"name" bson:"name"`
	// 应用是否就绪
	Ready *bool `json:"ready" bson:"ready"`
}
    type QueryServiceRequest ¶
type QueryServiceRequest struct {
	*request.PageRequest
	// 所属应用
	ApplicationName string `json:"application_name"`
	//
	ApplicationId string `json:"application_id"`
}
    func NewQueryServiceRequest ¶
func NewQueryServiceRequest() *QueryServiceRequest
func (*QueryServiceRequest) SetApplicationId ¶
func (r *QueryServiceRequest) SetApplicationId(appId string) *QueryServiceRequest
func (*QueryServiceRequest) SetApplicationName ¶
func (r *QueryServiceRequest) SetApplicationName(appName string) *QueryServiceRequest
type SCM_PROVIDER ¶
type SCM_PROVIDER string
SCM_TYPE 源码仓库类型
const ( // gitlab SCM_PROVIDER_GITLAB SCM_PROVIDER = "gitlab" // github SCM_PROVIDER_GITHUB SCM_PROVIDER = "github" // bitbucket SCM_PROVIDER_BITBUCKET SCM_PROVIDER = "bitbucket" )
type Service ¶
type Service struct {
	// 对象Id  应用名称-服务名称
	Id string `json:"id" bson:"_id" gorm:"column:id;primaryKey"`
	// 创建时间
	CreateAt time.Time `json:"create_at" gorm:"column:create_at" description:"创建时间"`
	// 更新时间
	UpdateAt *time.Time `json:"update_at" gorm:"column:update_at"`
	// 更新人
	UpdateBy string `json:"update_by" gorm:"column:update_by;type:varchar(60)"`
	// 具体属性
	CreateServiceRequest
}
    应用服务, 应用的子概念
func NewService ¶
func NewService(req *CreateServiceRequest) *Service
type ServiceInterface ¶
type ServiceInterface interface {
	// 服务添加
	AddAppService(context.Context, *AddAppServiceRequest) (*Service, error)
	// 服务编辑
	UpdateService(context.Context, *UpdateServiceRequest) (*Service, error)
	// 服务删除
	DeleteService(context.Context, *DeleteServiceRequest) (*Service, error)
	// 查询具体的Service信息
	DescribeService(context.Context, *DescribeServiceRequest) (*Service, error)
	// 服务列表查询
	QueryService(context.Context, *QueryServiceRequest) (*types.Set[*Service], error)
}
    type UpdateApplicationRequest ¶
type UpdateApplicationRequest struct {
	// 更新人
	UpdateBy string `json:"update_by" bson:"update_by"`
	DescribeApplicationRequest
	CreateApplicationSpec
}
    type UpdateServiceRequest ¶
type UpdateServiceRequest struct {
}
    
       Source Files
      ¶
      Source Files
      ¶
    
   Click to show internal directories. 
   Click to hide internal directories.