package models import "time" type Cluster struct { ID uint `json:"id"` Name string `json:"name"` Description string `json:"description"` ConfigType string `json:"configType"` // kubeconfig | token(空值视为 kubeconfig,向后兼容) APIServer string `json:"apiServer"` // 展示用 KubeConfig string `json:"kubeconfig"` // 统一存储(token 接入时存构造出的等价 kubeconfig) KubeConfigPath string `json:"kubeconfigPath"` Context string `json:"context"` Version string `json:"version"` NodesCount int `json:"nodesCount"` Status string `json:"status"` LastConnected time.Time `json:"lastConnected"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` } func (c *Cluster) Sanitized() map[string]interface{} { return map[string]interface{}{ "id": c.ID, "name": c.Name, "description": c.Description, "configType": c.ConfigType, "apiServer": c.APIServer, "context": c.Context, "version": c.Version, "nodesCount": c.NodesCount, "status": c.Status, "hasKubeconfig": c.KubeConfig != "", "lastConnected": c.LastConnected, "createdAt": c.CreatedAt, "updatedAt": c.UpdatedAt, } }