Skip to content

Commit

Permalink
feat: add new output properties to database list
Browse files Browse the repository at this point in the history
feat: add new output properties to `environment list`
feat: add new output properties to `storage list`
feat: add new output properties to `broker list`
  • Loading branch information
evoxmusic committed Dec 14, 2019
1 parent a9c4984 commit 22d6630
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 14 deletions.
1 change: 1 addition & 0 deletions api/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type AggregatedEnvironments struct {
type AggregatedEnvironment struct {
BranchId string `json:"branch_id"`
Status string `json:"status"`
ConnectionURI string `json:"connection_uri"`
TotalApplications *int `json:"total_applications"`
TotalDatabases *int `json:"total_databases"`
TotalBrokers *int `json:"total_brokers"`
Expand Down
4 changes: 4 additions & 0 deletions api/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ type Service struct {
Type string `json:"type"`
Version string `json:"version"`
Status string `json:"status"`
Host string `json:"host"`
Port *int `json:"port"`
Username string `json:"username"`
Password string `json:"password"`
Application *Application `json:"application"`
}

Expand Down
6 changes: 4 additions & 2 deletions cmd/broker_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"qovery.go/api"
"qovery.go/util"
"strconv"
)

var brokerListCmd = &cobra.Command{
Expand All @@ -27,7 +28,7 @@ var brokerListCmd = &cobra.Command{
}

output := []string{
"name | status | type | version | application",
"name | status | type | version | host | port | username | password | application",
}

// TODO check nil
Expand All @@ -45,7 +46,8 @@ var brokerListCmd = &cobra.Command{
applicationName = a.Application.Name
}

output = append(output, a.Name+" | "+a.Status+" | "+a.Type+" | "+a.Version+" | "+applicationName)
output = append(output, a.Name+" | "+a.Status+" | "+a.Type+" | "+a.Version+" | "+a.Host+" | "+strconv.Itoa(*a.Port)+
" | "+a.Username+" | "+a.Password+" | "+applicationName)
}

fmt.Println(columnize.SimpleFormat(output))
Expand Down
6 changes: 4 additions & 2 deletions cmd/database_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"qovery.go/api"
"qovery.go/util"
"strconv"
)

var databaseListCmd = &cobra.Command{
Expand All @@ -27,7 +28,7 @@ var databaseListCmd = &cobra.Command{
}

output := []string{
"name | status | type | version | application",
"name | status | type | version | host | port | username | password | application",
}

// TODO check nil
Expand All @@ -45,7 +46,8 @@ var databaseListCmd = &cobra.Command{
applicationName = a.Application.Name
}

output = append(output, a.Name+" | "+a.Status+" | "+a.Type+" | "+a.Version+" | "+applicationName)
output = append(output, a.Name+" | "+a.Status+" | "+a.Type+" | "+a.Version+" | "+a.Host+" | "+strconv.Itoa(*a.Port)+
" | "+a.Username+" | "+a.Password+" | "+applicationName)
}

fmt.Println(columnize.SimpleFormat(output))
Expand Down
4 changes: 2 additions & 2 deletions cmd/environment_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var environmentListCmd = &cobra.Command{
}

output := []string{
"branch | status | applications | databases | brokers | storage",
"branch | status | url | applications | databases | brokers | storage",
}

// TODO check nil
Expand All @@ -40,7 +40,7 @@ var environmentListCmd = &cobra.Command{
}

for _, a := range aggEnvs.Results {
output = append(output, a.BranchId+" | "+a.Status+" | "+strconv.Itoa(*a.TotalApplications)+
output = append(output, a.BranchId+" | "+a.Status+" | "+a.ConnectionURI+" | "+strconv.Itoa(*a.TotalApplications)+
" | "+strconv.Itoa(*a.TotalDatabases)+" | "+strconv.Itoa(*a.TotalBrokers)+" | "+strconv.Itoa(*a.TotalStorage))
}

Expand Down
4 changes: 4 additions & 0 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ func AddDatabaseWizard() *util.QoveryYMLDatabase {
return nil
}

// TODO ask for version

name := util.AskForInput(false, "Set the database name")

return &util.QoveryYMLDatabase{Name: name, Type: strings.ToLower(choice)}
Expand All @@ -150,6 +152,8 @@ func AddBrokerWizard() *util.QoveryYMLBroker {
return nil
}

// TODO ask for version

name := util.AskForInput(false, "Set the broker name")

return &util.QoveryYMLBroker{Name: name, Type: strings.ToLower(choice)}
Expand Down
6 changes: 4 additions & 2 deletions cmd/storage_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"qovery.go/api"
"qovery.go/util"
"strconv"
)

var storageListCmd = &cobra.Command{
Expand All @@ -27,7 +28,7 @@ var storageListCmd = &cobra.Command{
}

output := []string{
"name | status | type | version | application",
"name | status | type | version | host | port | username | password | application",
}

// TODO check nil
Expand All @@ -45,7 +46,8 @@ var storageListCmd = &cobra.Command{
applicationName = a.Application.Name
}

output = append(output, a.Name+" | "+a.Status+" | "+a.Type+" | "+a.Version+" | "+applicationName)
output = append(output, a.Name+" | "+a.Status+" | "+a.Type+" | "+a.Version+" | "+a.Host+" | "+strconv.Itoa(*a.Port)+
" | "+a.Username+" | "+a.Password+" | "+applicationName)
}

fmt.Println(columnize.SimpleFormat(output))
Expand Down
15 changes: 9 additions & 6 deletions util/qovery_yml.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,25 @@ type QoveryYMLApplication struct {
}

type QoveryYMLDatabase struct {
Name string `yaml:"name,omitempty"`
Type string `yaml:"type,omitempty"`
Type string `yaml:"type,omitempty"`
Version string `yaml:"version,omitempty"`
Name string `yaml:"name,omitempty"`
}

type QoveryYMLNetwork struct {
DNS string `yaml:"dns,omitempty"`
}

type QoveryYMLBroker struct {
Name string `yaml:"name,omitempty"`
Type string `yaml:"type,omitempty"`
Type string `yaml:"type,omitempty"`
Version string `yaml:"version,omitempty"`
Name string `yaml:"name,omitempty"`
}

type QoveryYMLStorage struct {
Name string `yaml:"name,omitempty"`
Type string `yaml:"type,omitempty"`
Type string `yaml:"type,omitempty"`
Version string `yaml:"version,omitempty"`
Name string `yaml:"name,omitempty"`
}

func CurrentQoveryYML() QoveryYML {
Expand Down

0 comments on commit 22d6630

Please sign in to comment.