()
| 59 | } |
| 60 | |
| 61 | func (s *Server) handleDeleteProject() http.HandlerFunc { |
| 62 | return func(w http.ResponseWriter, r *http.Request) { |
| 63 | |
| 64 | // Close the body of the request |
| 65 | defer utils.CloseTheCloser(r.Body) |
| 66 | |
| 67 | ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) |
| 68 | defer cancel() |
| 69 | |
| 70 | // Verify token |
| 71 | _, err := s.auth.VerifyToken(utils.GetToken(r)) |
| 72 | if err != nil { |
| 73 | _ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Failed to create project", err, nil) |
| 74 | _ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err) |
| 75 | return |
| 76 | } |
| 77 | |
| 78 | vars := mux.Vars(r) |
| 79 | projectID := vars["project"] |
| 80 | // Apply the service config |
| 81 | if err := s.driver.DeleteProject(ctx, projectID); err != nil { |
| 82 | _ = helpers.Logger.LogError(helpers.GetRequestID(ctx), "Failed to create project", err, nil) |
| 83 | _ = helpers.Response.SendErrorResponse(ctx, w, http.StatusInternalServerError, err) |
| 84 | return |
| 85 | } |
| 86 | |
| 87 | _ = helpers.Response.SendOkayResponse(ctx, http.StatusOK, w) |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | func (s *Server) handleApplyService() http.HandlerFunc { |
| 92 | return func(w http.ResponseWriter, r *http.Request) { |
no test coverage detected