(ctx *gin.Context)
| 162 | } |
| 163 | |
| 164 | func GetLinkInfoHandler(ctx *gin.Context) { |
| 165 | var respData ginmodel.LinkInfo |
| 166 | linkID := ctx.Param("link_id") |
| 167 | nodeIndexStrs := strings.Split(ctx.Param("node_index"), "+") |
| 168 | nodeIndex, err := strconv.Atoi(nodeIndexStrs[0]) |
| 169 | if err != nil { |
| 170 | jsonResp := ginmodel.JsonResp{ |
| 171 | Code: -1, |
| 172 | Message: fmt.Sprintf("Invalid Node Index: %s", err.Error()), |
| 173 | } |
| 174 | ctx.JSON(http.StatusBadRequest, jsonResp) |
| 175 | return |
| 176 | } |
| 177 | link, err := synchronizer.GetLinkInfo(nodeIndex, linkID) |
| 178 | if err != nil { |
| 179 | jsonResp := ginmodel.JsonResp{ |
| 180 | Code: -1, |
| 181 | Message: fmt.Sprintf("Get Link Info of %s Error: %s", linkID, err.Error()), |
| 182 | } |
| 183 | ctx.JSON(http.StatusInternalServerError, jsonResp) |
| 184 | return |
| 185 | } |
| 186 | respData.LinkID = link.GetLinkID() |
| 187 | respData.Type = link.GetLinkType() |
| 188 | respData.Enable = link.GetLinkBasePtr().Enable |
| 189 | respData.Extra = link.GetLinkBasePtr().Extra |
| 190 | respData.NodeIndex = link.NodeIndex |
| 191 | for i := 0; i < len(link.AddressInfos); i++ { |
| 192 | respData.ConnectIntance[i] = link.EndInfos[i].InstanceID |
| 193 | respData.AddressInfos[i] = link.AddressInfos[i] |
| 194 | respData.EndInfos[i] = link.EndInfos[i] |
| 195 | } |
| 196 | jsonResp := ginmodel.JsonResp{ |
| 197 | Code: 0, |
| 198 | Message: "Success", |
| 199 | Data: respData, |
| 200 | } |
| 201 | ctx.JSON(http.StatusOK, jsonResp) |
| 202 | } |
| 203 | |
| 204 | func GetLinkParameterListHandler(ctx *gin.Context) { |
| 205 | respData := map[string]map[string]int64{} |
nothing calls this directly
no test coverage detected