Documentation
¶
Index ¶
- Constants
- Variables
- type AppReadyAudit
- type AppStatus
- type Application
- type CodeRepository
- type CreateApplicationRequest
- type CreateApplicationSpec
- type DeleteApplicationRequest
- type DescribeApplicationRequest
- type ImageRepository
- type Language
- type QueryApplicationRequest
- type QueryApplicationRequestSpec
- type ScmProvider
- type Service
- type Type
- type UpdateApplicationRequest
Constants ¶
View Source
const (
AppName = "application"
)
Variables ¶
View Source
var ( TypeName = map[Type]string{ TypeSourceCode: "SourceCode", TypeContainerImage: "ContainerImage", TypeOther: "Other", } TypeValue = map[string]Type{ "SourceCode": TypeSourceCode, "ContainerImage": TypeContainerImage, "Other": TypeOther, } )
Functions ¶
This section is empty.
Types ¶
type AppReadyAudit ¶ added in v0.0.4
type AppReadyAudit struct {
RoleName string `json:"role_name"` // 评审角色
AuditBy string `json:"audit_by"` // 评审人
AuditAt time.Time `json:"audit_at"` // 评审时间
Ready bool `json:"ready"` // 是否就绪
Message string `json:"message"` // 评审建议
}
AppReadyAudit 参与应用准备就绪的审计方
type Application ¶
type Application struct {
Id string `json:"id" bson:"id"`
UpdateAt *time.Time `json:"updated_at" bson:"updated_at"` // 更新时间
UpdateBy string `json:"update_by" bson:"update_by"` // 更新人
CreateApplicationRequest
}
func NewApplication ¶ added in v0.0.4
func NewApplication(req CreateApplicationRequest) (*Application, error)
func (*Application) BuildId ¶ added in v0.0.4
func (a *Application) BuildId()
func (*Application) GetImageRepositoryAddress ¶ added in v0.0.4
func (a *Application) GetImageRepositoryAddress() string
func (*Application) SetReady ¶ added in v0.0.4
func (a *Application) SetReady(v bool) *Application
func (*Application) Validate ¶ added in v0.0.4
func (a *Application) Validate() error
type CodeRepository ¶ added in v0.0.4
type CodeRepository struct {
// 仓库提供商
Provider ScmProvider `json:"provider" bson:"provider" gorm:"column:provider"`
// token 操作仓库, 比如设置回调
Token string `json:"token" bson:"token" gorm:"column:token"`
// 仓库对应的项目Id
ProjectId string `json:"project_id" bson:"project_id" gorm:"column:project_id"`
// 仓库对应空间
Namespace string `json:"namespace" bson:"namespace" gorm:"column:namespace"`
// 仓库web url地址
WebUrl string `json:"web_url" bson:"web_url" gorm:"column:web_url"`
// 仓库ssh url地址
SshUrl string `json:"ssh_url" bson:"ssh_url" gorm:"column:ssh_url"`
// 仓库http url地址
HttpUrl string `json:"http_url" bson:"http_url" gorm:"column:http_url"`
// 源代码使用的编程语言, 构建时, 不同语言有不同的构建环境
Language *Language `json:"language" bson:"language" gorm:"column:language"`
// 开启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"`
// scm设置Hook后返回的id, 用于删除应用时,取消hook使用
HookId string `json:"hook_id" bson:"hook_id" gorm:"column:hook_id"`
// 仓库的创建时间
CreatedAt *time.Time `json:"created_at" bson:"created_at" gorm:"column:created_at"`
}
CodeRepository 服务代码仓库信息
type CreateApplicationRequest ¶
type CreateApplicationRequest struct {
CreateBy string `json:"create_by" bson:"create_by" description:"创建人"`
CreateAt time.Time `json:"create_at" bson:"create_at" gorm:"column:create_at" description:"创建时间"`
Namespace string `` /* 127-byte string literal not displayed */
CreateApplicationSpec // 用户传递的参数
AppStatus // 应用状态
policy.ResourceLabel // 资源范围 Namespace 是继承的,Scope 是 API 添加的
}
func NewCreateApplicationRequest ¶ added in v0.0.4
func NewCreateApplicationRequest() *CreateApplicationRequest
type CreateApplicationSpec ¶
type CreateApplicationSpec struct {
// 应用名称
Name string `json:"name" bson:"name" gorm:"column:name" description:"应用名称"`
// 应用描述
Description string `json:"description" bson:"description" gorm:"column:description" description:"应用描述"`
// 应用图标
Icon string `json:"icon" bson:"icon" gorm:"column:icons" description:"应用图标"`
// 应用类型
Type Type `json:"type" bson:"type" gorm:"column:type" 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" 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 []AppReadyAudit `json:"audits" bson:"audits" gorm:"column:audits;type:json;serializer:json" description:"参与应用准备就绪的评审方"`
}
type DeleteApplicationRequest ¶ added in v0.0.4
type DeleteApplicationRequest struct {
DescribeApplicationRequest
}
type DescribeApplicationRequest ¶ added in v0.0.4
type DescribeApplicationRequest struct {
policy.ResourceScope
Id string `json:"id" bson:"_id"` // 应用ID
}
type ImageRepository ¶ added in v0.0.4
type ImageRepository struct {
// 服务镜像地址, 比如 gcr.lank8s.cn/kaniko-project/executor
Address string `json:"address" bson:"address"`
// 是不是主仓库
IsPrimary bool `json:"is_primary" bson:"is_primary"`
}
ImageRepository 镜像仓库
type Language ¶ added in v0.0.4
type Language string
const ( LanguageJava Language = "java" LanguageJavascript Language = "javascript" LanguageGolang Language = "golang" LanguagePython Language = "python" LanguagePhp Language = "php" LanguageCSharp Language = "csharp" LanguageC Language = "c" LanguageCPlusPlus Language = "cpp" LanguageSwift Language = "swift" LanguageObjectC Language = "objectivec" LanguageRust Language = "rust" LanguageRuby Language = "ruby" LanguageDart Language = "dart" LanguageKotlin Language = "kotlin" LanguageShell Language = "shell" LanguagePowerShell Language = "powershell" )
type QueryApplicationRequest ¶ added in v0.0.4
type QueryApplicationRequest struct {
policy.ResourceScope
QueryApplicationRequestSpec
}
func NewQueryApplicationRequest ¶ added in v0.0.4
func NewQueryApplicationRequest() *QueryApplicationRequest
type QueryApplicationRequestSpec ¶ added in v0.0.4
type QueryApplicationRequestSpec struct {
*request.PageRequest
Id string `json:"id" bson:"_id"` // 应用ID
Name string `json:"name" bson:"name"` // 应用名称
Ready *bool `json:"ready" bson:"ready"` // 是否就绪
}
type ScmProvider ¶ added in v0.0.4
type ScmProvider string
ScmProvider 源代码仓库类型
const ( ScmProviderGithub ScmProvider = "github" // Github ScmProviderGitlab ScmProvider = "gitlab" // Gitlab ScmProviderBitbucket ScmProvider = "bitbucket" // Bitbucket )
type Service ¶
type Service 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) // 查询应用详情
}
func GetService ¶ added in v0.0.4
func GetService() Service
type Type ¶
type Type int32
func ParseTypeFromString ¶ added in v0.0.4
ParseTypeFromString 将字符串转换为 Type 枚举
func (*Type) MarshalJSON ¶ added in v0.0.4
func (*Type) UnmarshalJSON ¶ added in v0.0.4
type UpdateApplicationRequest ¶ added in v0.0.4
type UpdateApplicationRequest struct {
UpdateBy string `json:"update_by" bson:"update_by"` // 更新人
DescribeApplicationRequest
CreateApplicationSpec
}
Click to show internal directories.
Click to hide internal directories.