Skip to content

Commit

Permalink
NSOF-7985 dlp/file_scanning_rule: disallow create/update of fsr/dlp r…
Browse files Browse the repository at this point in the history
…ules

As the first step of replacing dlp/fsr rules with scan rules, we
disallow creating/updating fsr/dlp rules.
Next step will be to remove them completely.
  • Loading branch information
fsafran-meta committed Jan 3, 2024
1 parent 812918c commit decbc21
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 317 deletions.
22 changes: 2 additions & 20 deletions internal/client/dlp_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,11 @@ func parseDLPRule(resp []byte) (*DLPRule, error) {
}

func CreateDLPRule(ctx context.Context, c *Client, rg *DLPRule) (*DLPRule, error) {
rgUrl := fmt.Sprintf("%s/%s", c.BaseURL, dlpRulesEndpoint)
body, err := json.Marshal(rg)
if err != nil {
return nil, fmt.Errorf("could not convert dlp rule to json: %v", err)
}
resp, err := c.Post(ctx, rgUrl, body)
if err != nil {
return nil, err
}
return parseDLPRule(resp)
return nil, fmt.Errorf("due to retirement of DLP rules, no new rules can be created")
}

func UpdateDLPRule(ctx context.Context, c *Client, rgID string, rg *DLPRule) (*DLPRule, error) {
rgUrl := fmt.Sprintf("%s/%s/%s", c.BaseURL, dlpRulesEndpoint, rgID)
body, err := json.Marshal(rg)
if err != nil {
return nil, fmt.Errorf("could not convert dlp rule to json: %v", err)
}
resp, err := c.Patch(ctx, rgUrl, body)
if err != nil {
return nil, err
}
return parseDLPRule(resp)
return nil, fmt.Errorf("due to retirement of DLP rules, no DLP rules can be updated")
}

func GetDLPRule(ctx context.Context, c *Client, rgID string) (*DLPRule, error) {
Expand Down
22 changes: 2 additions & 20 deletions internal/client/file_scanning_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,29 +75,11 @@ func parseFileScanningRule(resp []byte) (*FileScanningRule, error) {
}

func CreateFileScanningRule(ctx context.Context, c *Client, rg *FileScanningRule) (*FileScanningRule, error) {
rgUrl := fmt.Sprintf("%s/%s", c.BaseURL, fileScanningRulesEndpoint)
body, err := json.Marshal(rg)
if err != nil {
return nil, fmt.Errorf("could not convert file scanning rule to json: %v", err)
}
resp, err := c.Post(ctx, rgUrl, body)
if err != nil {
return nil, err
}
return parseFileScanningRule(resp)
return nil, fmt.Errorf("due to retirement of FSR rules, no new rules can be created")
}

func UpdateFileScanningRule(ctx context.Context, c *Client, rgID string, rg *FileScanningRule) (*FileScanningRule, error) {
rgUrl := fmt.Sprintf("%s/%s/%s", c.BaseURL, fileScanningRulesEndpoint, rgID)
body, err := json.Marshal(rg)
if err != nil {
return nil, fmt.Errorf("could not convert file scanning rule to json: %v", err)
}
resp, err := c.Patch(ctx, rgUrl, body)
if err != nil {
return nil, err
}
return parseFileScanningRule(resp)
return nil, fmt.Errorf("due to retirement of FSR rules, no FSR rules can be updated")
}

func GetFileScanningRule(ctx context.Context, c *Client, rgID string) (*FileScanningRule, error) {
Expand Down
149 changes: 0 additions & 149 deletions internal/provider/acc_tests/dlp_rule_test.go

This file was deleted.

128 changes: 0 additions & 128 deletions internal/provider/acc_tests/file_scanning_rule_test.go

This file was deleted.

0 comments on commit decbc21

Please sign in to comment.