PutExtendWorkspace updates the deadline for resources of the latest workspace build.
(ctx context.Context, id uuid.UUID, req PutExtendWorkspaceRequest)
| 336 | |
| 337 | // PutExtendWorkspace updates the deadline for resources of the latest workspace build. |
| 338 | func (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 | |
| 351 | type PostWorkspaceUsageRequest struct { |
| 352 | AgentID uuid.UUID `json:"agent_id" format:"uuid"` |