@@ -223,14 +223,14 @@ func (api *API) postWorkspaceAgentStartup(rw http.ResponseWriter, r *http.Reques
223
223
httpapi .Write (ctx , rw , http .StatusOK , nil )
224
224
}
225
225
226
- // @Summary Submit most recent workspace agent startup logs
227
- // @ID insert-update-startup-script -logs
226
+ // @Summary Patch workspace agent startup logs
227
+ // @ID patch-workspace-agent-startup -logs
228
228
// @Security CoderSessionToken
229
229
// @Accept json
230
230
// @Produce json
231
231
// @Tags Agents
232
232
// @Param request body agentsdk.PatchStartupLogs true "Startup logs"
233
- // @Success 200
233
+ // @Success 200 {object} codersdk.Response
234
234
// @Router /workspaceagents/me/startup-logs [patch]
235
235
// @x-apidocgen {"skip": true}
236
236
func (api * API ) patchWorkspaceAgentStartupLogs (rw http.ResponseWriter , r * http.Request ) {
@@ -337,25 +337,28 @@ func (api *API) patchWorkspaceAgentStartupLogs(rw http.ResponseWriter, r *http.R
337
337
// @Summary Get startup logs by workspace agent
338
338
// @ID get-startup-logs-by-workspace-agent
339
339
// @Security CoderSessionToken
340
- // @Accept json
341
340
// @Produce json
342
341
// @Tags Agents
343
342
// @Param workspaceagent path string true "Workspace agent ID" format(uuid)
344
343
// @Param before query int false "Before log id"
345
344
// @Param after query int false "After log id"
346
345
// @Param follow query bool false "Follow log stream"
347
- // @Success 200
346
+ // @Success 200 {array} codersdk.WorkspaceAgentStartupLog
348
347
// @Router /workspaceagents/{workspaceagent}/startup-logs [get]
349
- // @x-apidocgen {"skip": true}
350
348
func (api * API ) workspaceAgentStartupLogs (rw http.ResponseWriter , r * http.Request ) {
351
349
// This mostly copies how provisioner job logs are streamed!
352
350
var (
353
351
ctx = r .Context ()
354
352
workspaceAgent = httpmw .WorkspaceAgentParam (r )
353
+ workspace = httpmw .WorkspaceParam (r )
355
354
logger = api .Logger .With (slog .F ("workspace_agent_id" , workspaceAgent .ID ))
356
355
follow = r .URL .Query ().Has ("follow" )
357
356
afterRaw = r .URL .Query ().Get ("after" )
358
357
)
358
+ if ! api .Authorize (r , rbac .ActionRead , workspace ) {
359
+ httpapi .ResourceNotFound (rw )
360
+ return
361
+ }
359
362
360
363
var after int64
361
364
// Only fetch logs created after the time provided.
0 commit comments