mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
feat: reinitialize agents when a prebuilt workspace is claimed (#17475)
This pull request allows coder workspace agents to be reinitialized when a prebuilt workspace is claimed by a user. This facilitates the transfer of ownership between the anonymous prebuilds system user and the new owner of the workspace. Only a single agent per prebuilt workspace is supported for now, but plumbing has already been done to facilitate the seamless transition to multi-agent support. --------- Signed-off-by: Danny Kopping <dannykopping@gmail.com> Co-authored-by: Danny Kopping <dannykopping@gmail.com>
This commit is contained in:
32
docs/reference/api/agents.md
generated
32
docs/reference/api/agents.md
generated
@ -470,6 +470,38 @@ curl -X PATCH http://coder-server:8080/api/v2/workspaceagents/me/logs \
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## Get workspace agent reinitialization
|
||||
|
||||
### Code samples
|
||||
|
||||
```shell
|
||||
# Example request using curl
|
||||
curl -X GET http://coder-server:8080/api/v2/workspaceagents/me/reinit \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'Coder-Session-Token: API_KEY'
|
||||
```
|
||||
|
||||
`GET /workspaceagents/me/reinit`
|
||||
|
||||
### Example responses
|
||||
|
||||
> 200 Response
|
||||
|
||||
```json
|
||||
{
|
||||
"reason": "prebuild_claimed",
|
||||
"workspaceID": "string"
|
||||
}
|
||||
```
|
||||
|
||||
### Responses
|
||||
|
||||
| Status | Meaning | Description | Schema |
|
||||
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------|
|
||||
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [agentsdk.ReinitializationEvent](schemas.md#agentsdkreinitializationevent) |
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## Get workspace agent by ID
|
||||
|
||||
### Code samples
|
||||
|
30
docs/reference/api/schemas.md
generated
30
docs/reference/api/schemas.md
generated
@ -182,6 +182,36 @@
|
||||
| `icon` | string | false | | |
|
||||
| `id` | string | false | | ID is a unique identifier for the log source. It is scoped to a workspace agent, and can be statically defined inside code to prevent duplicate sources from being created for the same agent. |
|
||||
|
||||
## agentsdk.ReinitializationEvent
|
||||
|
||||
```json
|
||||
{
|
||||
"reason": "prebuild_claimed",
|
||||
"workspaceID": "string"
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|---------------|--------------------------------------------------------------------|----------|--------------|-------------|
|
||||
| `reason` | [agentsdk.ReinitializationReason](#agentsdkreinitializationreason) | false | | |
|
||||
| `workspaceID` | string | false | | |
|
||||
|
||||
## agentsdk.ReinitializationReason
|
||||
|
||||
```json
|
||||
"prebuild_claimed"
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
#### Enumerated Values
|
||||
|
||||
| Value |
|
||||
|--------------------|
|
||||
| `prebuild_claimed` |
|
||||
|
||||
## aisdk.Attachment
|
||||
|
||||
```json
|
||||
|
Reference in New Issue
Block a user