model

package
v0.0.0-...-0fdb646 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DashBoardPermission     PermissionKind = "대시보드"
	StackPermission         PermissionKind = "스택"
	PolicyPermission        PermissionKind = "정책"
	ProjectPermission       PermissionKind = "프로젝트"
	NotificationPermission  PermissionKind = "알림"
	ConfigurationPermission PermissionKind = "설정"
	ClusterAccessControl    PermissionKind = "클러스터 접근 제어"

	OperationRead     = "READ"
	OperationCreate   = "CREATE"
	OperationUpdate   = "UPDATE"
	OperationDelete   = "DELETE"
	OperationDownload = "DOWNLOAD"

	// Key
	TopDashboardKey                          = "DASHBOARD"
	MiddleDashboardKey                       = "DASHBOARD-DASHBOARD"
	TopStackKey                              = "STACK"
	MiddleStackKey                           = "STACK-STACK"
	MiddleClusterAccessControlKey            = "STACK-CLUSTER_ACCESS_CONTROL"
	TopPolicyKey                             = "POLICY"
	MiddlePolicyKey                          = "POLICY-POLICY"
	TopNotificationKey                       = "NOTIFICATION"
	MiddleNotificationKey                    = "NOTIFICATION-SYSTEM_NOTIFICATION"
	MiddlePolicyNotificationKey              = "NOTIFICATION-POLICY_NOTIFICATION"
	TopProjectKey                            = "PROJECT"
	MiddleProjectKey                         = "PROJECT-PROJECT_LIST"
	MiddleProjectCommonConfigurationKey      = "PROJECT-PROJECT_COMMON_CONFIGURATION"
	MiddleProjectMemberConfigurationKey      = "PROJECT-PROJECT_MEMBER_CONFIGURATION"
	MiddleProjectNamespaceKey                = "PROJECT-PROJECT_NAMESPACE"
	MiddleProjectAppServeKey                 = "PROJECT-PROJECT_APP_SERVE"
	TopConfigurationKey                      = "CONFIGURATION"
	MiddleConfigurationKey                   = "CONFIGURATION-CONFIGURATION"
	MiddleConfigurationCloudAccountKey       = "CONFIGURATION-CLOUD_ACCOUNT"
	MiddleConfigurationProjectKey            = "CONFIGURATION-PROJECT"
	MiddleConfigurationUserKey               = "CONFIGURATION-USER"
	MiddleConfigurationRoleKey               = "CONFIGURATION-ROLE"
	MiddleConfigurationSystemNotificationKey = "CONFIGURATION-SYSTEM_NOTIFICATION"
)
View Source
const (
	FILE_DELIMETER = "---\n"
)

Variables

View Source
var SortOrder = map[string]int{
	OperationRead:     0,
	OperationCreate:   1,
	OperationUpdate:   2,
	OperationDelete:   3,
	OperationDownload: 4,
}

Functions

This section is empty.

Types

type AppGroup

type AppGroup struct {
	gorm.Model

	ID           domain.AppGroupId `gorm:"primarykey"`
	AppGroupType domain.AppGroupType
	ClusterId    domain.ClusterId
	Name         string
	Description  string
	WorkflowId   string
	Status       domain.AppGroupStatus
	StatusDesc   string
	CreatorId    *uuid.UUID `gorm:"type:uuid"`
	Creator      User       `gorm:"foreignKey:CreatorId"`
	UpdatorId    *uuid.UUID `gorm:"type:uuid"`
	Updator      User       `gorm:"foreignKey:UpdatorId"`
}

Models

type AppServeApp

