From 3e7df5d17a42958e9903a839b8f3375dab11e02d Mon Sep 17 00:00:00 2001 From: simisoft-exo Date: Wed, 11 Sep 2024 13:47:28 +0100 Subject: [PATCH] show without settings works --- cmd/dbaas_external_endpoint_show.go | 28 +-------------------- cmd/dbaas_external_endpoint_show_datadog.go | 11 +++++--- 2 files changed, 9 insertions(+), 30 deletions(-) diff --git a/cmd/dbaas_external_endpoint_show.go b/cmd/dbaas_external_endpoint_show.go index 54d594cd..e36cb85f 100644 --- a/cmd/dbaas_external_endpoint_show.go +++ b/cmd/dbaas_external_endpoint_show.go @@ -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"` @@ -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)}) -} - diff --git a/cmd/dbaas_external_endpoint_show_datadog.go b/cmd/dbaas_external_endpoint_show_datadog.go index 10e78126..0f6ae97d 100644 --- a/cmd/dbaas_external_endpoint_show_datadog.go +++ b/cmd/dbaas_external_endpoint_show_datadog.go @@ -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 @@ -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