models

package
v0.0.48 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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

func (c *CustomTemplate) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error

func (*CustomTemplate) GetOne

func (c *CustomTemplate) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*CustomTemplate, error)

func (*CustomTemplate) List

func (c *CustomTemplate) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*CustomTemplate, int64, error)

func (*CustomTemplate) Save

func (c *CustomTemplate) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) 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) Delete

func (c *KubeConfig) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error

func (*KubeConfig) GetOne

func (c *KubeConfig) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*KubeConfig, error)

func (*KubeConfig) List

func (c *KubeConfig) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*KubeConfig, int64, error)

func (*KubeConfig) Save

func (c *KubeConfig) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) 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) Delete

func (c *OperationLog) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error

func (*OperationLog) GetOne

func (c *OperationLog) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*OperationLog, error)

func (*OperationLog) List

func (c *OperationLog) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*OperationLog, int64, error)

func (*OperationLog) Save

func (c *OperationLog) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) 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

func (*ShellLog) Delete

func (c *ShellLog) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error

func (*ShellLog) GetOne

func (c *ShellLog) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*ShellLog, error)

func (*ShellLog) List

func (c *ShellLog) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*ShellLog, int64, error)

func (*ShellLog) Save

func (c *ShellLog) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) error

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

func (*User) Delete

func (c *User) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error

func (*User) GetOne

func (c *User) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*User, error)

func (*User) List

func (c *User) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*User, int64, error)

func (*User) Save

func (c *User) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) error

Jump to

Keyboard shortcuts

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