type AppServeApp struct {
	ID                 string     `gorm:"primarykey" json:"id"`
	Name               string     `gorm:"index" json:"name"`              // application name
	Namespace          string     `json:"namespace"`                      // application namespace
	OrganizationId     string     `json:"organizationId"`                 // contractId is a contract ID which this app belongs to
	ProjectId          string     `json:"projectId"`                      // project ID which this app belongs to
	Type               string     `json:"type"`                           // type (build/deploy/all)
	AppType            string     `json:"appType"`                        // appType (spring/springboot)
	EndpointUrl        string     `json:"endpointUrl"`                    // endpoint URL of deployed app
	PreviewEndpointUrl string     `json:"previewEndpointUrl"`             // preview svc endpoint URL in B/G deployment
	TargetClusterId    string     `json:"targetClusterId"`                // target cluster to which the app is deployed
	TargetClusterName  string     `gorm:"-:all" json:"targetClusterName"` // target cluster name
	Status             string     `gorm:"index" json:"status"`            // status is status of deployed app
	GrafanaUrl         string     `json:"grafanaUrl"`                     // grafana dashboard URL for deployed app
	Description        string     `json:"description"`                    // description for application
	CreatedAt          time.Time  `gorm:"autoCreateTime:false" json:"createdAt" `
	UpdatedAt          *time.Time `gorm:"autoUpdateTime:false" json:"updatedAt"`
	DeletedAt          *time.Time `json:"deletedAt"`
}

type AppServeAppTask

type AppServeAppTask struct {
	ID                string     `gorm:"primarykey" json:"id"`
	AppServeAppId     string     `gorm:"not null" json:"appServeAppId"` // ID for appServeApp that this task belongs to
	Version           string     `json:"version"`                       // application version
	Status            string     `json:"status"`                        // status is app status
	Output            string     `json:"output"`                        // output for task result
	ArtifactUrl       string     `json:"artifactUrl"`                   // URL of java app artifact (Eg, Jar)
	ImageUrl          string     `json:"imageUrl"`                      // URL of built image for app
	ExecutablePath    string     `json:"executablePath"`                // Executable path of app image
	Profile           string     `json:"profile"`                       // java app profile
	AppConfig         string     `json:"appConfig"`                     // java app config
	AppSecret         string     `json:"appSecret"`                     // java app secret
	ExtraEnv          string     `json:"extraEnv"`                      // env variable list for java app
	Port              string     `json:"port"`                          // java app port
	ResourceSpec      string     `json:"resourceSpec"`                  // resource spec of app pod
	HelmRevision      int32      `gorm:"default:0" json:"helmRevision"` // revision of deployed helm release
	Strategy          string     `json:"strategy"`                      // deployment strategy (eg, rolling-update)
	RollbackVersion   string     `json:"rollbackVersion"`               // rollback target version
	PvEnabled         bool       `json:"pvEnabled"`
	PvStorageClass    string     `json:"pvStorageClass"`
	PvAccessMode      string     `json:"pvAccessMode"`
	PvSize            string     `json:"pvSize"`
	PvMountPath       string     `json:"pvMountPath"`
	AvailableRollback bool       `gorm:"-:all" json:"availableRollback"`
	CreatedAt         time.Time  `gorm:"autoCreateTime:false" json:"createdAt"` // createdAt is  a creation timestamp for the application
	UpdatedAt         *time.Time `gorm:"autoUpdateTime:false" json:"updatedAt"`
	DeletedAt         *time.Time `json:"deletedAt"`
}

func (*AppServeAppTask) BeforeCreate

func (t *AppServeAppTask) BeforeCreate(tx *gorm.DB) (err error)

type Application

type Application struct {
	gorm.Model

	ID         uuid.UUID `gorm:"primarykey;type:uuid"`
	AppGroupId domain.AppGroupId
	Endpoint   string
	Metadata   datatypes.JSON
	Type       domain.ApplicationType
}

type Audit

type Audit struct {
	gorm.Model

	ID               uuid.UUID `gorm:"primarykey"`
	OrganizationId   string
	OrganizationName string
	Group            string
	Message          string
	Description      string
	ClientIP         string
	UserId           *uuid.UUID `gorm:"type:uuid"`
	UserAccountId    string
	UserName         string
	UserRoles        string
}

Models

type CacheEmailCode

type CacheEmailCode struct {
	gorm.Model

	UserId uuid.UUID `gorm:"not null"`
	Code   string    `gorm:"type:varchar(6);not null"`
}

type CloudAccount

