mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
feat: Expose managed variables via API (#6134)
* WIP * hcl * useManagedVariables * fix * Fix * Fix * fix * go:build * Fix * fix: bool flag * Insert template variables * API * fix * Expose via API * More wiring * CLI for testing purposes * WIP * Delete FIXME * planVars * WIP * WIP * UserVariableValues * no dry run * Dry run * Done FIXME * Fix * Fix: CLI * Fix: migration * API tests * Test info * Tests * More tests * fix: lint * Fix: authz * Address PR comments * Fix * fix * fix
This commit is contained in:
@ -1000,6 +1000,12 @@ CreateParameterRequest is a structure used to create a new parameter value for a
|
||||
"value": "string"
|
||||
}
|
||||
],
|
||||
"user_variable_values": [
|
||||
{
|
||||
"name": "string",
|
||||
"value": "string"
|
||||
}
|
||||
],
|
||||
"workspace_name": "string"
|
||||
}
|
||||
```
|
||||
@ -1010,6 +1016,7 @@ CreateParameterRequest is a structure used to create a new parameter value for a
|
||||
| ----------------------- | ----------------------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------- |
|
||||
| `parameter_values` | array of [codersdk.CreateParameterRequest](#codersdkcreateparameterrequest) | false | | Parameter values is a structure used to create a new parameter value for a scope.] |
|
||||
| `rich_parameter_values` | array of [codersdk.WorkspaceBuildParameter](#codersdkworkspacebuildparameter) | false | | |
|
||||
| `user_variable_values` | array of [codersdk.VariableValue](#codersdkvariablevalue) | false | | |
|
||||
| `workspace_name` | string | false | | |
|
||||
|
||||
## codersdk.CreateTestAuditLogRequest
|
||||
@ -4638,6 +4645,40 @@ Parameter represents a set value for the scope.
|
||||
| `name` | string | false | | |
|
||||
| `value` | string | false | | |
|
||||
|
||||
## codersdk.TemplateVersionVariable
|
||||
|
||||
```json
|
||||
{
|
||||
"default_value": "string",
|
||||
"description": "string",
|
||||
"name": "string",
|
||||
"required": true,
|
||||
"sensitive": true,
|
||||
"type": "string",
|
||||
"value": "string"
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
| --------------- | ------- | -------- | ------------ | ----------- |
|
||||
| `default_value` | string | false | | |
|
||||
| `description` | string | false | | |
|
||||
| `name` | string | false | | |
|
||||
| `required` | boolean | false | | |
|
||||
| `sensitive` | boolean | false | | |
|
||||
| `type` | string | false | | |
|
||||
| `value` | string | false | | |
|
||||
|
||||
#### Enumerated Values
|
||||
|
||||
| Property | Value |
|
||||
| -------- | -------- |
|
||||
| `type` | `string` |
|
||||
| `type` | `number` |
|
||||
| `type` | `bool` |
|
||||
|
||||
## codersdk.TraceConfig
|
||||
|
||||
```json
|
||||
@ -4946,6 +4987,22 @@ Parameter represents a set value for the scope.
|
||||
| `increasing` |
|
||||
| `decreasing` |
|
||||
|
||||
## codersdk.VariableValue
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "string",
|
||||
"value": "string"
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
| ------- | ------ | -------- | ------------ | ----------- |
|
||||
| `name` | string | false | | |
|
||||
| `value` | string | false | | |
|
||||
|
||||
## codersdk.Workspace
|
||||
|
||||
```json
|
||||
|
@ -560,6 +560,12 @@ curl -X POST http://coder-server:8080/api/v2/organizations/{organization}/templa
|
||||
"value": "string"
|
||||
}
|
||||
],
|
||||
"user_variable_values": [
|
||||
{
|
||||
"name": "string",
|
||||
"value": "string"
|
||||
}
|
||||
],
|
||||
"workspace_name": "string"
|
||||
}
|
||||
```
|
||||
@ -1299,6 +1305,12 @@ curl -X POST http://coder-server:8080/api/v2/templateversions/{templateversion}/
|
||||
"value": "string"
|
||||
}
|
||||
],
|
||||
"user_variable_values": [
|
||||
{
|
||||
"name": "string",
|
||||
"value": "string"
|
||||
}
|
||||
],
|
||||
"workspace_name": "string"
|
||||
}
|
||||
```
|
||||
@ -2246,3 +2258,71 @@ Status Code **200**
|
||||
| `default_source_scheme` | `data` |
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## Get template variables by template version
|
||||
|
||||
### Code samples
|
||||
|
||||
```shell
|
||||
# Example request using curl
|
||||
curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/variables \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'Coder-Session-Token: API_KEY'
|
||||
```
|
||||
|
||||
`GET /templateversions/{templateversion}/variables`
|
||||
|
||||
### Parameters
|
||||
|
||||
| Name | In | Type | Required | Description |
|
||||
| ----------------- | ---- | ------------ | -------- | ------------------- |
|
||||
| `templateversion` | path | string(uuid) | true | Template version ID |
|
||||
|
||||
### Example responses
|
||||
|
||||
> 200 Response
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"default_value": "string",
|
||||
"description": "string",
|
||||
"name": "string",
|
||||
"required": true,
|
||||
"sensitive": true,
|
||||
"type": "string",
|
||||
"value": "string"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Responses
|
||||
|
||||
| Status | Meaning | Description | Schema |
|
||||
| ------ | ------------------------------------------------------- | ----------- | --------------------------------------------------------------------------------------- |
|
||||
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.TemplateVersionVariable](schemas.md#codersdktemplateversionvariable) |
|
||||
|
||||
<h3 id="get-template-variables-by-template-version-responseschema">Response Schema</h3>
|
||||
|
||||
Status Code **200**
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
| ----------------- | ------- | -------- | ------------ | ----------- |
|
||||
| `[array item]` | array | false | | |
|
||||
| `» default_value` | string | false | | |
|
||||
| `» description` | string | false | | |
|
||||
| `» name` | string | false | | |
|
||||
| `» required` | boolean | false | | |
|
||||
| `» sensitive` | boolean | false | | |
|
||||
| `» type` | string | false | | |
|
||||
| `» value` | string | false | | |
|
||||
|
||||
#### Enumerated Values
|
||||
|
||||
| Property | Value |
|
||||
| -------- | -------- |
|
||||
| `type` | `string` |
|
||||
| `type` | `number` |
|
||||
| `type` | `bool` |
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
Reference in New Issue
Block a user