WorkspaceBuildState returns the provisioner state of the build.
(ctx context.Context, build uuid.UUID)
| 190 | |
| 191 | // WorkspaceBuildState returns the provisioner state of the build. |
| 192 | func (c *Client) WorkspaceBuildState(ctx context.Context, build uuid.UUID) ([]byte, error) { |
| 193 | res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/workspacebuilds/%s/state", build), nil) |
| 194 | if err != nil { |
| 195 | return nil, err |
| 196 | } |
| 197 | defer res.Body.Close() |
| 198 | if res.StatusCode != http.StatusOK { |
| 199 | return nil, ReadBodyAsError(res) |
| 200 | } |
| 201 | return io.ReadAll(res.Body) |
| 202 | } |
| 203 | |
| 204 | // UpdateWorkspaceBuildStateRequest is the request body for updating the |
| 205 | // provisioner state of a workspace build. |