type CloudAccount struct {
	gorm.Model

	ID              uuid.UUID `gorm:"primarykey"`
	OrganizationId  string
	Organization    Organization `gorm:"foreignKey:OrganizationId"`
	Name            string       `gorm:"index"`
	Description     string       `gorm:"index"`
	Resource        string
	CloudService    string
	WorkflowId      string
	Status          domain.CloudAccountStatus
	StatusDesc      string
	AwsAccountId    string
	AccessKeyId     string `gorm:"-:all"`
	SecretAccessKey string `gorm:"-:all"`
	SessionToken    string `gorm:"-:all"`
	Clusters        int    `gorm:"-:all"`
	CreatedIAM      bool
	CreatorId       *uuid.UUID `gorm:"type:uuid"`
	Creator         User       `gorm:"foreignKey:CreatorId"`
	UpdatorId       *uuid.UUID `gorm:"type:uuid"`
	Updator         User       `gorm:"foreignKey:UpdatorId"`
}

Models

type Cluster

type Cluster struct {
	gorm.Model

	ID                     domain.ClusterId `gorm:"primarykey"`
	Name                   string           `gorm:"index"`
	CloudService           string           `gorm:"default:AWS"`
	OrganizationId         string
	Organization           Organization `gorm:"foreignKey:OrganizationId"`
	Description            string       `gorm:"index"`
	WorkflowId             string
	Status                 domain.ClusterStatus
	StatusDesc             string
	CloudAccountId         *uuid.UUID
	CloudAccount           CloudAccount `gorm:"foreignKey:CloudAccountId"`
	StackTemplateId        uuid.UUID
	StackTemplate          StackTemplate `gorm:"foreignKey:StackTemplateId"`
	Favorites              *[]ClusterFavorite
	ClusterType            domain.ClusterType `gorm:"default:0"`
	ByoClusterEndpointHost string
	ByoClusterEndpointPort int
	IsStack                bool `gorm:"default:false"`
	TksCpNode              int
	TksCpNodeMax           int
	TksCpNodeType          string
	TksInfraNode           int
	TksInfraNodeMax        int
	TksInfraNodeType       string
	TksUserNode            int
	TksUserNodeMax         int
	TksUserNodeType        string
	Kubeconfig             []byte     `gorm:"-:all"`
	PolicyIds              []string   `gorm:"-:all"`
	CreatorId              *uuid.UUID `gorm:"type:uuid"`
	Creator                User       `gorm:"foreignKey:CreatorId"`
	UpdatorId              *uuid.UUID `gorm:"type:uuid"`
	Updator                User       `gorm:"foreignKey:UpdatorId"`
	Policies               []Policy   `gorm:"many2many:policy_target_clusters"`
}

Models

func (*Cluster) SetDefaultConf

func (m *Cluster) SetDefaultConf()

type ClusterFavorite

type ClusterFavorite struct {
	gorm.Model

	ID        uuid.UUID `gorm:"primarykey;type:uuid"`
	ClusterId domain.ClusterId
	Cluster   Cluster   `gorm:"foreignKey:ClusterId"`
	UserId    uuid.UUID `gorm:"type:uuid"`
	User      User      `gorm:"foreignKey:UserId"`
}

type Dashboard

type Dashboard struct {
	gorm.Model
	ID             uuid.UUID `gorm:"primarykey;type:uuid"`
	OrganizationId string    `gorm:"type:varchar(36)"`
	UserId         uuid.UUID
	Key            string
	Content        string
	IsAdmin        bool `gorm:"default:false"`
}

func (*Dashboard) BeforeCreate

func (d *Dashboard) BeforeCreate(tx *gorm.DB) (err error)

type Endpoint

type Endpoint struct {
	Name      string `gorm:"primary_key;type:text;not null;unique" json:"name"`
	Group     string `gorm:"type:text;" json:"group"`
	CreatedAt time.Time
}

type ExpiredTokenTime

type ExpiredTokenTime struct {
	gorm.Model

	OrganizationId string `gorm:"index:idx_org_id_subject_id,unique;not null"`
	SubjectId      string `gorm:"index:idx_org_id_subject_id,unique;not null"`
	ExpiredTime    time.Time
}

Models

type Organization

