feat: allow disabling autostart and custom autostop for template (#6933)

API only, frontend in upcoming PR.
This commit is contained in:
Dean Sheather
2023-04-04 22:48:35 +10:00
committed by GitHub
parent 083fc89f93
commit e33941b7c2
65 changed files with 1433 additions and 486 deletions

View File

@ -95,6 +95,17 @@ type CreateTemplateRequest struct {
// Allow users to cancel in-progress workspace jobs.
// *bool as the default value is "true".
AllowUserCancelWorkspaceJobs *bool `json:"allow_user_cancel_workspace_jobs"`
// AllowUserAutostart allows users to set a schedule for autostarting their
// workspace. By default this is true. This can only be disabled when using
// an enterprise license.
AllowUserAutostart *bool `json:"allow_user_autostart"`
// AllowUserAutostop allows users to set a custom workspace TTL to use in
// place of the template's DefaultTTL field. By default this is true. If
// false, the DefaultTTL will always be used. This can only be disabled when
// using an enterprise license.
AllowUserAutostop *bool `json:"allow_user_autostop"`
}
// CreateWorkspaceRequest provides options for creating a new workspace.

View File

@ -34,6 +34,11 @@ type Template struct {
CreatedByID uuid.UUID `json:"created_by_id" format:"uuid"`
CreatedByName string `json:"created_by_name"`
// AllowUserAutostart and AllowUserAutostop are enterprise-only. Their
// values are only used if your license is entitled to use the advanced
// template scheduling feature.
AllowUserAutostart bool `json:"allow_user_autostart"`
AllowUserAutostop bool `json:"allow_user_autostop"`
AllowUserCancelWorkspaceJobs bool `json:"allow_user_cancel_workspace_jobs"`
}
@ -87,6 +92,8 @@ type UpdateTemplateMeta struct {
// template scheduling feature. If you attempt to set this value while
// unlicensed, it will be ignored.
MaxTTLMillis int64 `json:"max_ttl_ms,omitempty"`
AllowUserAutostart bool `json:"allow_user_autostart,omitempty"`
AllowUserAutostop bool `json:"allow_user_autostop,omitempty"`
AllowUserCancelWorkspaceJobs bool `json:"allow_user_cancel_workspace_jobs,omitempty"`
}