反馈server工作区的创建情况
(callbackAPI string, feedbackCommand FeedbackCommandEnum, cmd *cobra.Command, isSuccess bool, webidePort *int, workspaceInfo workspace.WorkspaceInfo)
| 213 | |
| 214 | // 反馈server工作区的创建情况 |
| 215 | func Send_WorkspaceInfo(callbackAPI string, feedbackCommand FeedbackCommandEnum, cmd *cobra.Command, |
| 216 | isSuccess bool, webidePort *int, workspaceInfo workspace.WorkspaceInfo) error { |
| 217 | |
| 218 | serverFeedbackUrl := callbackAPI |
| 219 | configFileContent, _ := workspaceInfo.ConfigYaml.ToYaml() |
| 220 | tempYamlContent, _ := workspaceInfo.TempDockerCompose.ToYaml() |
| 221 | linkYmalContent, _ := workspaceInfo.ConfigYaml.Workspace.LinkCompose.ToYaml() |
| 222 | if workspaceInfo.Mode == workspace.WorkingMode_K8s { |
| 223 | tempYamlContent, _ = workspaceInfo.K8sInfo.TempK8sConfig.ConvertToK8sYaml() |
| 224 | linkYmalContent, _ = workspaceInfo.K8sInfo.OriginK8sYaml.ConvertToK8sYaml() |
| 225 | } |
| 226 | |
| 227 | extend := workspaceInfo.Extend.ToJson() |
| 228 | |
| 229 | //2. |
| 230 | datas := map[string]interface{}{ |
| 231 | "command": string(feedbackCommand), |
| 232 | "isSuccess": isSuccess, |
| 233 | } |
| 234 | if feedbackCommand == FeedbackCommandEnum_Start { // 只有start的时候,才需要传递文件内容 |
| 235 | datas["configFileContent"] = configFileContent |
| 236 | datas["tempDockerComposeContent"] = tempYamlContent |
| 237 | datas["linkDockerCompose"] = linkYmalContent |
| 238 | datas["extend"] = extend |
| 239 | } else if feedbackCommand == FeedbackCommandEnum_Ingress || feedbackCommand == FeedbackCommandEnum_ApplySSH { |
| 240 | datas["extend"] = extend |
| 241 | } |
| 242 | headers := map[string]string{"Content-Type": "application/json"} |
| 243 | |
| 244 | httpClient := common.CreateHttpClient(6, 30*time.Second, 3*time.Second, common.ResponseBodyTypeEnum_JSON) |
| 245 | _, err := httpClient.PostJson(serverFeedbackUrl, datas, headers) // post 请求 |
| 246 | |
| 247 | if err != nil { |
| 248 | return err |
| 249 | } |
| 250 | |
| 251 | common.SmartIDELog.InfoF(i18nInstance.VmStart.Info_callback_msg, callbackAPI) |
| 252 | |
| 253 | return nil |
| 254 | } |
nothing calls this directly
no test coverage detected