Skip to content

Commit

Permalink
show without settings works
Browse files Browse the repository at this point in the history
  • Loading branch information
simisoft-exo committed Sep 11, 2024
1 parent 4349141 commit 3e7df5d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 30 deletions.
28 changes: 1 addition & 27 deletions cmd/dbaas_external_endpoint_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@ package cmd

import (
"fmt"
"os"

"github.com/exoscale/cli/pkg/output"
"github.com/exoscale/cli/table"
v3 "github.com/exoscale/egoscale/v3"
"github.com/spf13/cobra"
)

type dbaasExternalEndpointShowCmd struct {
cliCommandSettings `cli-cmd:"-"`
cliCommandSettings `cli-cmd:"-"`

_ bool `cli-cmd:"show"`

Expand Down Expand Up @@ -48,25 +44,3 @@ func init() {
cliCommandSettings: defaultCLICmdSettings(),
}))
}

type externalEndpointShowOutput struct {
ID string `json:"id"`
Name string `json:"name"`
Type v3.EnumExternalEndpointTypes `json:"type"`
// Settings any `json:"settings"`
}

func (o *externalEndpointShowOutput) ToJSON() { output.JSON(o) }

func (o *externalEndpointShowOutput) ToText() { output.Text(o) }

func (o *externalEndpointShowOutput) ToTable() {
t := table.NewTable(os.Stdout)
t.SetHeader([]string{"DBaaS External Endpoint"})
defer t.Render()

t.Append([]string{"Name", o.Name})
t.Append([]string{"ID", string(o.ID)})
t.Append([]string{"Type", string(o.Type)})
}

11 changes: 8 additions & 3 deletions cmd/dbaas_external_endpoint_show_datadog.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ import (
)

type datadogOutput struct {
output.Outputter
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
// Settings v3.DBAASEndpointDatadog `json:"settings"`
Settings v3.DBAASEndpointDatadog `json:"settings"`
}

func (o *datadogOutput) ToJSON() { output.JSON(o) }

func (o *datadogOutput) ToText() { output.Text(o) }

func (o *datadogOutput) ToTable() { output.Table(o) }

func (c *dbaasExternalEndpointShowCmd) showDatadog() (output.Outputter, error) {
ctx := gContext

Expand All @@ -38,7 +43,7 @@ func (c *dbaasExternalEndpointShowCmd) showDatadog() (output.Outputter, error) {
ID: endpointResponse.ID.String(),
Name: endpointResponse.Name,
Type: string(endpointResponse.Type),
// Settings: *endpointResponse.Settings,
Settings: *endpointResponse.Settings,
}

return output, nil
Expand Down

0 comments on commit 3e7df5d

Please sign in to comment.