Files
trivy/pkg/flag/cloud_flags.go
Liam Galvin b259b25ce4 feat: Add AWS Cloud scanning (#2493)
* feat: Added AWS Cloud scanning

Co-authored-by: Owen Rumney <owen.rumney@aquasec.com>
2022-08-11 14:59:32 +01:00

51 lines
1.1 KiB
Go

package flag
import "time"
var (
cloudUpdateCacheFlag = Flag{
Name: "update-cache",
ConfigName: "cloud.update-cache",
Value: false,
Usage: "Update the cache for the applicable cloud provider instead of using cached results.",
}
cloudMaxCacheAgeFlag = Flag{
Name: "max-cache-age",
ConfigName: "cloud.max-cache-age",
Value: time.Hour * 24,
Usage: "The maximum age of the cloud cache. Cached data will be requeried from the cloud provider if it is older than this.",
}
)
type CloudFlagGroup struct {
UpdateCache *Flag
MaxCacheAge *Flag
}
type CloudOptions struct {
MaxCacheAge time.Duration
UpdateCache bool
}
func NewCloudFlagGroup() *CloudFlagGroup {
return &CloudFlagGroup{
UpdateCache: &cloudUpdateCacheFlag,
MaxCacheAge: &cloudMaxCacheAgeFlag,
}
}
func (f *CloudFlagGroup) Name() string {
return "Cloud"
}
func (f *CloudFlagGroup) Flags() []*Flag {
return []*Flag{f.UpdateCache, f.MaxCacheAge}
}
func (f *CloudFlagGroup) ToOptions() CloudOptions {
return CloudOptions{
UpdateCache: getBool(f.UpdateCache),
MaxCacheAge: getDuration(f.MaxCacheAge),
}
}