models

package
v0.0.55 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2025 License: MIT Imports: 6 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 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"` // 源码主页
}

func (*HelmChart) Delete added in v0.0.51

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

func (*HelmChart) GetOne added in v0.0.51

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

func (*HelmChart) List added in v0.0.51

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

func (*HelmChart) Save added in v0.0.51

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

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) Delete added in v0.0.51

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

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) Save added in v0.0.51

func (c *HelmRepository) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) 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) 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"`
	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"` // 创建者

}

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

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"`
}

func (*UserGroup) Delete added in v0.0.55

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

func (*UserGroup) GetOne added in v0.0.55

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

func (*UserGroup) List added in v0.0.55

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

func (*UserGroup) Save added in v0.0.55

func (c *UserGroup) 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