(ctx *gin.Context)
| 236 | } |
| 237 | |
| 238 | func (m *Modules) CurrentManifest(ctx *gin.Context) { |
| 239 | ctx.Header("Access-Control-Allow-Origin", "*") |
| 240 | |
| 241 | module, err := m.kubernetesClient.GetModule(ctx.Param("name")) |
| 242 | if err != nil { |
| 243 | fmt.Println(err) |
| 244 | ctx.Status(http.StatusInternalServerError) |
| 245 | return |
| 246 | } |
| 247 | |
| 248 | targetTemplate, err := m.templatesRepo.GetTemplate( |
| 249 | module.Spec.TemplateRef.URL, |
| 250 | module.Spec.TemplateRef.Path, |
| 251 | module.Spec.TemplateRef.Version, |
| 252 | module.Status.TemplateResolvedVersion, |
| 253 | module.Spec.TemplateRef.SourceType, |
| 254 | ) |
| 255 | if err != nil { |
| 256 | fmt.Println(err) |
| 257 | ctx.Status(http.StatusInternalServerError) |
| 258 | return |
| 259 | } |
| 260 | |
| 261 | manifest, err := m.renderer.HelmTemplate(*module, targetTemplate) |
| 262 | if err != nil { |
| 263 | fmt.Println(err) |
| 264 | ctx.Status(http.StatusInternalServerError) |
| 265 | return |
| 266 | } |
| 267 | |
| 268 | manifest = strings.TrimPrefix(manifest, "---\n") |
| 269 | manifest = strings.TrimSuffix(manifest, "---\n") |
| 270 | |
| 271 | ctx.String(http.StatusOK, manifest) |
| 272 | } |
| 273 | |
| 274 | func (m *Modules) DeleteModuleResource(ctx *gin.Context) { |
| 275 | ctx.Header("Access-Control-Allow-Origin", "*") |
nothing calls this directly
no test coverage detected