type Organization struct {
	gorm.Model

	ID                            string `gorm:"primarykey;type:varchar(36);not null"`
	Name                          string
	Description                   string
	Phone                         string
	PrimaryClusterId              string
	WorkflowId                    string
	Status                        domain.OrganizationStatus
	StatusDesc                    string
	CreatorId                     *uuid.UUID                   `gorm:"type:uuid"`
	StackTemplates                []StackTemplate              `gorm:"many2many:stack_template_organizations;"`
	StackTemplateIds              []uuid.UUID                  `gorm:"-:all"`
	PolicyTemplates               []PolicyTemplate             `gorm:"many2many:policy_template_permitted_organizations;"`
	PolicyTemplateIds             []uuid.UUID                  `gorm:"-:all"`
	SystemNotificationTemplates   []SystemNotificationTemplate `gorm:"many2many:system_notification_template_organizations"`
	SystemNotificationTemplateIds []uuid.UUID                  `gorm:"-:all"`
	ClusterCount                  int                          `gorm:"-:all"`
	AdminId                       *uuid.UUID
	Admin                         *User `gorm:"-:all"`
}

type Permission

type Permission struct {
	gorm.Model

	ID   uuid.UUID `gorm:"primarykey;type:uuid;" json:"ID"`
	Name string    `json:"name"`
	Key  string    `gorm:"type:text;" json:"key,omitempty"`

	IsAllowed *bool       `gorm:"type:boolean;" json:"is_allowed,omitempty"`
	RoleID    *string     `json:"role_id,omitempty"`
	Role      *Role       `gorm:"foreignKey:RoleID;references:ID;" json:"role,omitempty"`
	Endpoints []*Endpoint `gorm:"many2many:permission_endpoints;" json:"endpoints,omitempty"`

	ParentID *uuid.UUID    `json:"parent_id,omitempty"`
	Parent   *Permission   `gorm:"foreignKey:ParentID;references:ID;" json:"parent,omitempty"`
	Children []*Permission `gorm:"foreignKey:ParentID;references:ID;" json:"children,omitempty"`
}

func GetEdgePermission

func GetEdgePermission(root *Permission, edgePermissions []*Permission, f func(permission Permission) bool) []*Permission

type PermissionKind

type PermissionKind string

type PermissionSet

type PermissionSet struct {
	Dashboard         *Permission `gorm:"-:all" json:"dashboard,omitempty"`
	Stack             *Permission `gorm:"-:all" json:"stack,omitempty"`
	Policy            *Permission `gorm:"-:all" json:"policy,omitempty"`
	ProjectManagement *Permission `gorm:"-:all" json:"project_management,omitempty"`
	Notification      *Permission `gorm:"-:all" json:"notification,omitempty"`
	Configuration     *Permission `gorm:"-:all" json:"configuration,omitempty"`
	Common            *Permission `gorm:"-:all" json:"common,omitempty"`
	Admin             *Permission `gorm:"-:all" json:"admin,omitempty"`
}

func NewAdminPermissionSet

func NewAdminPermissionSet() *PermissionSet

func NewDefaultPermissionSet

func NewDefaultPermissionSet() *PermissionSet

func (*PermissionSet) SetAllowedPermissionSet

func (p *PermissionSet) SetAllowedPermissionSet()

func (*PermissionSet) SetRoleId

func (p *PermissionSet) SetRoleId(roleId string)

func (*PermissionSet) SetUserPermissionSet

func (p *PermissionSet) SetUserPermissionSet()

type Policy

type Policy struct {
	gorm.Model

	ID             uuid.UUID `gorm:"primarykey;type:varchar(36);not null"`
	OrganizationId string

	PolicyName         string
	PolicyResourceName string
	Mandatory          bool
	Description        string

	TargetClusterIds []string  `gorm:"-:all"`
	TargetClusters   []Cluster `gorm:"many2many:policy_target_clusters"`

	EnforcementAction string

	Parameters  string        `gorm:"type:text"`
	PolicyMatch string        `gorm:"type:text"`
	MatchYaml   *string       `gorm:"type:text"`
	Match       *domain.Match `gorm:"-:all"`

	TemplateName   string         `gorm:"-:all"`
	TemplateId     uuid.UUID      `gorm:"type:uuid"`
	PolicyTemplate PolicyTemplate `gorm:"foreignKey:TemplateId"`

	CreatorId *uuid.UUID `gorm:"type:uuid"`
	Creator   User       `gorm:"foreignKey:CreatorId"`
	UpdatorId *uuid.UUID `gorm:"type:uuid"`
	Updator   User       `gorm:"foreignKey:UpdatorId"`
}

