Skip to content

Commit

Permalink
Add DSPM module to CNAPPgoat documentation and code
Browse files Browse the repository at this point in the history
- Extended scenario.go to support the DSPM module, ensuring correct ordering and error handling.
- Updated the README.md to include the new DSPM module in the module filter list.
- Modified command.go to reflect the new DSPM module in the command usage.
  • Loading branch information
noamsdahan committed Aug 20, 2023
1 parent 306935b commit 8465082
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ cnappgoat provision <scenario-1> <scenario-2> <scenario-N>

#### Flags:

- `--module` - Filters scenarios by module (e.g. CSPM, CIEM, CWPP, etc.)
- `--module` - Filters scenarios by module (e.g. CSPM, CIEM, CWPP, DSPM, etc.)
- `--platform` - Filters scenarios by platform (e.g. AWS, Azure, GCP)
- `--force` - Enables force mode (unlock locked stacks with pulumi cancel)
- `--debug` - Enables debug logging.
Expand Down
2 changes: 1 addition & 1 deletion cmd/commands/common/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func CommandFlags() []cli.Flag {
},
&cli.StringFlag{
Name: "module",
Usage: "CNAPPgoat module to operate on, e.g. 'CIEM, 'CSPM', 'CWPP', 'IAC'",
Usage: "CNAPPgoat module to operate on, e.g. 'CIEM, 'CSPM', 'CWPP', 'DSPM', 'IAC'",
Aliases: []string{"m"},
},
&cli.StringFlag{
Expand Down
13 changes: 9 additions & 4 deletions scenario.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const (
CIEM Module = "CIEM"
CSPM Module = "CSPM"
CWPP Module = "CWPP"
DSPM Module = "DSPM"
IAC Module = "IAC"
)

Expand All @@ -71,14 +72,16 @@ func (m Module) MarshalYAML() (interface{}, error) {

func (m Module) String() string {
switch m {
case CIEM:
return "CIEM"
case CSPM:
return "CSPM"
case CWPP:
return "CWPP"
case DSPM:
return "DSPM"
case IAC:
return "IAC"
case CIEM:
return "CIEM"
default:
panic("CNAPPgoat module name not formatted")
}
Expand Down Expand Up @@ -155,14 +158,16 @@ func (s State) Equals(state State) bool {

func ModuleFromString(name string) (Module, error) {
switch strings.ToLower(name) {
case strings.ToLower(CIEM.String()):
return CIEM, nil
case strings.ToLower(CSPM.String()):
return CSPM, nil
case strings.ToLower(CWPP.String()):
return CWPP, nil
case strings.ToLower(DSPM.String()):
return DSPM, nil
case strings.ToLower(IAC.String()):
return IAC, nil
case strings.ToLower(CIEM.String()):
return CIEM, nil
default:
return "", errors.New("unknown CNAPPgoat module name: " + name)
}
Expand Down

0 comments on commit 8465082

Please sign in to comment.