| 39 | } |
| 40 | |
| 41 | type ServerResource struct { |
| 42 | ID int `json:"ID" gorm:"comment:ID"` |
| 43 | CreatedAt time.Time |
| 44 | UpdatedAt time.Time |
| 45 | DeletedAt gorm.DeletedAt |
| 46 | Type int `json:"type" gorm:"not null;type:smallint;default:2;comment:资源类型"` |
| 47 | Name string `json:"name" gorm:"comment:名称"` |
| 48 | AuthenticationType int `json:"authentication_type" gorm:"not null;type:smallint;default:3;comment:认证类型"` |
| 49 | IP string `json:"ip" gorm:"not null;type:string;"` |
| 50 | Status int `json:"status" gorm:"not null;type:smallint;default:0;comment:状态"` |
| 51 | SSHUserName string `json:"username" gorm:"column:user_name;type:string;comment:(k8s)用户名;"` |
| 52 | SSHPassword string `json:"password" gorm:"column:password;type:string;comment:(k8s)密码;"` |
| 53 | SSHKey string `json:"sshkey" gorm:"column:ssh_key;type:text;comment:public access tokent;"` |
| 54 | KubeIngressBaseDNS string `json:"kube_ingress_base_dns" gorm:"column:kube_base_dns;comment:kube base dns;"` |
| 55 | KubeConfig string `json:"kube_config" gorm:"column:kube_config;type:text;comment:kube config;"` |
| 56 | KubeContext string `json:"kube_context" gorm:"column:kube_context;comment:kube context name;"` |
| 57 | OwnerGUID string `json:"ownerGuid" form:"ownerGuid" gorm:"column:owner_guid;type:string;comment:资源的创建人即所有者 GUID;"` |
| 58 | OwnerName string `json:"ownerName" form:"ownerName" gorm:"column:owner_name;type:string;comment:资源的创建人即所有者 账号;"` |
| 59 | IsDefault bool `json:"isDefault" form:"isDefault" gorm:"column:isDefault;type:string;comment:是否默认;"` |
| 60 | Port int `json:"port" form:"port" gorm:"column:port;type:int;comment:端口号;"` |
| 61 | GlobalPublic bool `json:"globalPublic" form:"globalPublic" gorm:"column:globalPublic;type:string;comment:全局共享资源;"` |
| 62 | TeamID int `json:"teamId" form:"teamId" gorm:"column:teamId;type:int;commnent:团队ID"` |
| 63 | CertType int `json:"certtype" form:"certtype" gorm:"column:certtype;type:int;commnent:认证策略类型,1:http,2:静态证书https,3:动态证书https"` |
| 64 | CertCrt string `json:"certcrt" form:"certcrt" gorm:"column:certcrt;type:string;comment:Https证书"` |
| 65 | CertKey string `json:"certkey" form:"certkey" gorm:"column:certkey;type:string;comment:Https证书秘钥"` |
| 66 | } |
| 67 | |
| 68 | func GetResourceByID(auth model.Auth, resourceID string) (serverResource *ServerResource, err error) { |
| 69 | url := fmt.Sprint(auth.LoginUrl, "/api/smartide/resource/find") |
nothing calls this directly
no outgoing calls
no test coverage detected