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:
Marcin Tojek
2023-02-15 18:24:15 +01:00
committed by GitHub
parent f0f39b4892
commit 3b7b96ac28
41 changed files with 2423 additions and 667 deletions

86
coderd/apidoc/docs.go generated
View File

@ -2693,6 +2693,44 @@ const docTemplate = `{
}
}
},
"/templateversions/{templateversion}/variables": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Templates"
],
"summary": "Get template variables by template version",
"operationId": "get-template-variables-by-template-version",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Template version ID",
"name": "templateversion",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.TemplateVersionVariable"
}
}
}
}
}
},
"/updatecheck": {
"get": {
"produces": [
@ -5753,6 +5791,12 @@ const docTemplate = `{
"$ref": "#/definitions/codersdk.WorkspaceBuildParameter"
}
},
"user_variable_values": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.VariableValue"
}
},
"workspace_name": {
"type": "string"
}
@ -7681,6 +7725,37 @@ const docTemplate = `{
}
}
},
"codersdk.TemplateVersionVariable": {
"type": "object",
"properties": {
"default_value": {
"type": "string"
},
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"required": {
"type": "boolean"
},
"sensitive": {
"type": "boolean"
},
"type": {
"type": "string",
"enum": [
"string",
"number",
"bool"
]
},
"value": {
"type": "string"
}
}
},
"codersdk.TraceConfig": {
"type": "object",
"properties": {
@ -7918,6 +7993,17 @@ const docTemplate = `{
"MonotonicOrderDecreasing"
]
},
"codersdk.VariableValue": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"codersdk.Workspace": {
"type": "object",
"properties": {