mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: change template max_ttl to default_ttl (#4843)
This commit is contained in:
+9
-12
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user