Skip to content

Commit 28b8a77

Browse files
committed
PLTCONN-4903: Refactoring
1 parent bb7f6b6 commit 28b8a77

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

cmd/connector/conn_delete.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ 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-
q := map[string]string{}
26-
resp, err := client.Delete(cmd.Context(), util.ResourceUrl(endpoint, connectorRef), q)
25+
resp, err := client.Delete(cmd.Context(), util.ResourceUrl(endpoint, connectorRef))
2726
if err != nil {
2827
return err
2928
}

cmd/connector/customizer_delete.go

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

9+
"github.com/spf13/cobra"
10+
911
"github.com/sailpoint-oss/sailpoint-cli/internal/client"
1012
"github.com/sailpoint-oss/sailpoint-cli/internal/util"
11-
"github.com/spf13/cobra"
1213
)
1314

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

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

internal/client/client.go

Lines changed: 2 additions & 10 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, params map[string]string) (*http.Response, error)
17+
Delete(ctx context.Context, url 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, params map[string]string) (*http.Response, error) {
65+
func (c *SpClient) Delete(ctx context.Context, url string) (*http.Response, error) {
6666
if err := c.ensureAccessToken(ctx); err != nil {
6767
return nil, err
6868
}
@@ -78,14 +78,6 @@ func (c *SpClient) Delete(ctx context.Context, url string, params map[string]str
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-
8981
resp, err := c.client.Do(req)
9082
if err != nil {
9183
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)