From 8cfe223192c966d351ce7afc8368e1a0f288825e Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Wed, 8 Jun 2022 15:14:57 +0100 Subject: [PATCH] feat: cli: allow editing template metadata (#2159) This PR adds a CLI command template edit which allows updating the following metadata fields of a template: - Description - Max TTL - Min Autostart Interval --- cli/templateedit.go | 61 +++++++++++++ cli/templateedit_test.go | 94 +++++++++++++++++++ cli/templates.go | 1 + coderd/coderd.go | 1 + coderd/database/databasefake/databasefake.go | 19 ++++ coderd/database/querier.go | 1 + coderd/database/queries.sql.go | 33 +++++++ coderd/database/queries/templates.sql | 13 +++ coderd/templates.go | 96 ++++++++++++++++++++ coderd/templates_test.go | 95 +++++++++++++++++++ codersdk/templates.go | 23 +++++ site/src/api/typesGenerated.ts | 13 ++- 12 files changed, 447 insertions(+), 3 deletions(-) create mode 100644 cli/templateedit.go create mode 100644 cli/templateedit_test.go diff --git a/cli/templateedit.go b/cli/templateedit.go new file mode 100644 index 0000000000..7ec0305593 --- /dev/null +++ b/cli/templateedit.go @@ -0,0 +1,61 @@ +package cli + +import ( + "fmt" + "time" + + "github.com/spf13/cobra" + "golang.org/x/xerrors" + + "github.com/coder/coder/cli/cliui" + "github.com/coder/coder/codersdk" +) + +func templateEdit() *cobra.Command { + var ( + description string + maxTTL time.Duration + minAutostartInterval time.Duration + ) + + cmd := &cobra.Command{ + Use: "edit