Skip to content

Commit 2d1333b

Browse files
committed
feat: add flag to scan all resources.
1 parent 68d36df commit 2d1333b

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

Readme.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,21 @@
1010
$ spark -h
1111
Usage spark:
1212
-list-scanners
13-
list available resource types
13+
list available resource types
1414
-region value
15-
AWS region to scan (can be specified multiple times)
15+
AWS region to scan (can be specified multiple times)
16+
-region-all
17+
scan all regions
1618
-scan value
17-
AWS resource type to scan (can be specified multiple times)
19+
AWS resource type to scan (can be specified multiple times)
20+
-scan-all
21+
scan all resource types
1822
-target string
19-
target AWS account ID (default "self")
23+
target AWS account ID (default "self")
2024
-verbose
21-
verbose log output
25+
verbose log output
2226
-version
23-
show version
27+
show version
2428

2529

2630
$ spark -list-scanners

main.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func main() {
2121
showVersion = flag.Bool("version", false, "show version")
2222
verbose = flag.Bool("verbose", false, "verbose log output")
2323
scanAllRegions = flag.Bool("region-all", false, "scan all regions")
24+
scannersAll = flag.Bool("scan-all", false, "scan all resource types")
2425
regionVars StringSlice
2526
scannersVars StringSlice
2627
)
@@ -49,11 +50,18 @@ func main() {
4950
return
5051
}
5152

53+
types := []string{
54+
amiImage.String(),
55+
ebsSnapshot.String(),
56+
rdsSnapshot.String(),
57+
ssmDocument.String(),
58+
}
59+
5260
if *listScanners {
5361
slog.Info("available resource types")
5462

55-
for _, rType := range []runnerType{amiImage, ebsSnapshot, rdsSnapshot, ssmDocument} {
56-
_, _ = os.Stdout.Write([]byte(rType.String() + "\n"))
63+
for _, rType := range types {
64+
_, _ = os.Stdout.Write([]byte(rType + "\n"))
5765
}
5866

5967
return
@@ -65,6 +73,12 @@ func main() {
6573
regionVars = supportedRegions
6674
}
6775

76+
if *scannersAll {
77+
slog.Debug("scan all resource types")
78+
79+
scannersVars = types
80+
}
81+
6882
ctx := context.TODO()
6983

7084
app, err := newApp(

0 commit comments

Comments
 (0)