func (*Policy) AfterFind

func (p *Policy) AfterFind(tx *gorm.DB) (err error)

func (*Policy) BeforeCreate

func (p *Policy) BeforeCreate(tx *gorm.DB) (err error)

type PolicyCount

type PolicyCount struct {
	EnforcementAction string
	Count             int64
}

type PolicyTargetCluster

type PolicyTargetCluster struct {
	PolicyId  uuid.UUID        `gorm:"primarykey"`
	ClusterId domain.ClusterId `gorm:"primarykey"`
}

type PolicyTemplate

type PolicyTemplate struct {
	gorm.Model

	ID                       uuid.UUID `gorm:"primarykey;type:varchar(36);not null"`
	TemplateName             string
	Type                     string                           // Org or Tks
	Version                  string                           `gorm:"-:all"` // 삭제 예정
	CurrentVersion           string                           `gorm:"-:all"`
	LatestVersion            string                           `gorm:"-:all"`
	SupportedVersions        []PolicyTemplateSupportedVersion `gorm:"foreignKey:PolicyTemplateId"`
	OrganizationId           *string                          // Org 인 경우에만 설정
	Organization             Organization                     `gorm:"foreignKey:OrganizationId"`
	Description              string
	Kind                     string
	Deprecated               bool
	Mandatory                bool // Tks 인 경우에는 무시
	Severity                 string
	PermittedOrganizations   []Organization         `gorm:"many2many:policy_template_permitted_organizations"`
	ParametersSchema         []*domain.ParameterDef `gorm:"-:all"`
	Rego                     string                 `gorm:"-:all"`
	Libs                     []string               `gorm:"-:all"`
	SyncKinds                *[]string              `gorm:"-:all"`
	SyncJson                 *string                `gorm:"-:all"`
	PermittedOrganizationIds []string               `gorm:"-:all"`
	CreatorId                *uuid.UUID             `gorm:"type:uuid"`
	Creator                  User                   `gorm:"foreignKey:CreatorId"`
	UpdatorId                *uuid.UUID             `gorm:"type:uuid"`
	Updator                  User                   `gorm:"foreignKey:UpdatorId"`
}

func (*PolicyTemplate) AfterFind

func (pt *PolicyTemplate) AfterFind(tx *gorm.DB) (err error)

func (*PolicyTemplate) BeforeCreate

func (pt *PolicyTemplate) BeforeCreate(tx *gorm.DB) (err error)

func (*PolicyTemplate) IsOrganizationTemplate

func (pt *PolicyTemplate) IsOrganizationTemplate() bool

func (*PolicyTemplate) IsPermittedToOrganization

func (pt *PolicyTemplate) IsPermittedToOrganization(organizationId *string) bool

func (*PolicyTemplate) IsTksTemplate

func (pt *PolicyTemplate) IsTksTemplate() bool

func (*PolicyTemplate) ResoureName

func (pt *PolicyTemplate) ResoureName() string

type PolicyTemplatePermittedOrganization

type PolicyTemplatePermittedOrganization struct {
	PolicyTemplateId uuid.UUID `gorm:"primarykey"`
	OrganizationId   string    `gorm:"primarykey"`
}

type PolicyTemplateSupportedVersion

type PolicyTemplateSupportedVersion struct {
	gorm.Model

	PolicyTemplateId uuid.UUID `gorm:"index:template_version,unique"`
	Version          string    `gorm:"index:template_version,unique"`

	ParameterSchema string  `gorm:"type:text"`
	Rego            string  `gorm:"type:text"`
	Libs            string  `gorm:"type:text"`
	SyncKinds       *string `gorm:"type:text"`
	SyncJson        *string `gorm:"type:text"`
}

type Project

type Project struct {
	ID                string             `gorm:"primarykey" json:"id"`
	OrganizationId    string             `json:"organizationId"`
	Name              string             `gorm:"index" json:"name"`
	Description       string             `json:"description,omitempty"`
	CreatedAt         time.Time          `gorm:"autoCreateTime:false" json:"createdAt"`
	UpdatedAt         *time.Time         `gorm:"autoUpdateTime:false" json:"updatedAt"`
	DeletedAt         *time.Time         `json:"deletedAt"`
	ProjectMembers    []ProjectMember    `gorm:"foreignKey:ProjectId;constraint:OnUpdate:RESTRICT,OnDelete:RESTRICT" json:"projectMembers,omitempty"`
	ProjectNamespaces []ProjectNamespace `gorm:"foreignKey:ProjectId;constraint:OnUpdate:RESTRICT,OnDelete:RESTRICT" json:"projectNamespaces,omitempty"`
}

