@Summary Get deployment stats @ID get-deployment-stats @Security CoderSessionToken @Produce json @Tags General @Success 200 {object} codersdk.DeploymentStats @Router /api/v2/deployment/stats [get]
(rw http.ResponseWriter, r *http.Request)
| 45 | // @Success 200 {object} codersdk.DeploymentStats |
| 46 | // @Router /api/v2/deployment/stats [get] |
| 47 | func (api *API) deploymentStats(rw http.ResponseWriter, r *http.Request) { |
| 48 | if !api.Authorize(r, policy.ActionRead, rbac.ResourceDeploymentStats) { |
| 49 | httpapi.Forbidden(rw) |
| 50 | return |
| 51 | } |
| 52 | |
| 53 | stats, ok := api.metricsCache.DeploymentStats() |
| 54 | if !ok { |
| 55 | httpapi.Write(r.Context(), rw, http.StatusBadRequest, codersdk.Response{ |
| 56 | Message: "Deployment stats are still processing!", |
| 57 | }) |
| 58 | return |
| 59 | } |
| 60 | |
| 61 | httpapi.Write(r.Context(), rw, http.StatusOK, stats) |
| 62 | } |
| 63 | |
| 64 | // @Summary Build info |
| 65 | // @ID build-info |
nothing calls this directly
no test coverage detected