Skip to content

Commit 12ec8fc

Browse files
committed
Revert "PLTCONN-4903: Refactoring"
This reverts commit 28b8a77.
1 parent 96fcf5d commit 12ec8fc

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

cmd/connector/conn_delete.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ func newConnDeleteCmd(client client.Client) *cobra.Command {
2222
connectorRef := cmd.Flags().Lookup("id").Value.String()
2323
endpoint := cmd.Flags().Lookup("conn-endpoint").Value.String()
2424

25-
resp, err := client.Delete(cmd.Context(), util.ResourceUrl(endpoint, connectorRef))
25+
q := map[string]string{}
26+
resp, err := client.Delete(cmd.Context(), util.ResourceUrl(endpoint, connectorRef), q)
2627
if err != nil {
2728
return err
2829
}

cmd/connector/customizer_delete.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ import (
66
"io"
77
"net/http"
88

9-
"github.com/spf13/cobra"
10-
119
"github.com/sailpoint-oss/sailpoint-cli/internal/client"
1210
"github.com/sailpoint-oss/sailpoint-cli/internal/util"
11+
"github.com/spf13/cobra"
1312
)
1413

1514
func newCustomizerDeleteCmd(client client.Client) *cobra.Command {
@@ -21,7 +20,8 @@ func newCustomizerDeleteCmd(client client.Client) *cobra.Command {
2120
RunE: func(cmd *cobra.Command, args []string) error {
2221
id := cmd.Flags().Lookup("id").Value.String()
2322

24-
resp, err := client.Delete(cmd.Context(), util.ResourceUrl(connectorCustomizersEndpoint, id))
23+
q := map[string]string{"type": "hard-delete"}
24+
resp, err := client.Delete(cmd.Context(), util.ResourceUrl(connectorCustomizersEndpoint, id), q)
2525
if err != nil {
2626
return err
2727
}

internal/client/client.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
type Client interface {
1616
Get(ctx context.Context, url string) (*http.Response, error)
17-
Delete(ctx context.Context, url string) (*http.Response, error)
17+
Delete(ctx context.Context, url string, params map[string]string) (*http.Response, error)
1818
Post(ctx context.Context, url string, contentType string, body io.Reader) (*http.Response, error)
1919
Put(ctx context.Context, url string, contentType string, body io.Reader) (*http.Response, error)
2020
Patch(ctx context.Context, url string, body io.Reader) (*http.Response, error)
@@ -62,7 +62,7 @@ func (c *SpClient) Get(ctx context.Context, url string) (*http.Response, error)
6262
return resp, nil
6363
}
6464

65-
func (c *SpClient) Delete(ctx context.Context, url string) (*http.Response, error) {
65+
func (c *SpClient) Delete(ctx context.Context, url string, params map[string]string) (*http.Response, error) {
6666
if err := c.ensureAccessToken(ctx); err != nil {
6767
return nil, err
6868
}
@@ -78,6 +78,14 @@ func (c *SpClient) Delete(ctx context.Context, url string) (*http.Response, erro
7878
fmt.Println(string(dbg))
7979
}
8080

81+
if params != nil {
82+
q := req.URL.Query()
83+
for k, v := range params {
84+
q.Add(k, v)
85+
}
86+
req.URL.RawQuery = q.Encode()
87+
}
88+
8189
resp, err := c.client.Do(req)
8290
if err != nil {
8391
return nil, err

internal/mocks/client.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)