Skip to content

Commit

Permalink
fix(connector cluster): wrong sdk method used in delete cmd (#1555) (#…
Browse files Browse the repository at this point in the history
…1557)

Co-authored-by: Ramakrishna Pattnaik <[email protected]>
  • Loading branch information
wtrocki and rkpattnaik780 authored May 5, 2022
1 parent f36dfe7 commit 49a4c12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
17 changes: 4 additions & 13 deletions pkg/cmd/connector/cluster/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package delete
import (
"github.com/AlecAivazis/survey/v2"
"github.com/redhat-developer/app-services-cli/pkg/core/cmdutil/flagutil"
"github.com/redhat-developer/app-services-cli/pkg/core/ioutil/dump"
"github.com/redhat-developer/app-services-cli/pkg/core/ioutil/icon"
"github.com/redhat-developer/app-services-cli/pkg/core/localize"
"github.com/redhat-developer/app-services-cli/pkg/shared/connection"
"github.com/redhat-developer/app-services-cli/pkg/shared/factory"
connectormgmtclient "github.com/redhat-developer/app-services-sdk-go/connectormgmt/apiv1/client"

"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -78,13 +77,9 @@ func runDelete(opts *options) error {

api := conn.API()

a := api.ConnectorsMgmt().ConnectorClustersApi.CreateConnectorCluster(f.Context)
a = a.ConnectorClusterRequest(connectormgmtclient.ConnectorClusterRequest{
Name: &opts.id,
})
a = a.Async(true)
a := api.ConnectorsMgmt().ConnectorClustersApi.DeleteConnectorCluster(f.Context, opts.id)

response, httpRes, err := a.Execute()
_, httpRes, err := a.Execute()
if httpRes != nil {
defer httpRes.Body.Close()
}
Expand All @@ -93,11 +88,7 @@ func runDelete(opts *options) error {
return err
}

if err = dump.Formatted(f.IOStreams.Out, opts.outputFormat, response); err != nil {
return err
}

f.Logger.Info(f.Localizer.MustLocalize("connector.cluster.delete.info.success"))
f.Logger.Info(icon.SuccessPrefix(), f.Localizer.MustLocalize("connector.cluster.delete.info.success"))

return nil
}
Expand Down
10 changes: 3 additions & 7 deletions pkg/cmd/connector/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/AlecAivazis/survey/v2"
"github.com/redhat-developer/app-services-cli/pkg/cmd/connector/connectorcmdutil"
"github.com/redhat-developer/app-services-cli/pkg/core/cmdutil/flagutil"
"github.com/redhat-developer/app-services-cli/pkg/core/ioutil/dump"
"github.com/redhat-developer/app-services-cli/pkg/core/ioutil/icon"
"github.com/redhat-developer/app-services-cli/pkg/core/localize"
"github.com/redhat-developer/app-services-cli/pkg/shared/connection"
"github.com/redhat-developer/app-services-cli/pkg/shared/factory"
Expand Down Expand Up @@ -74,7 +74,7 @@ func runDelete(opts *options) error {

a := api.ConnectorsMgmt().ConnectorsApi.DeleteConnector(f.Context, opts.id)

response, httpRes, err := a.Execute()
_, httpRes, err := a.Execute()
if httpRes != nil {
defer httpRes.Body.Close()
}
Expand All @@ -83,11 +83,7 @@ func runDelete(opts *options) error {
return err
}

if err = dump.Formatted(f.IOStreams.Out, opts.outputFormat, response); err != nil {
return err
}

f.Logger.Info(f.Localizer.MustLocalize("connector.delete.info.success"))
f.Logger.Info(icon.SuccessPrefix(), f.Localizer.MustLocalize("connector.delete.info.success"))

return nil
}
Expand Down

0 comments on commit 49a4c12

Please sign in to comment.