type ProjectMember

type ProjectMember struct {
	ID              string       `gorm:"primarykey" json:"id"`
	ProjectId       string       `gorm:"not null" json:"projectId"`
	ProjectUserId   uuid.UUID    `json:"projectUserId"`
	ProjectUser     *ProjectUser `gorm:"foreignKey:ProjectUserId;references:ID;constraint:OnUpdate:RESTRICT,OnDelete:RESTRICT" json:"projectUser"`
	ProjectRoleId   string       `json:"projectRoleId"`
	ProjectRole     *ProjectRole `gorm:"foreignKey:ProjectRoleId;references:ID;constraint:OnUpdate:RESTRICT,OnDelete:RESTRICT" json:"projectRole"`
	IsProjectLeader bool         `gorm:"default:false" json:"projectLeader"`
	CreatedAt       time.Time    `gorm:"autoCreateTime:false" json:"createdAt"`
	UpdatedAt       *time.Time   `gorm:"autoUpdateTime:false" json:"updatedAt"`
	DeletedAt       *time.Time   `json:"deletedAt"`
}

type ProjectNamespace

type ProjectNamespace struct {
	StackId     string        `gorm:"primarykey" json:"stackId"`
	Namespace   string        `gorm:"primarykey" json:"namespace"`
	Stack       *ProjectStack `gorm:"foreignKey:StackId;references:ID;constraint:OnUpdate:RESTRICT,OnDelete:RESTRICT" json:"stack"`
	ProjectId   string        `gorm:"not null" json:"projectId"`
	Description string        `json:"description,omitempty"`
	Status      string        `json:"status,omitempty"`
	GrafanaUrl  string        `gorm:"-:all" json:"grafanaUrl,omitempty"`
	CreatedAt   time.Time     `gorm:"autoCreateTime:false" json:"createdAt"`
	UpdatedAt   *time.Time    `gorm:"autoUpdateTime:false" json:"updatedAt"`
	DeletedAt   *time.Time    `json:"deletedAt"`
}

type ProjectRole

type ProjectRole struct {
	ID          string     `gorm:"primarykey" json:"id"`
	Name        string     `json:"name"` // project-leader, project-member, project-viewer
	Description string     `json:"description,omitempty"`
	CreatedAt   time.Time  `gorm:"autoCreateTime:false" json:"createdAt" `
	UpdatedAt   *time.Time `gorm:"autoUpdateTime:false" json:"updatedAt"`
	DeletedAt   *time.Time `json:"deletedAt"`
}

func (*ProjectRole) BeforeCreate

func (t *ProjectRole) BeforeCreate(*gorm.DB) (err error)

type ProjectStack

type ProjectStack struct {
	ID             string `gorm:"primarykey" json:"id"`
	OrganizationId string `json:"organizationId"`
	Name           string `json:"name"`
}

func (ProjectStack) TableName

func (ProjectStack) TableName() string

type ProjectUser

