Skip to content

Commit 1fd02c9

Browse files
committed
make gen
1 parent df2acd3 commit 1fd02c9

File tree

11 files changed

+69
-45
lines changed

11 files changed

+69
-45
lines changed

cli/templates.go

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,15 @@ type templateTableRow struct {
8383
Template codersdk.Template
8484

8585
// Used by table format:
86-
Name string `json:"-" table:"name,default_sort"`
87-
CreatedAt string `json:"-" table:"created at"`
88-
LastUpdated string `json:"-" table:"last updated"`
89-
OrganizationID uuid.UUID `json:"-" table:"organization id"`
90-
Provisioner codersdk.ProvisionerType `json:"-" table:"provisioner"`
91-
ActiveVersionID uuid.UUID `json:"-" table:"active version id"`
92-
UsedBy string `json:"-" table:"used by"`
93-
DefaultTTL time.Duration `json:"-" table:"default ttl"`
86+
Name string `json:"-" table:"name,default_sort"`
87+
CreatedAt string `json:"-" table:"created at"`
88+
LastUpdated string `json:"-" table:"last updated"`
89+
OrganizationID uuid.UUID `json:"-" table:"organization id"`
90+
OrganizationName string `json:"-" table:"organization name"`
91+
Provisioner codersdk.ProvisionerType `json:"-" table:"provisioner"`
92+
ActiveVersionID uuid.UUID `json:"-" table:"active version id"`
93+
UsedBy string `json:"-" table:"used by"`
94+
DefaultTTL time.Duration `json:"-" table:"default ttl"`
9495
}
9596

9697
// templateToRows converts a list of templates to a list of templateTableRow for
@@ -99,15 +100,16 @@ func templatesToRows(templates ...codersdk.Template) []templateTableRow {
99100
rows := make([]templateTableRow, len(templates))
100101
for i, template := range templates {
101102
rows[i] = templateTableRow{
102-
Template: template,
103-
Name: template.Name,
104-
CreatedAt: template.CreatedAt.Format("January 2, 2006"),
105-
LastUpdated: template.UpdatedAt.Format("January 2, 2006"),
106-
OrganizationID: template.OrganizationID,
107-
Provisioner: template.Provisioner,
108-
ActiveVersionID: template.ActiveVersionID,
109-
UsedBy: pretty.Sprint(cliui.DefaultStyles.Fuchsia, formatActiveDevelopers(template.ActiveUserCount)),
110-
DefaultTTL: (time.Duration(template.DefaultTTLMillis) * time.Millisecond),
103+
Template: template,
104+
Name: template.Name,
105+
CreatedAt: template.CreatedAt.Format("January 2, 2006"),
106+
LastUpdated: template.UpdatedAt.Format("January 2, 2006"),
107+
OrganizationID: template.OrganizationID,
108+
OrganizationName: template.OrganizationName,
109+
Provisioner: template.Provisioner,
110+
ActiveVersionID: template.ActiveVersionID,
111+
UsedBy: pretty.Sprint(cliui.DefaultStyles.Fuchsia, formatActiveDevelopers(template.ActiveUserCount)),
112+
DefaultTTL: (time.Duration(template.DefaultTTLMillis) * time.Millisecond),
111113
}
112114
}
113115

coderd/apidoc/docs.go

Lines changed: 4 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: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/templates.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,7 @@ func (api *API) convertTemplate(
894894
CreatedAt: template.CreatedAt,
895895
UpdatedAt: template.UpdatedAt,
896896
OrganizationID: template.OrganizationID,
897+
OrganizationName: template.OrganizationName,
897898
Name: template.Name,
898899
DisplayName: template.DisplayName,
899900
Provisioner: codersdk.ProvisionerType(template.Provisioner),

codersdk/templates.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ import (
1515
// Template is the JSON representation of a Coder template. This type matches the
1616
// database object for now, but is abstracted for ease of change later on.
1717
type Template struct {
18-
ID uuid.UUID `json:"id" format:"uuid"`
19-
CreatedAt time.Time `json:"created_at" format:"date-time"`
20-
UpdatedAt time.Time `json:"updated_at" format:"date-time"`
21-
OrganizationID uuid.UUID `json:"organization_id" format:"uuid"`
22-
Name string `json:"name"`
23-
DisplayName string `json:"display_name"`
24-
Provisioner ProvisionerType `json:"provisioner" enums:"terraform"`
25-
ActiveVersionID uuid.UUID `json:"active_version_id" format:"uuid"`
18+
ID uuid.UUID `json:"id" format:"uuid"`
19+
CreatedAt time.Time `json:"created_at" format:"date-time"`
20+
UpdatedAt time.Time `json:"updated_at" format:"date-time"`
21+
OrganizationID uuid.UUID `json:"organization_id" format:"uuid"`
22+
OrganizationName string `json:"organization_name" format:"url"`
23+
Name string `json:"name"`
24+
DisplayName string `json:"display_name"`
25+
Provisioner ProvisionerType `json:"provisioner" enums:"terraform"`
26+
ActiveVersionID uuid.UUID `json:"active_version_id" format:"uuid"`
2627
// ActiveUserCount is set to -1 when loading.
2728
ActiveUserCount int `json:"active_user_count"`
2829
BuildTimeStats TemplateBuildTimeStats `json:"build_time_stats"`

0 commit comments

Comments
 (0)