Skip to content

Commit 1606b99

Browse files
committed
Linting and gen
1 parent 02555b1 commit 1606b99

20 files changed

+321
-28
lines changed

cli/templateversionarchive.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ import (
1717
func (r *RootCmd) unarchiveTemplateVersion() *clibase.Cmd {
1818
return r.setArchiveTemplateVersion(false)
1919
}
20+
2021
func (r *RootCmd) archiveTemplateVersion() *clibase.Cmd {
2122
return r.setArchiveTemplateVersion(true)
2223
}
2324

25+
//nolint:revive
2426
func (r *RootCmd) setArchiveTemplateVersion(archive bool) *clibase.Cmd {
2527
presentVerb := "archive"
2628
pastVerb := "archived"

cli/testdata/coder_templates_--help.golden

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,17 @@ USAGE:
2323
$ coder templates push my-template
2424

2525
SUBCOMMANDS:
26-
archive-template Archive unused failed template versions from a given
27-
template(s)
28-
archive-version Archive or unarchive a template version(s).
29-
create Create a template from the current directory or as
30-
specified by flag
31-
delete Delete templates
32-
edit Edit the metadata of a template by name.
33-
init Get started with a templated template.
34-
list List all the templates available for the organization
35-
pull Download the latest version of a template to a path.
36-
push Push a new template version from the current directory
37-
or as specified by flag
38-
versions Manage different versions of the specified template
26+
archive Archive unused failed template versions from a given template(s)
27+
create Create a template from the current directory or as specified by
28+
flag
29+
delete Delete templates
30+
edit Edit the metadata of a template by name.
31+
init Get started with a templated template.
32+
list List all the templates available for the organization
33+
pull Download the latest version of a template to a path.
34+
push Push a new template version from the current directory or as
35+
specified by flag
36+
versions Manage different versions of the specified template
3937

4038
———
4139
Run `coder --help` for a list of global options.

cli/testdata/coder_templates_archive_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
coder v0.0.0-devel
22

33
USAGE:
4-
coder templates archive [flags] [name...]
4+
coder templates archive [flags] [template-name...]
55

66
Archive unused failed template versions from a given template(s)
77

cli/testdata/coder_templates_versions_--help.golden

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ USAGE:
1212
$ coder templates versions list my-template
1313

1414
SUBCOMMANDS:
15-
list List all the versions of the specified template
15+
archive Archive a template version(s).
16+
list List all the versions of the specified template
17+
unarchive Unarchive a template version(s).
1618

1719
———
1820
Run `coder --help` for a list of global options.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
coder v0.0.0-devel
2+
3+
USAGE:
4+
coder templates versions archive [flags] <template-name>
5+
[template-version-names...]
6+
7+
Archive a template version(s).
8+
9+
OPTIONS:
10+
-y, --yes bool
11+
Bypass prompts.
12+
13+
———
14+
Run `coder --help` for a list of global options.

cli/testdata/coder_templates_versions_list_--help.golden

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ USAGE:
66
List all the versions of the specified template
77

88
OPTIONS:
9-
-c, --column string-array (default: name,created at,created by,status,active)
9+
-c, --column string-array (default: name,created at,created by,status,active,archived)
1010
Columns to display in table output. Available columns: name, created
11-
at, created by, status, active.
11+
at, created by, status, active, archived.
12+
13+
--include-archived bool
14+
Include archived versions in the result list.
1215

1316
-o, --output string (default: table)
1417
Output format. Available formats: table, json.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
coder v0.0.0-devel
2+
3+
USAGE:
4+
coder templates versions unarchive [flags] <template-name>
5+
[template-version-names...]
6+
7+
Unarchive a template version(s).
8+
9+
OPTIONS:
10+
-y, --yes bool
11+
Bypass prompts.
12+
13+
———
14+
Run `coder --help` for a list of global options.

coderd/apidoc/docs.go

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dbfake/dbfake.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5339,7 +5339,7 @@ func (*FakeQuerier) TryAcquireLock(_ context.Context, _ int64) (bool, error) {
53395339
return false, xerrors.New("TryAcquireLock must only be called within a transaction")
53405340
}
53415341

5342-
func (q *FakeQuerier) UnarchiveTemplateVersion(ctx context.Context, arg database.UnarchiveTemplateVersionParams) error {
5342+
func (q *FakeQuerier) UnarchiveTemplateVersion(_ context.Context, arg database.UnarchiveTemplateVersionParams) error {
53435343
err := validateDatabaseType(arg)
53445344
if err != nil {
53455345
return err

coderd/database/queries.sql.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/templateversions.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,8 @@ func (api *API) postArchiveTemplateVersions(rw http.ResponseWriter, r *http.Requ
10541054
UpdatedAt: dbtime.Now(),
10551055
TemplateID: template.ID,
10561056
JobStatus: status,
1057+
// Archive all versions that match
1058+
TemplateVersionID: uuid.Nil,
10571059
})
10581060

10591061
if httpapi.Is404Error(err) {
@@ -1100,6 +1102,7 @@ func (api *API) postUnarchiveTemplateVersion() func(rw http.ResponseWriter, r *h
11001102
return api.setArchiveTemplateVersion(false)
11011103
}
11021104

1105+
//nolint:revive
11031106
func (api *API) setArchiveTemplateVersion(archive bool) func(rw http.ResponseWriter, r *http.Request) {
11041107
return func(rw http.ResponseWriter, r *http.Request) {
11051108
var (

codersdk/templates.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ func (c *Client) ArchiveTemplateVersions(ctx context.Context, template uuid.UUID
256256
return resp, json.NewDecoder(res.Body).Decode(&resp)
257257
}
258258

259+
//nolint:revive
259260
func (c *Client) SetArchiveTemplateVersion(ctx context.Context, templateVersion uuid.UUID, archive bool) error {
260261
u := fmt.Sprintf("/api/v2/templateversions/%s", templateVersion.String())
261262
if archive {

docs/api/templates.md

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/cli/templates_archive.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)