Documentation
¶
Index ¶
- Constants
- func AutoMigrate() error
- func FixClusterName() error
- type CustomTemplate
- func (c *CustomTemplate) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- func (c *CustomTemplate) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*CustomTemplate, error)
- func (c *CustomTemplate) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*CustomTemplate, int64, error)
- func (c *CustomTemplate) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- type HelmChart
- func (c *HelmChart) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- func (c *HelmChart) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*HelmChart, error)
- func (c *HelmChart) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*HelmChart, int64, error)
- func (c *HelmChart) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- type HelmRepository
- func (c *HelmRepository) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- func (c *HelmRepository) GetIDByNameAndURL(params *dao.Params) (uint, error)
- func (c *HelmRepository) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*HelmRepository, error)
- func (c *HelmRepository) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*HelmRepository, int64, error)
- func (c *HelmRepository) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- func (c *HelmRepository) UpdateContent(params *dao.Params) error
- type KubeConfig
- func (c *KubeConfig) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- func (c *KubeConfig) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*KubeConfig, error)
- func (c *KubeConfig) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*KubeConfig, int64, error)
- func (c *KubeConfig) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- type OperationLog
- func (c *OperationLog) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- func (c *OperationLog) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*OperationLog, error)
- func (c *OperationLog) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*OperationLog, int64, error)
- func (c *OperationLog) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- type ShellLog
- func (c *ShellLog) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- func (c *ShellLog) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*ShellLog, error)
- func (c *ShellLog) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*ShellLog, int64, error)
- func (c *ShellLog) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- type User
- func (c *User) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- func (c *User) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*User, error)
- func (c *User) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*User, int64, error)
- func (c *User) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- type UserGroup
- func (c *UserGroup) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- func (c *UserGroup) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*UserGroup, error)
- func (c *UserGroup) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*UserGroup, int64, error)
- func (c *UserGroup) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) error
Constants ¶
View Source
const ( RoleClusterAdmin = "cluster_admin" RoleClusterReadonly = "cluster_readonly" RolePlatformAdmin = "platform_admin" )
Variables ¶
This section is empty.
Functions ¶
func AutoMigrate ¶
func AutoMigrate() error
func FixClusterName ¶ added in v0.0.48
func FixClusterName() error
Types ¶
type CustomTemplate ¶
type CustomTemplate struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"` // 模板 ID,主键,自增
Name string `gorm:"index" json:"name,omitempty"` // 模板名称,非空,最大长度 255
Content string `gorm:"type:text" json:"content,omitempty"` // 模板内容,支持大文本存储
Kind string `gorm:"index" json:"kind,omitempty"` // 模板类型,最大长度 100
Cluster string `gorm:"index" json:"cluster,omitempty"` // 模板类型,最大长度 100
IsGlobal bool `gorm:"index" json:"is_global,omitempty"` // 模板类型,最大长度 100
CreatedBy string `gorm:"index" json:"created_by,omitempty"` // 创建者
CreatedAt time.Time `json:"created_at,omitempty"` // Automatically managed by GORM for creation time
UpdatedAt time.Time `json:"updated_at,omitempty"` // Automatically managed by GORM for update time
}
CustomTemplate 表示用户自定义模板表的结构体
func (*CustomTemplate) GetOne ¶
func (c *CustomTemplate) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*CustomTemplate, error)
type HelmChart ¶ added in v0.0.51
type HelmChart struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"`
RepositoryID uint `gorm:"index;not null" json:"repository_id,omitempty"` // 关联仓库ID
RepositoryName string `json:"repository_name,omitempty"` // 关联仓库ID
Name string `gorm:"index;not null" json:"name,omitempty"` // Chart名称
LatestVersion string `json:"latest_version,omitempty"` // 最新版本(冗余字段,优化查询)
Description string `json:"description,omitempty"` // Chart描述
Home string `json:"home,omitempty"` // 项目主页URL
Icon string `json:"icon,omitempty"` // Chart图标链接
Keywords pq.StringArray `gorm:"type:text[]" json:"keywords,omitempty"` // 关键词(PostgreSQL数组类型)
KubeVersion string `json:"kubeVersion,omitempty"` // 最低k8s版本要求
AppVersion string `json:"appVersion,omitempty"` // app应用版本
Deprecated bool `json:"deprecated,omitempty"` // Whether or not this chart is deprecated
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Sources string `json:"sources,omitempty"` // 源码主页
}
type HelmRepository ¶ added in v0.0.51
type HelmRepository struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"`
Name string `gorm:"not null" json:"name,omitempty"` // 仓库名称(唯一)
URL string `gorm:"not null" json:"url,omitempty"` // 仓库地址(如 https://charts.example.com)
Type string `gorm:"comment:仓库类型(OCI/HTTP)" json:"type,omitempty"`
Description string `json:"description,omitempty"` // 仓库描述
AuthType string `gorm:"comment:认证类型(Basic/AuthToken/OAuth)" json:"auth_type,omitempty"`
Username string `json:"username,omitempty"` // 认证用户名(加密存储)
Password string `gorm:"-;comment:密码(临时字段,存储时需加密)" json:"password,omitempty"`
EncryptedSecret string `gorm:"comment:加密后的凭据" json:"encrypted_secret,omitempty"`
IsActive bool `gorm:"default:true" json:"is_active,omitempty"` // 是否启用
Content string `gorm:"type:text" json:"content,omitempty"` // 模板内容,支持大文本存储
Generated time.Time `json:"generated"` // repo 索引文件创建时间
CertFile string `json:"certFile"`
KeyFile string `json:"keyFile"`
CAFile string `json:"caFile"`
InsecureSkipTLSverify bool `json:"insecure_skip_tls_verify"`
PassCredentialsAll bool `json:"pass_credentials_all"`
CreatedAt time.Time `json:"created_at,omitempty"` // Automatically managed by GORM for creation time
UpdatedAt time.Time `json:"updated_at,omitempty"` // Automatically managed by GORM for update time
}
func (*HelmRepository) GetIDByNameAndURL ¶ added in v0.0.51
func (c *HelmRepository) GetIDByNameAndURL(params *dao.Params) (uint, error)
func (*HelmRepository) GetOne ¶ added in v0.0.51
func (c *HelmRepository) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*HelmRepository, error)
func (*HelmRepository) List ¶ added in v0.0.51
func (c *HelmRepository) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*HelmRepository, int64, error)
func (*HelmRepository) UpdateContent ¶ added in v0.0.51
func (c *HelmRepository) UpdateContent(params *dao.Params) error
type KubeConfig ¶
type KubeConfig struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"` // 模板 ID,主键,自增
Content string `gorm:"type:text" json:"content,omitempty"` // 模板内容,支持大文本存储
Server string `gorm:"index" json:"server,omitempty"`
User string `gorm:"index" json:"user,omitempty"`
Cluster string `gorm:"index" json:"cluster,omitempty"` // 模板类型,最大长度 100
Namespace string `gorm:"index" json:"namespace,omitempty"`
DisplayName string `gorm:"index" json:"display_name,omitempty"`
CreatedBy string `gorm:"index" json:"created_by,omitempty"` // 创建者
CreatedAt time.Time `json:"created_at,omitempty"` // Automatically managed by GORM for creation time
UpdatedAt time.Time `json:"updated_at,omitempty"` // Automatically managed by GORM for update time
}
KubeConfig 用户导入kubeconfig
func (*KubeConfig) GetOne ¶
func (c *KubeConfig) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*KubeConfig, error)
type OperationLog ¶
type OperationLog struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"` // 模板 ID,主键,自增
UserName string `json:"username,omitempty"`
Role string `json:"role,omitempty"`
Cluster string `gorm:"index" json:"cluster,omitempty"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name,omitempty"`
Group string `json:"group,omitempty"` // 资源group
Kind string `json:"kind,omitempty"` // 资源kind
Action string `json:"action,omitempty"` // 操作类型
ActionResult string `json:"action_result,omitempty"` // 操作结果
CreatedAt time.Time `json:"created_at,omitempty"` // Automatically managed by GORM for creation time
UpdatedAt time.Time `json:"updated_at,omitempty"` // Automatically managed by GORM for update time
}
OperationLog 用户导入OperationLog
func (*OperationLog) GetOne ¶
func (c *OperationLog) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*OperationLog, error)
type ShellLog ¶
type ShellLog struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"` // 模板 ID,主键,自增
UserName string `json:"username,omitempty"`
Cluster string `json:"cluster,omitempty"`
Namespace string `json:"namespace,omitempty"`
PodName string `json:"pod_name,omitempty"`
ContainerName string `json:"container_name,omitempty"`
Command string `json:"command,omitempty"` // shell 执行命令
Role string `json:"role,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"` // Automatically managed by GORM for creation time
UpdatedAt time.Time `json:"updated_at,omitempty"` // Automatically managed by GORM for update time
}
ShellLog 用户导入ShellLog
type User ¶
type User struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"`
Username string `gorm:"uniqueIndex;not null" json:"username,omitempty"`
Salt string `gorm:"not null" json:"salt,omitempty"`
Password string `gorm:"not null" json:"password,omitempty"`
GroupNames string `json:"group_names"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"` // Automatically managed by GORM for update time
CreatedBy string `gorm:"index:idx_created_by" json:"created_by,omitempty"` // 创建者
// 2FA相关字段
TwoFAEnabled bool `gorm:"default:false" json:"two_fa_enabled,omitempty"` // 是否启用2FA
TwoFAType string `gorm:"size:20" json:"two_fa_type,omitempty"` // 2FA类型:如 'totp', 'sms', 'email'
TwoFASecret string `gorm:"size:100" json:"two_fa_secret,omitempty"` // 2FA密钥
TwoFABackupCodes string `gorm:"size:500" json:"two_fa_backup_codes,omitempty"` // 备用恢复码,逗号分隔
}
User 用户导入User
type UserGroup ¶ added in v0.0.55
type UserGroup struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"`
GroupName string `gorm:"index" json:"group_name,omitempty"`
Description string `json:"description,omitempty"`
Role string `gorm:"index" json:"role,omitempty"` // 管理员/只读
CreatedBy string `gorm:"index" json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.