(ctx *gin.Context)
| 197 | } |
| 198 | |
| 199 | func (h *Helm) MigrateHelmRelease(ctx *gin.Context) { |
| 200 | ctx.Header("Access-Control-Allow-Origin", "*") |
| 201 | |
| 202 | var req dto.Module |
| 203 | if err := ctx.BindJSON(&req); err != nil { |
| 204 | ctx.JSON(http.StatusBadRequest, dto.NewError("Error binding values", err.Error())) |
| 205 | return |
| 206 | } |
| 207 | |
| 208 | module, err := mapper.RequestToModule(req) |
| 209 | if err != nil { |
| 210 | ctx.JSON(http.StatusInternalServerError, dto.NewError("Error mapping module", err.Error())) |
| 211 | return |
| 212 | } |
| 213 | |
| 214 | //if len(m.moduleTargetNamespace) > 0 { |
| 215 | // module.Spec.TargetNamespace = m.moduleTargetNamespace |
| 216 | //} |
| 217 | |
| 218 | h.telemetryClient.ReleaseMigration() |
| 219 | |
| 220 | err = h.kubernetesClient.CreateModule(module) |
| 221 | if err != nil { |
| 222 | fmt.Println(err) |
| 223 | ctx.JSON(http.StatusInternalServerError, dto.NewError("Error creating module", err.Error())) |
| 224 | return |
| 225 | } |
| 226 | |
| 227 | if err := h.kubernetesClient.DeleteReleaseSecret(req.Name, req.Namespace); err != nil { |
| 228 | fmt.Println(err) |
| 229 | ctx.JSON(http.StatusInternalServerError, dto.NewError("Error creating module", err.Error())) |
| 230 | return |
| 231 | } |
| 232 | |
| 233 | ctx.Status(http.StatusCreated) |
| 234 | } |
nothing calls this directly
no test coverage detected