| | |
| | | Password string `json:"password"` |
| | | ClusterName string `json:"clusterName"` |
| | | ClusterId string `json:"clusterId"` |
| | | VirtualIp string `json:"virtualIp"` |
| | | } |
| | | |
| | | type ClusterSearchVo struct { |
| | |
| | | NodeIps []string `json:"nodeIps"` |
| | | } |
| | | |
| | | type ClusterDb struct { |
| | | ClusterId string `json:"clusterId"` |
| | | ClusterName string `json:"clusterName"` |
| | | Nodes []NodeDb `json:"nodes"` |
| | | } |
| | | type NodeDb struct { |
| | | Id string `json:"id"` |
| | | ClusterId string `json:"cluster_id"` |
| | | NodeName string `json:"node_name"` |
| | | NodeId string `json:"node_id"` |
| | | NodeIp string `json:"node_ip"` |
| | | CreateTime string `json:"create_time"` |
| | | IsDelete bool `json:"isDelete"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 创建集群 |
| | | // @Description 创建集群 |
| | | // @Accept json |
| | |
| | | return |
| | | } |
| | | var api dbapi.ClusterApi |
| | | b, d := api.Create(clusterVo.ClusterName, clusterVo.Password) |
| | | b, d := api.Create(clusterVo.ClusterName, clusterVo.Password, clusterVo.VirtualIp) |
| | | if b { |
| | | util.ResponseFormat(c,code.Success, d) |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 生成集群6位随机密码 |
| | | // @Description 生成集群6位随机密码 |
| | | // @Produce json |
| | |
| | | util.ResponseFormat(c,code.Success,pwd) |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查询本地集群 |
| | | // @Description 查询本地集群 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 搜索集群 |
| | | // @Description 搜索集群 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 通过searchNum异步获取集群节点信息 |
| | | // @Description 通过searchNum异步获取集群节点信息 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 通过searchNum停止搜索 |
| | | // @Description 通过searchNum停止搜索 |
| | | // @Produce json |
| | | // @Tags cluster |
| | | // @Param searchNum query string true "搜索编号" |
| | | // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" |
| | | // @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}" |
| | | // @Router /data/api-v/cluster/stopSearching [post] |
| | | func (cc ClusterController) StopSearching(c *gin.Context) { |
| | | searchNum := c.Query("searchNum") |
| | | if searchNum == "" { |
| | | util.ResponseFormat(c,code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | var api dbapi.ClusterApi |
| | | b, d := api.StopSearching(searchNum) |
| | | b, d := api.StopSearching("") |
| | | if b { |
| | | util.ResponseFormat(c,code.Success, d) |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 加入集群 |
| | | // @Description 加入集群 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags cluster |
| | | // @Param clusterArg body controllers.ClusterCreateVo true "集群创建参数" |
| | | // @Param clusterArg body controllers.ClusterJoinVo true "集群创建参数" |
| | | // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" |
| | | // @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}" |
| | | // @Router /data/api-v/cluster/joinCluster [post] |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 保存集群名称 |
| | | // @Description 保存集群名称 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags cluster |
| | | // @Param clusterName query string true "集群名称" |
| | | // @Param clusterName formData string true "集群名称" |
| | | // @Param virtualIp formData string false "虚拟ip" |
| | | // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" |
| | | // @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}" |
| | | // @Router /data/api-v/cluster/updateClusterName [post] |
| | |
| | | util.ResponseFormat(c,code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | virtualIp := c.PostForm("virtualIp") |
| | | var api dbapi.ClusterApi |
| | | b,_ := api.UpdateClusterName(clusterName) |
| | | b,_ := api.UpdateClusterName(clusterName,virtualIp) |
| | | if b { |
| | | util.ResponseFormat(c,code.UpdateSuccess,"更新成功") |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 退出集群 |
| | | // @Description 退出集群 |
| | | // @Produce json |