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 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
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 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"` // 模板 ID,主键,自增
Username string `gorm:"uniqueIndex;not null" json:"username,omitempty"`
Password string `gorm:"not null;index:idx_password" json:"password,omitempty"`
Role string `gorm:"not null;index:idx_role" json:"role,omitempty"` // 管理员/只读
Salt string `gorm:"not null" json:"salt,omitempty"`
CreatedBy string `gorm:"index:idx_created_by" 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
}
User 用户导入User
Click to show internal directories.
Click to hide internal directories.