Switch to case statement
This commit is contained in:
parent
1b5b747437
commit
17cd6b7c8b
@ -109,14 +109,13 @@ var MigrateCmd = &cobra.Command{
|
|||||||
suggestions[level] = true
|
suggestions[level] = true
|
||||||
}
|
}
|
||||||
var suggested psaapi.Level
|
var suggested psaapi.Level
|
||||||
if suggestions["restricted"] {
|
switch {
|
||||||
suggested = psaapi.LevelRestricted
|
case suggestions["privileged"]:
|
||||||
}
|
|
||||||
if suggestions["baseline"] {
|
|
||||||
suggested = psaapi.LevelBaseline
|
|
||||||
}
|
|
||||||
if suggestions["privileged"] {
|
|
||||||
suggested = psaapi.LevelPrivileged
|
suggested = psaapi.LevelPrivileged
|
||||||
|
case suggestions["baseline"]:
|
||||||
|
suggested = psaapi.LevelBaseline
|
||||||
|
case suggestions["restricted"]:
|
||||||
|
suggested = psaapi.LevelRestricted
|
||||||
}
|
}
|
||||||
fmt.Printf("Suggest using %v in namespace %v\n", suggested, namespace.Name)
|
fmt.Printf("Suggest using %v in namespace %v\n", suggested, namespace.Name)
|
||||||
if DryRun == true {
|
if DryRun == true {
|
||||||
@ -124,6 +123,7 @@ var MigrateCmd = &cobra.Command{
|
|||||||
fmt.Printf("command again with --dry-run=false to apply %v on namespace %v\n", suggested, namespace.Name)
|
fmt.Printf("command again with --dry-run=false to apply %v on namespace %v\n", suggested, namespace.Name)
|
||||||
} else {
|
} else {
|
||||||
skipStr := "skip, continue with next namespace"
|
skipStr := "skip, continue with next namespace"
|
||||||
|
// TODO add ability to set this as a flag for all namespaces instead of prompting per namespace
|
||||||
prompt := promptui.Select{
|
prompt := promptui.Select{
|
||||||
Label: fmt.Sprintf("Select control mode for %v on namespace %v", suggested, namespace.Name),
|
Label: fmt.Sprintf("Select control mode for %v on namespace %v", suggested, namespace.Name),
|
||||||
Items: []string{"enforce", "audit", skipStr},
|
Items: []string{"enforce", "audit", skipStr},
|
||||||
|
Loading…
Reference in New Issue
Block a user