@Summary Get provisioner job @ID get-provisioner-job @Security CoderSessionToken @Produce json @Tags Organizations @Param organization path string true "Organization ID" format(uuid) @Param job path string true "Job ID" format(uuid) @Success 200 {object} codersdk.ProvisionerJob @Router /api/v2/organ
(rw http.ResponseWriter, r *http.Request)
| 40 | // @Success 200 {object} codersdk.ProvisionerJob |
| 41 | // @Router /api/v2/organizations/{organization}/provisionerjobs/{job} [get] |
| 42 | func (api *API) provisionerJob(rw http.ResponseWriter, r *http.Request) { |
| 43 | ctx := r.Context() |
| 44 | |
| 45 | jobID, ok := httpmw.ParseUUIDParam(rw, r, "job") |
| 46 | if !ok { |
| 47 | return |
| 48 | } |
| 49 | |
| 50 | jobs, ok := api.handleAuthAndFetchProvisionerJobs(rw, r, []uuid.UUID{jobID}) |
| 51 | if !ok { |
| 52 | return |
| 53 | } |
| 54 | if len(jobs) == 0 { |
| 55 | httpapi.ResourceNotFound(rw) |
| 56 | return |
| 57 | } |
| 58 | if len(jobs) > 1 || jobs[0].ProvisionerJob.ID != jobID { |
| 59 | httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ |
| 60 | Message: "Internal error fetching provisioner job.", |
| 61 | Detail: "Database returned an unexpected job.", |
| 62 | }) |
| 63 | return |
| 64 | } |
| 65 | |
| 66 | httpapi.Write(ctx, rw, http.StatusOK, convertProvisionerJobWithQueuePosition(jobs[0])) |
| 67 | } |
| 68 | |
| 69 | // @Summary Get provisioner jobs |
| 70 | // @ID get-provisioner-jobs |
nothing calls this directly
no test coverage detected