mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +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:
@ -383,6 +383,21 @@ func TemplateVersion(t testing.TB, db database.Store, orig database.TemplateVers
|
||||
return version
|
||||
}
|
||||
|
||||
func TemplateVersionVariable(t testing.TB, db database.Store, orig database.TemplateVersionVariable) database.TemplateVersionVariable {
|
||||
version, err := db.InsertTemplateVersionVariable(context.Background(), database.InsertTemplateVersionVariableParams{
|
||||
TemplateVersionID: takeFirst(orig.TemplateVersionID, uuid.New()),
|
||||
Name: takeFirst(orig.Name, namesgenerator.GetRandomName(1)),
|
||||
Description: takeFirst(orig.Description, namesgenerator.GetRandomName(1)),
|
||||
Type: takeFirst(orig.Type, "string"),
|
||||
Value: takeFirst(orig.Value, ""),
|
||||
DefaultValue: takeFirst(orig.DefaultValue, namesgenerator.GetRandomName(1)),
|
||||
Required: takeFirst(orig.Required, false),
|
||||
Sensitive: takeFirst(orig.Sensitive, false),
|
||||
})
|
||||
require.NoError(t, err, "insert template version variable")
|
||||
return version
|
||||
}
|
||||
|
||||
func ParameterSchema(t testing.TB, db database.Store, seed database.ParameterSchema) database.ParameterSchema {
|
||||
scheme, err := db.InsertParameterSchema(context.Background(), database.InsertParameterSchemaParams{
|
||||
ID: takeFirst(seed.ID, uuid.New()),
|
||||
|
Reference in New Issue
Block a user