feat: change template max_ttl to default_ttl (#4843)

This commit is contained in:
Garrett Delfosse
2022-11-09 19:36:25 +00:00
committed by GitHub
parent ffc24dcbe0
commit d277e28427
26 changed files with 317 additions and 517 deletions
+9 -12
View File
@@ -13,11 +13,10 @@ import (
func templateEdit() *cobra.Command {
var (
name string
description string
icon string
maxTTL time.Duration
minAutostartInterval time.Duration
name string
description string
icon string
defaultTTL time.Duration
)
cmd := &cobra.Command{
@@ -40,11 +39,10 @@ func templateEdit() *cobra.Command {
// NOTE: coderd will ignore empty fields.
req := codersdk.UpdateTemplateMeta{
Name: name,
Description: description,
Icon: icon,
MaxTTLMillis: maxTTL.Milliseconds(),
MinAutostartIntervalMillis: minAutostartInterval.Milliseconds(),
Name: name,
Description: description,
Icon: icon,
DefaultTTLMillis: defaultTTL.Milliseconds(),
}
_, err = client.UpdateTemplateMeta(cmd.Context(), template.ID, req)
@@ -59,8 +57,7 @@ func templateEdit() *cobra.Command {
cmd.Flags().StringVarP(&name, "name", "", "", "Edit the template name")
cmd.Flags().StringVarP(&description, "description", "", "", "Edit the template description")
cmd.Flags().StringVarP(&icon, "icon", "", "", "Edit the template icon path")
cmd.Flags().DurationVarP(&maxTTL, "max-ttl", "", 0, "Edit the template maximum time before shutdown - workspaces created from this template cannot stay running longer than this.")
cmd.Flags().DurationVarP(&minAutostartInterval, "min-autostart-interval", "", 0, "Edit the template minimum autostart interval - workspaces created from this template must wait at least this long between autostarts.")
cmd.Flags().DurationVarP(&defaultTTL, "default-ttl", "", 0, "Edit the template default time before shutdown - workspaces created from this template to this value.")
cliui.AllowSkipPrompt(cmd)
return cmd