feat: add controls to template for determining startup days (#10226)

* feat: template controls which days can autostart
* Add unit test to test blocking autostart with DaysOfWeek
This commit is contained in:
Steven Masley
2023-10-13 11:57:18 -05:00
committed by GitHub
parent 98b6c8bcb0
commit 39c0539d42
32 changed files with 825 additions and 144 deletions

34
coderd/apidoc/docs.go generated
View File

@ -7732,6 +7732,14 @@ const docTemplate = `{
"description": "Allow users to cancel in-progress workspace jobs.\n*bool as the default value is \"true\".",
"type": "boolean"
},
"autostart_requirement": {
"description": "AutostartRequirement allows optionally specifying the autostart allowed days\nfor workspaces created from this template. This is an enterprise feature.",
"allOf": [
{
"$ref": "#/definitions/codersdk.TemplateAutostartRequirement"
}
]
},
"autostop_requirement": {
"description": "AutostopRequirement allows optionally specifying the autostop requirement\nfor workspaces created from this template. This is an enterprise feature.",
"allOf": [
@ -9896,8 +9904,11 @@ const docTemplate = `{
"allow_user_cancel_workspace_jobs": {
"type": "boolean"
},
"autostart_requirement": {
"$ref": "#/definitions/codersdk.TemplateAutostartRequirement"
},
"autostop_requirement": {
"description": "AutostopRequirement is an enterprise feature. Its value is only used if\nyour license is entitled to use the advanced template scheduling feature.",
"description": "AutostopRequirement and AutostartRequirement are enterprise features. Its\nvalue is only used if your license is entitled to use the advanced template\nscheduling feature.",
"allOf": [
{
"$ref": "#/definitions/codersdk.TemplateAutostopRequirement"
@ -10013,6 +10024,27 @@ const docTemplate = `{
"TemplateAppsTypeApp"
]
},
"codersdk.TemplateAutostartRequirement": {
"type": "object",
"properties": {
"days_of_week": {
"description": "DaysOfWeek is a list of days of the week in which autostart is allowed\nto happen. If no days are specified, autostart is not allowed.",
"type": "array",
"items": {
"type": "string",
"enum": [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
"sunday"
]
}
}
}
},
"codersdk.TemplateAutostopRequirement": {
"type": "object",
"properties": {