From 46d7275481187378d3882d7c5836f94cb3f9384f Mon Sep 17 00:00:00 2001 From: Charlie Moog Date: Fri, 4 Sep 2020 10:21:38 -0500 Subject: [PATCH] Indent struct tab tags properly --- coder-sdk/devurl.go | 10 +++++----- coder-sdk/env.go | 47 +++++++++++++++++++++++--------------------- coder-sdk/secrets.go | 12 +++++------ coder-sdk/users.go | 10 +++++----- internal/cmd/urls.go | 10 +++++----- 5 files changed, 46 insertions(+), 43 deletions(-) diff --git a/coder-sdk/devurl.go b/coder-sdk/devurl.go index 701ec004..240a32de 100644 --- a/coder-sdk/devurl.go +++ b/coder-sdk/devurl.go @@ -8,11 +8,11 @@ import ( // DevURL is the parsed json response record for a devURL from cemanager type DevURL struct { - ID string `json:"id"` - URL string `json:"url"` - Port int `json:"port"` - Access string `json:"access"` - Name string `json:"name"` + ID string `json:"id" tab:"ID"` + URL string `json:"url" tab:"URL"` + Port int `json:"port" tab:"Port"` + Access string `json:"access" tab:"Access"` + Name string `json:"name" tab:"Name"` } type delDevURLRequest struct { diff --git a/coder-sdk/env.go b/coder-sdk/env.go index 5113dee2..b01c1d4f 100644 --- a/coder-sdk/env.go +++ b/coder-sdk/env.go @@ -11,28 +11,31 @@ import ( // Environment describes a Coder environment type Environment struct { - ID string `json:"id" tab:"-"` - Name string `json:"name"` - ImageID string `json:"image_id" tab:"-"` - ImageTag string `json:"image_tag"` - OrganizationID string `json:"organization_id" tab:"-"` - UserID string `json:"user_id" tab:"-"` - LastBuiltAt time.Time `json:"last_built_at" tab:"-"` - CPUCores float32 `json:"cpu_cores"` - MemoryGB int `json:"memory_gb"` - DiskGB int `json:"disk_gb"` - GPUs int `json:"gpus"` - Updating bool `json:"updating"` - LatestStat EnvironmentStat `json:"latest_stat" tab:"Status"` - RebuildMessages []struct { - Text string `json:"text"` - Required bool `json:"required"` - } `json:"rebuild_messages" tab:"-"` - CreatedAt time.Time `json:"created_at" tab:"-"` - UpdatedAt time.Time `json:"updated_at" tab:"-"` - LastOpenedAt time.Time `json:"last_opened_at" tab:"-"` - LastConnectionAt time.Time `json:"last_connection_at" tab:"-"` - AutoOffThreshold xjson.Duration `json:"auto_off_threshold" tab:"-"` + ID string `json:"id" tab:"-"` + Name string `json:"name" tab:"Name"` + ImageID string `json:"image_id" tab:"-"` + ImageTag string `json:"image_tag" tab:"ImageTag"` + OrganizationID string `json:"organization_id" tab:"-"` + UserID string `json:"user_id" tab:"-"` + LastBuiltAt time.Time `json:"last_built_at" tab:"-"` + CPUCores float32 `json:"cpu_cores" tab:"CPUCores"` + MemoryGB int `json:"memory_gb" tab:"MemoryGB"` + DiskGB int `json:"disk_gb" tab:"DiskGB"` + GPUs int `json:"gpus" tab:"GPUs"` + Updating bool `json:"updating" tab:"Updating"` + LatestStat EnvironmentStat `json:"latest_stat" tab:"Status"` + RebuildMessages []RebuildMessage `json:"rebuild_messages" tab:"-"` + CreatedAt time.Time `json:"created_at" tab:"-"` + UpdatedAt time.Time `json:"updated_at" tab:"-"` + LastOpenedAt time.Time `json:"last_opened_at" tab:"-"` + LastConnectionAt time.Time `json:"last_connection_at" tab:"-"` + AutoOffThreshold xjson.Duration `json:"auto_off_threshold" tab:"-"` +} + +// RebuildMessage defines the message shown when an Environment requires a rebuild for it can be accessed. +type RebuildMessage struct { + Text string `json:"text"` + Required bool `json:"required"` } // EnvironmentStat represents the state of an environment diff --git a/coder-sdk/secrets.go b/coder-sdk/secrets.go index b13a3060..18b391c1 100644 --- a/coder-sdk/secrets.go +++ b/coder-sdk/secrets.go @@ -8,12 +8,12 @@ import ( // Secret describes a Coder secret type Secret struct { - ID string `json:"id" tab:"-"` - Name string `json:"name"` - Value string `json:"value,omitempty"` - Description string `json:"description"` - CreatedAt time.Time `json:"created_at"` - UpdatedAt time.Time `json:"updated_at" tab:"-"` + ID string `json:"id" tab:"-"` + Name string `json:"name" tab:"Name"` + Value string `json:"value,omitempty" tab:"Value"` + Description string `json:"description" tab:"Description"` + CreatedAt time.Time `json:"created_at" tab:"CreatedAt"` + UpdatedAt time.Time `json:"updated_at" tab:"-"` } // Secrets gets all secrets for the given user diff --git a/coder-sdk/users.go b/coder-sdk/users.go index 48aa0502..02262bb1 100644 --- a/coder-sdk/users.go +++ b/coder-sdk/users.go @@ -8,11 +8,11 @@ import ( // User describes a Coder user account. type User struct { - ID string `json:"id" tab:"-"` - Email string `json:"email"` - Username string `json:"username"` - Name string `json:"name"` - CreatedAt time.Time `json:"created_at"` + ID string `json:"id" tab:"-"` + Email string `json:"email" tab:"Email"` + Username string `json:"username" tab:"Username"` + Name string `json:"name" tab:"Name"` + CreatedAt time.Time `json:"created_at" tab:"CreatedAt"` UpdatedAt time.Time `json:"updated_at" tab:"-"` } diff --git a/internal/cmd/urls.go b/internal/cmd/urls.go index b406c947..ebe694ce 100644 --- a/internal/cmd/urls.go +++ b/internal/cmd/urls.go @@ -51,11 +51,11 @@ func makeURLCmd() *cobra.Command { // DevURL is the parsed json response record for a devURL from cemanager type DevURL struct { - ID string `json:"id" tab:"-"` - URL string `json:"url"` - Port int `json:"port"` - Name string `json:"name" tab:"-"` - Access string `json:"access"` + ID string `json:"id" tab:"-"` + URL string `json:"url" tab:"URL"` + Port int `json:"port" tab:"Port"` + Name string `json:"name" tab:"-"` + Access string `json:"access" tab:"Access"` } var urlAccessLevel = map[string]string{