feat(coderd): add support for presets to the coder API

This commit is contained in:
Sas Swart
2025-02-11 14:23:14 +00:00
parent 34b46f9205
commit dcf47ab30d
10 changed files with 544 additions and 17 deletions

View File

@ -4427,6 +4427,40 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
| `address` | [serpent.HostPort](#serpenthostport) | false | | |
| `enable` | boolean | false | | |
## codersdk.Preset
```json
{
"id": "string",
"name": "string"
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|--------|--------|----------|--------------|-------------|
| `id` | string | false | | |
| `name` | string | false | | |
## codersdk.PresetParameter
```json
{
"name": "string",
"presetID": "string",
"value": "string"
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|------------|--------|----------|--------------|-------------|
| `name` | string | false | | |
| `presetID` | string | false | | |
| `value` | string | false | | |
## codersdk.PrometheusConfig
```json

View File

@ -2672,6 +2672,108 @@ curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/p
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Get template version presets
### Code samples
```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/presets \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
`GET /templateversions/{templateversion}/presets`
### Parameters
| Name | In | Type | Required | Description |
|-------------------|------|--------------|----------|---------------------|
| `templateversion` | path | string(uuid) | true | Template version ID |
### Example responses
> 200 Response
```json
[
{
"id": "string",
"name": "string"
}
]
```
### Responses
| Status | Meaning | Description | Schema |
|--------|---------------------------------------------------------|-------------|-------------------------------------------------------|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.Preset](schemas.md#codersdkpreset) |
<h3 id="get-template-version-presets-responseschema">Response Schema</h3>
Status Code **200**
| Name | Type | Required | Restrictions | Description |
|----------------|--------|----------|--------------|-------------|
| `[array item]` | array | false | | |
| `» id` | string | false | | |
| `» name` | string | false | | |
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Get template version preset parameters
### Code samples
```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/presets/parameters \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
`GET /templateversions/{templateversion}/presets/parameters`
### Parameters
| Name | In | Type | Required | Description |
|-------------------|------|--------------|----------|---------------------|
| `templateversion` | path | string(uuid) | true | Template version ID |
### Example responses
> 200 Response
```json
[
{
"name": "string",
"presetID": "string",
"value": "string"
}
]
```
### Responses
| Status | Meaning | Description | Schema |
|--------|---------------------------------------------------------|-------------|-------------------------------------------------------------------------|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.PresetParameter](schemas.md#codersdkpresetparameter) |
<h3 id="get-template-version-preset-parameters-responseschema">Response Schema</h3>
Status Code **200**
| Name | Type | Required | Restrictions | Description |
|----------------|--------|----------|--------------|-------------|
| `[array item]` | array | false | | |
| `» name` | string | false | | |
| `» presetID` | string | false | | |
| `» value` | string | false | | |
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Get resources by template version
### Code samples