From fbe10cbb1c49f5e06254e91bb158f51ddc259877 Mon Sep 17 00:00:00 2001 From: Simar Date: Fri, 21 Jun 2024 22:15:02 -0600 Subject: [PATCH] remove cloud options --- pkg/flag/cloud_flags.go | 55 ----------------------------------------- pkg/flag/options.go | 12 --------- 2 files changed, 67 deletions(-) delete mode 100644 pkg/flag/cloud_flags.go diff --git a/pkg/flag/cloud_flags.go b/pkg/flag/cloud_flags.go deleted file mode 100644 index fd96c206d496..000000000000 --- a/pkg/flag/cloud_flags.go +++ /dev/null @@ -1,55 +0,0 @@ -package flag - -import "time" - -var ( - cloudUpdateCacheFlag = Flag[bool]{ - Name: "update-cache", - ConfigName: "cloud.update-cache", - Usage: "Update the cache for the applicable cloud provider instead of using cached results.", - } - cloudMaxCacheAgeFlag = Flag[time.Duration]{ - Name: "max-cache-age", - ConfigName: "cloud.max-cache-age", - Default: time.Hour * 24, - Usage: "The maximum age of the cloud cache. Cached data will be required from the cloud provider if it is older than this.", - } -) - -type CloudFlagGroup struct { - UpdateCache *Flag[bool] - MaxCacheAge *Flag[time.Duration] -} - -type CloudOptions struct { - MaxCacheAge time.Duration - UpdateCache bool -} - -func NewCloudFlagGroup() *CloudFlagGroup { - return &CloudFlagGroup{ - UpdateCache: cloudUpdateCacheFlag.Clone(), - MaxCacheAge: cloudMaxCacheAgeFlag.Clone(), - } -} - -func (f *CloudFlagGroup) Name() string { - return "Cloud" -} - -func (f *CloudFlagGroup) Flags() []Flagger { - return []Flagger{ - f.UpdateCache, - f.MaxCacheAge, - } -} - -func (f *CloudFlagGroup) ToOptions() (CloudOptions, error) { - if err := parseFlags(f); err != nil { - return CloudOptions{}, err - } - return CloudOptions{ - UpdateCache: f.UpdateCache.Value(), - MaxCacheAge: f.MaxCacheAge.Value(), - }, nil -} diff --git a/pkg/flag/options.go b/pkg/flag/options.go index 3777bed507fb..db042ff802a1 100644 --- a/pkg/flag/options.go +++ b/pkg/flag/options.go @@ -301,7 +301,6 @@ type Flags struct { GlobalFlagGroup *GlobalFlagGroup AWSFlagGroup *AWSFlagGroup CacheFlagGroup *CacheFlagGroup - CloudFlagGroup *CloudFlagGroup DBFlagGroup *DBFlagGroup ImageFlagGroup *ImageFlagGroup K8sFlagGroup *K8sFlagGroup @@ -324,7 +323,6 @@ type Options struct { GlobalOptions AWSOptions CacheOptions - CloudOptions DBOptions ImageOptions K8sOptions @@ -527,9 +525,6 @@ func (f *Flags) groups() []FlagGroup { if f.RegoFlagGroup != nil { groups = append(groups, f.RegoFlagGroup) } - if f.CloudFlagGroup != nil { - groups = append(groups, f.CloudFlagGroup) - } if f.AWSFlagGroup != nil { groups = append(groups, f.AWSFlagGroup) } @@ -619,13 +614,6 @@ func (f *Flags) ToOptions(args []string) (Options, error) { } } - if f.CloudFlagGroup != nil { - opts.CloudOptions, err = f.CloudFlagGroup.ToOptions() - if err != nil { - return Options{}, xerrors.Errorf("cloud flag error: %w", err) - } - } - if f.CacheFlagGroup != nil { opts.CacheOptions, err = f.CacheFlagGroup.ToOptions() if err != nil {