Skip to content

Commit

Permalink
constants and review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
simisoft-exo committed Oct 11, 2024
1 parent 6fc3185 commit 3767467
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
10 changes: 5 additions & 5 deletions cmd/dbaas_external_endpoint_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ func (c *dbaasExternalEndpointCreateCmd) cmdShort() string {

func (c *dbaasExternalEndpointCreateCmd) cmdRun(cmd *cobra.Command, args []string) error {
switch c.Type {
case "datadog":
case ExternalEndpointTypeDatadog:
return c.createDatadog(cmd, args)
case "opensearch":
case ExternalEndpointTypeOpensearch:
return c.createOpensearch(cmd, args)
case "elasticsearch":
case ExternalEndpointTypeElasticsearch:
return c.createElasticsearch(cmd, args)
case "prometheus":
case ExternalEndpointTypePrometheus:
return c.createPrometheus(cmd, args)
case "rsyslog":
case ExternalEndpointTypeRsyslog:
return c.createRsyslog(cmd, args)
default:
return fmt.Errorf("unsupported external endpoint type %q", c.Type)
Expand Down
19 changes: 13 additions & 6 deletions cmd/dbaas_external_endpoint_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ import (
"github.com/spf13/cobra"
)

const (
ExternalEndpointTypeDatadog = "datadog"
ExternalEndpointTypeOpensearch = "opensearch"
ExternalEndpointTypeElasticsearch = "elasticsearch"
ExternalEndpointTypePrometheus = "prometheus"
ExternalEndpointTypeRsyslog = "rsyslog"
)

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

Expand All @@ -30,17 +38,16 @@ func (c *dbaasExternalEndpointShowCmd) cmdPreRun(cmd *cobra.Command, args []stri
}

func (c *dbaasExternalEndpointShowCmd) cmdRun(cmd *cobra.Command, args []string) error {

switch c.Type {
case "datadog":
case ExternalEndpointTypeDatadog:
return c.outputFunc(c.showDatadog())
case "opensearch":
case ExternalEndpointTypeOpensearch:
return c.outputFunc(c.showOpensearch())
case "elasticsearch":
case ExternalEndpointTypeElasticsearch:
return c.outputFunc(c.showElasticsearch())
case "prometheus":
case ExternalEndpointTypePrometheus:
return c.outputFunc(c.showPrometheus())
case "rsyslog":
case ExternalEndpointTypeRsyslog:
return c.outputFunc(c.showRsyslog())
default:
return fmt.Errorf("unsupported external endpoint type %q", c.Type)
Expand Down
10 changes: 5 additions & 5 deletions cmd/dbaas_external_endpoint_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ func (c *dbaasExternalEndpointUpdateCmd) cmdShort() string {

func (c *dbaasExternalEndpointUpdateCmd) cmdRun(cmd *cobra.Command, args []string) error {
switch c.Type {
case "datadog":
case ExternalEndpointTypeDatadog:
return c.updateDatadog(cmd, args)
case "opensearch":
case ExternalEndpointTypeOpensearch:
return c.updateOpensearch(cmd, args)
case "elasticsearch":
case ExternalEndpointTypeElasticsearch:
return c.updateElasticsearch(cmd, args)
case "prometheus":
case ExternalEndpointTypePrometheus:
return c.updatePrometheus(cmd, args)
case "rsyslog":
case ExternalEndpointTypeRsyslog:
return c.updateRsyslog(cmd, args)
default:
return fmt.Errorf("unsupported external endpoint type %q", c.Type)
Expand Down
3 changes: 2 additions & 1 deletion cmd/dbaas_external_integration_settings_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"fmt"

"github.com/spf13/cobra"
)

Expand All @@ -27,7 +28,7 @@ func (c *dbaasExternalIntegrationSettingsShowCmd) cmdPreRun(cmd *cobra.Command,

func (c *dbaasExternalIntegrationSettingsShowCmd) cmdRun(_ *cobra.Command, _ []string) error {
switch c.Type {
case "datadog":
case ExternalEndpointTypeDatadog:
return c.outputFunc(c.showDatadog())
default:
return fmt.Errorf("unsupported external integration settings for type %q", c.Type)
Expand Down

0 comments on commit 3767467

Please sign in to comment.