MCPcopy Index your code
hub / github.com/coder/coder / templateVersionResources

Method templateVersionResources

coderd/templateversions.go:1920–1935  ·  view source on GitHub ↗

templateVersionResources returns the workspace agent resources associated with a template version. A template can specify more than one resource to be provisioned, each resource can have an agent that dials back to coderd. The agents returned are informative of the template version, and do not retur

(rw http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

1918// @Success 200 {array} codersdk.WorkspaceResource
1919// @Router /api/v2/templateversions/{templateversion}/resources [get]
1920func (api *API) templateVersionResources(rw http.ResponseWriter, r *http.Request) {
1921 var (
1922 ctx = r.Context()
1923 templateVersion = httpmw.TemplateVersionParam(r)
1924 )
1925
1926 job, err := api.Database.GetProvisionerJobByID(ctx, templateVersion.JobID)
1927 if err != nil {
1928 httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
1929 Message: "Internal error fetching provisioner job.",
1930 Detail: err.Error(),
1931 })
1932 return
1933 }
1934 api.provisionerJobResources(rw, r, job)
1935}
1936
1937// templateVersionLogs returns the logs returned by the provisioner for the given
1938// template version. These logs are only associated with the template version,

Callers

nothing calls this directly

Calls 6

TemplateVersionParamFunction · 0.92
WriteFunction · 0.92
ContextMethod · 0.65
GetProvisionerJobByIDMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected