mirror of
https://github.com/coder/coder.git
synced 2026-09-22 21:22:17 +08:00
> [!NOTE] > This PR was authored by Coder Agents on behalf of @jeremyruppel. Part 4 of DEVEX-277 (POST /api/v2/templatebuilder/compose). Adds the HTTP handler, route wiring, and integration tests for the compose endpoint. The handler accepts a JSON request with a base template ID and optional modules with variable overrides, renders them via `Compose`/`BundleTar`, and returns the tar archive directly with `Content-Type: application/x-tar`. The registry URL comes from the deployment config (`CODER_TEMPLATE_BUILDER_REGISTRY_URL`). RBAC uses `policy.ActionCreate` on `rbac.ResourceTemplate.AnyOrganization()`. Integration tests cover: base-only compose, base with modules, unknown base/module errors, missing base template ID, and feature-disabled 404.
4.2 KiB
Generated
4.2 KiB
Generated
TemplateBuilder
List template builder base templates
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/templatebuilder/bases \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
GET /api/v2/templatebuilder/bases
Example responses
200 Response
{
"bases": [
{
"description": "string",
"icon": "string",
"id": "string",
"name": "string",
"os": "string"
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.TemplateBuilderBasesResponse |
To perform this operation, you must be authenticated. Learn more.
Compose template from base and modules
Code samples
# Example request using curl
curl -X POST http://coder-server:8080/api/v2/templatebuilder/compose \
-H 'Content-Type: application/json' \
-H 'Coder-Session-Token: API_KEY'
POST /api/v2/templatebuilder/compose
Body parameter
{
"base_template_id": "string",
"modules": [
{
"id": "string",
"variables": {
"property1": "string",
"property2": "string"
}
}
]
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
body |
body | codersdk.TemplateBuilderComposeRequest | true | Compose request |
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK |
To perform this operation, you must be authenticated. Learn more.
List template builder modules
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/templatebuilder/modules \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
GET /api/v2/templatebuilder/modules
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
base |
query | string | false | Base template example ID for OS-compatibility filtering |
Example responses
200 Response
{
"modules": [
{
"category": "string",
"compatible_os": [
"string"
],
"conflicts_with": [
"string"
],
"description": "string",
"display_name": "string",
"icon": "string",
"id": "string",
"variables": [
{
"default": [
0
],
"description": "string",
"name": "string",
"required": true,
"sensitive": true,
"type": "string"
}
],
"version": "string"
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.TemplateBuilderModulesResponse |
To perform this operation, you must be authenticated. Learn more.