type ProjectUser struct {
	ID          uuid.UUID `gorm:"primarykey;type:uuid" json:"id"`
	AccountId   string    `json:"accountId"`
	Name        string    `json:"name"`
	Email       string    `json:"email"`
	Department  string    `json:"department"`
	Description string    `json:"description"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

func (ProjectUser) TableName

func (ProjectUser) TableName() string

type Role

type Role struct {
	gorm.Model

	ID             string       `gorm:"primarykey;" json:"id"`
	Name           string       `json:"name"`
	OrganizationID string       `json:"organizationId"`
	Organization   Organization `gorm:"foreignKey:OrganizationID;references:ID;" json:"organization"`
	Type           string       `json:"type"`
	Description    string       `json:"description"`
	Creator        uuid.UUID    `json:"creator"`
	CreatedAt      time.Time    `json:"createdAt"`
	UpdatedAt      time.Time    `json:"updatedAt"`
}

type Stack

type Stack = struct {
	gorm.Model

	ID              domain.StackId
	Name            string
	Description     string
	ClusterId       string
	OrganizationId  string
	CloudService    string
	CloudAccountId  uuid.UUID
	CloudAccount    CloudAccount
	StackTemplateId uuid.UUID
	StackTemplate   StackTemplate
	Status          domain.StackStatus
	StatusDesc      string
	PrimaryCluster  bool
	GrafanaUrl      string
	CreatorId       *uuid.UUID
	Creator         User
	UpdatorId       *uuid.UUID
	Updator         User
	Favorited       bool
	ClusterEndpoint string
	Resource        domain.DashboardStack
	PolicyIds       []string
	Conf            StackConf
	AppServeAppCnt  int
}

type StackConf

type StackConf struct {
	TksCpNode        int
	TksCpNodeMax     int
	TksCpNodeType    string
	TksInfraNode     int
	TksInfraNodeMax  int
	TksInfraNodeType string
	TksUserNode      int
	TksUserNodeMax   int
	TksUserNodeType  string
}

type StackTemplate

type StackTemplate struct {
	gorm.Model

	ID              uuid.UUID `gorm:"primarykey"`
	Name            string    `gorm:"index,unique"`
	Description     string    `gorm:"index"`
	Template        string
	TemplateType    string
	Version         string
	CloudService    string
	Platform        string
	KubeVersion     string
	KubeType        string
	Organizations   []Organization `gorm:"many2many:stack_template_organizations"`
	Services        datatypes.JSON
	ServiceIds      []string   `gorm:"-:all"`
	OrganizationIds []string   `gorm:"-:all"`
	CreatorId       *uuid.UUID `gorm:"type:uuid"`
	Creator         User       `gorm:"foreignKey:CreatorId"`
	UpdatorId       *uuid.UUID `gorm:"type:uuid"`
	Updator         User       `gorm:"foreignKey:UpdatorId"`
}

type StackTemplateOrganization

type StackTemplateOrganization struct {
	StackTemplateId uuid.UUID `gorm:"primarykey"`
	OrganizationId  string    `gorm:"primarykey"`
}

type SystemNotification

type SystemNotification struct {
	gorm.Model

	ID                        uuid.UUID `gorm:"primarykey"`
	Name                      string
	NotificationType          string `gorm:"default:SYSTEM_NOTIFICATION"`
	OrganizationId            string
	Organization              Organization `gorm:"foreignKey:OrganizationId"`
	ClusterId                 domain.ClusterId
	Cluster                   Cluster `gorm:"foreignKey:ClusterId"`
	Severity                  string
	MessageTitle              string
	MessageContent            string
	MessageActionProposal     string
	Node                      string
	GrafanaUrl                string
	FiredAt                   *time.Time                 `gorm:"-:all"`
	TakedAt                   *time.Time                 `gorm:"-:all"`
	ClosedAt                  *time.Time                 `gorm:"-:all"`
	TakedSec                  int                        `gorm:"-:all"`
	ProcessingSec             int                        `gorm:"-:all"`
	LastTaker                 User                       `gorm:"-:all"`
	SystemNotificationActions []SystemNotificationAction `gorm:"foreignKey:SystemNotificationId;constraint:OnUpdate:RESTRICT,OnDelete:RESTRICT"`
	Summary                   string
	RawData                   datatypes.JSON
	Status                    domain.SystemNotificationActionStatus `gorm:"index"`
	Read                      bool                                  `gorm:"-:all"`
	Readers                   []User                                `gorm:"many2many:system_notification_users;constraint:OnUpdate:RESTRICT,OnDelete:RESTRICT"`
	SystemNotificationRuleId  *uuid.UUID
	PolicyName                string
}

Models

type SystemNotificationAction

type SystemNotificationAction struct {
	gorm.Model

	ID                   uuid.UUID `gorm:"primarykey"`
	SystemNotificationId uuid.UUID
	Content              string
	Status               domain.SystemNotificationActionStatus
	TakerId              *uuid.UUID `gorm:"type:uuid"`
	Taker                User       `gorm:"foreignKey:TakerId"`
}

type SystemNotificationCondition

type SystemNotificationCondition struct {
	gorm.Model

	SystemNotificationRuleId uuid.UUID
	Severity                 string
	Duration                 string
	Parameter                datatypes.JSON
	Parameters               []domain.SystemNotificationParameter `gorm:"-:all"`
	EnableEmail              bool
	EnablePortal             bool
}

type SystemNotificationMetricParameter

type SystemNotificationMetricParameter struct {
	gorm.Model

	SystemNotificationTemplateId uuid.UUID
	Order                        int
	Key                          string
	Value                        string
}

Models

type SystemNotificationRule

type SystemNotificationRule struct {
	gorm.Model

	ID                           uuid.UUID `gorm:"primarykey"`
	Name                         string    `gorm:"index,unique"`
	Description                  string
	NotificationType             string `gorm:"default:SYSTEM_NOTIFICATION"`
	OrganizationId               string
	Organization                 Organization `gorm:"foreignKey:OrganizationId"`
	IsSystem                     bool         `gorm:"default:false"`
	SystemNotificationTemplateId uuid.UUID
	SystemNotificationTemplate   SystemNotificationTemplate  `gorm:"foreignKey:SystemNotificationTemplateId"`
	SystemNotificationCondition  SystemNotificationCondition `gorm:"foreignKey:SystemNotificationRuleId"`
	TargetUsers                  []User                      `gorm:"many2many:system_notification_rule_users;constraint:OnUpdate:RESTRICT,OnDelete:RESTRICT"`
	TargetUserIds                []string                    `gorm:"-:all"`
	MessageTitle                 string
	MessageContent               string
	MessageActionProposal        string
	Status                       domain.SystemNotificationRuleStatus
	CreatorId                    *uuid.UUID `gorm:"type:uuid"`
	Creator                      *User      `gorm:"foreignKey:CreatorId"`
	UpdatorId                    *uuid.UUID `gorm:"type:uuid"`
	Updator                      *User      `gorm:"foreignKey:UpdatorId"`
}

type SystemNotificationTemplate

type SystemNotificationTemplate struct {
	gorm.Model

	ID               uuid.UUID      `gorm:"primarykey"`
	Name             string         `gorm:"index:idx_name,unique"`
	NotificationType string         `gorm:"default:SYSTEM_NOTIFICATION"`
	IsSystem         bool           `gorm:"default:false"`
	Organizations    []Organization `gorm:"many2many:system_notification_template_organizations;constraint:OnUpdate:RESTRICT,OnDelete:RESTRICT"`
	OrganizationIds  []string       `gorm:"-:all"`
	Description      string
	MetricQuery      string
	MetricParameters []SystemNotificationMetricParameter `gorm:"foreignKey:SystemNotificationTemplateId;constraint:OnUpdate:RESTRICT,OnDelete:RESTRICT"`
	CreatorId        *uuid.UUID
	Creator          User `gorm:"foreignKey:CreatorId"`
	UpdatorId        *uuid.UUID
	Updator          User `gorm:"foreignKey:UpdatorId"`
}

type UsageCount

type UsageCount struct {
	OrganizationId   string
	OrganizationName string
	UsageCount       int
}

type User

type User struct {
	gorm.Model

	ID                uuid.UUID `gorm:"primarykey;type:uuid" json:"id"`
	AccountId         string    `json:"accountId"`
	Password          string    `gorm:"-:all" json:"password"`
	Name              string    `json:"name"`
	Token             string    `json:"token"`
	Roles             []Role    `gorm:"many2many:user_roles;" json:"roles"`
	OrganizationId    string
	Organization      Organization `gorm:"foreignKey:OrganizationId;references:ID" json:"organization"`
	Creator           string       `json:"creator"`
	CreatedAt         time.Time    `json:"createdAt"`
	UpdatedAt         time.Time    `json:"updatedAt"`
	PasswordUpdatedAt time.Time    `json:"passwordUpdatedAt"`
	PasswordExpired   bool         `gorm:"-:all" json:"passwordExpired"`

	Email       string `json:"email"`
	Department  string `json:"department"`
	Description string `json:"description"`
}

func (*User) BeforeDelete

func (u *User) BeforeDelete(db *gorm.DB) (err error)

Jump to

Keyboard shortcuts

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