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

Method PutExtendWorkspace

codersdk/workspaces.go:338–349  ·  view source on GitHub ↗

PutExtendWorkspace updates the deadline for resources of the latest workspace build.

(ctx context.Context, id uuid.UUID, req PutExtendWorkspaceRequest)

Source from the content-addressed store, hash-verified

336
337// PutExtendWorkspace updates the deadline for resources of the latest workspace build.
338func (c *Client) PutExtendWorkspace(ctx context.Context, id uuid.UUID, req PutExtendWorkspaceRequest) error {
339 path := fmt.Sprintf("/api/v2/workspaces/%s/extend", id.String())
340 res, err := c.Request(ctx, http.MethodPut, path, req)
341 if err != nil {
342 return xerrors.Errorf("extend workspace time until shutdown: %w", err)
343 }
344 defer res.Body.Close()
345 if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusNotModified {
346 return ReadBodyAsError(res)
347 }
348 return nil
349}
350
351type PostWorkspaceUsageRequest struct {
352 AgentID uuid.UUID `json:"agent_id" format:"uuid"`

Callers 4

TestWorkspaceExtendFunction · 0.80
scheduleExtendMethod · 0.80

Calls 5

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
StringMethod · 0.45
ErrorfMethod · 0.45

Tested by 3

TestWorkspaceExtendFunction · 0.64