Skip to content

Commit

Permalink
Delete cvd bug reports.
Browse files Browse the repository at this point in the history
  • Loading branch information
ser-io committed Jul 17, 2024
1 parent b504fdc commit eca63cc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions frontend/src/host_orchestrator/orchestrator/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func (c *Controller) AddRoutes(router *mux.Router) {
router.Handle("/operations/{name}/:wait",
httpHandler(&waitOperationHandler{c.OperationManager, c.WaitOperationDuration})).Methods("POST")
router.Handle("/cvdbugreports/{uuid}", &downloadCVDBugReportHandler{c.Config}).Methods("GET")
router.Handle("/cvdbugreports/{uuid}", httpHandler(&deleteCVDBugReportHandler{c.Config})).Methods("DELETE")
router.Handle("/userartifacts",
httpHandler(&createUploadDirectoryHandler{c.UserArtifactsManager})).Methods("POST")
router.Handle("/userartifacts",
Expand Down Expand Up @@ -391,6 +392,18 @@ func (h *downloadCVDBugReportHandler) ServeHTTP(w http.ResponseWriter, r *http.R
http.ServeFile(w, r, filename)
}

type deleteCVDBugReportHandler struct {
Config Config
}

func (h *deleteCVDBugReportHandler) Handle(r *http.Request) (interface{}, error) {
vars := mux.Vars(r)
uuid := vars["uuid"]
dirName := filepath.Join(h.Config.Paths.CVDBugReportsDir, uuid)
err := os.RemoveAll(dirName)
return nil, err
}

type createUploadDirectoryHandler struct {
m UserArtifactsManager
}
Expand Down

0 comments on commit eca63cc

Please sign in to comment.