From c12319e34534da44a579d46d7410b85a7de400c9 Mon Sep 17 00:00:00 2001 From: William Beuil Date: Thu, 1 Jul 2021 17:11:25 +0200 Subject: [PATCH] Fix details typo --- pkg/remote/aws/init.go | 6 +++--- ...ket_detail_fetcher.go => s3_bucket_details_fetcher.go} | 0 ..._fetcher.go => s3_bucket_inventory_details_fetcher.go} | 0 ...tcher.go => s3_bucket_notification_details_fetcher.go} | 0 .../common/{detail_fetcher.go => details_fetcher.go} | 8 ++++---- pkg/remote/common/library.go | 4 ++-- pkg/remote/ec2_scanner_test.go | 6 +++--- pkg/remote/github/init.go | 2 +- pkg/remote/github_team_scanner_test.go | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) rename pkg/remote/aws/{s3_bucket_detail_fetcher.go => s3_bucket_details_fetcher.go} (100%) rename pkg/remote/aws/{s3_bucket_inventory_detail_fetcher.go => s3_bucket_inventory_details_fetcher.go} (100%) rename pkg/remote/aws/{s3_bucket_notification_detail_fetcher.go => s3_bucket_notification_details_fetcher.go} (100%) rename pkg/remote/common/{detail_fetcher.go => details_fetcher.go} (69%) diff --git a/pkg/remote/aws/init.go b/pkg/remote/aws/init.go index 91570aac..c3bb88d8 100644 --- a/pkg/remote/aws/init.go +++ b/pkg/remote/aws/init.go @@ -67,11 +67,11 @@ func Init(version string, alerter *alerter.Alerter, remoteLibrary.AddDetailsFetcher(aws.AwsS3BucketNotificationResourceType, NewS3BucketNotificationDetailsFetcher(provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2EbsVolumeEnumerator(ec2repository, factory, provider.Config)) - remoteLibrary.AddDetailsFetcher(aws.AwsEbsVolumeResourceType, common.NewGenericDetailFetcher(aws.AwsEbsVolumeResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsEbsVolumeResourceType, common.NewGenericDetailsFetcher(aws.AwsEbsVolumeResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2EbsSnapshotEnumerator(ec2repository, factory, provider.Config)) - remoteLibrary.AddDetailsFetcher(aws.AwsEbsSnapshotResourceType, common.NewGenericDetailFetcher(aws.AwsEbsSnapshotResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsEbsSnapshotResourceType, common.NewGenericDetailsFetcher(aws.AwsEbsSnapshotResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2EipEnumerator(ec2repository, factory, provider.Config)) - remoteLibrary.AddDetailsFetcher(aws.AwsEipResourceType, common.NewGenericDetailFetcher(aws.AwsEipResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsEipResourceType, common.NewGenericDetailsFetcher(aws.AwsEipResourceType, provider, deserializer)) supplierLibrary.AddSupplier(NewS3BucketAnalyticSupplier(provider, s3Repository, deserializer)) supplierLibrary.AddSupplier(NewS3BucketMetricSupplier(provider, s3Repository, deserializer)) diff --git a/pkg/remote/aws/s3_bucket_detail_fetcher.go b/pkg/remote/aws/s3_bucket_details_fetcher.go similarity index 100% rename from pkg/remote/aws/s3_bucket_detail_fetcher.go rename to pkg/remote/aws/s3_bucket_details_fetcher.go diff --git a/pkg/remote/aws/s3_bucket_inventory_detail_fetcher.go b/pkg/remote/aws/s3_bucket_inventory_details_fetcher.go similarity index 100% rename from pkg/remote/aws/s3_bucket_inventory_detail_fetcher.go rename to pkg/remote/aws/s3_bucket_inventory_details_fetcher.go diff --git a/pkg/remote/aws/s3_bucket_notification_detail_fetcher.go b/pkg/remote/aws/s3_bucket_notification_details_fetcher.go similarity index 100% rename from pkg/remote/aws/s3_bucket_notification_detail_fetcher.go rename to pkg/remote/aws/s3_bucket_notification_details_fetcher.go diff --git a/pkg/remote/common/detail_fetcher.go b/pkg/remote/common/details_fetcher.go similarity index 69% rename from pkg/remote/common/detail_fetcher.go rename to pkg/remote/common/details_fetcher.go index 940a4ec6..64a9b42e 100644 --- a/pkg/remote/common/detail_fetcher.go +++ b/pkg/remote/common/details_fetcher.go @@ -9,21 +9,21 @@ type DetailsFetcher interface { ReadDetails(resource.Resource) (resource.Resource, error) } -type GenericDetailFetcher struct { +type GenericDetailsFetcher struct { resType resource.ResourceType reader terraform.ResourceReader deserializer *resource.Deserializer } -func NewGenericDetailFetcher(resType resource.ResourceType, provider terraform.ResourceReader, deserializer *resource.Deserializer) *GenericDetailFetcher { - return &GenericDetailFetcher{ +func NewGenericDetailsFetcher(resType resource.ResourceType, provider terraform.ResourceReader, deserializer *resource.Deserializer) *GenericDetailsFetcher { + return &GenericDetailsFetcher{ resType: resType, reader: provider, deserializer: deserializer, } } -func (f *GenericDetailFetcher) ReadDetails(res resource.Resource) (resource.Resource, error) { +func (f *GenericDetailsFetcher) ReadDetails(res resource.Resource) (resource.Resource, error) { ctyVal, err := f.reader.ReadResource(terraform.ReadResourceArgs{ Ty: f.resType, ID: res.TerraformId(), diff --git a/pkg/remote/common/library.go b/pkg/remote/common/library.go index 9e3c24ca..db399aef 100644 --- a/pkg/remote/common/library.go +++ b/pkg/remote/common/library.go @@ -29,8 +29,8 @@ func (r *RemoteLibrary) Enumerators() []Enumerator { return r.enumerators } -func (r *RemoteLibrary) AddDetailsFetcher(ty resource.ResourceType, detailFetcher DetailsFetcher) { - r.detailsFetchers[ty] = detailFetcher +func (r *RemoteLibrary) AddDetailsFetcher(ty resource.ResourceType, detailsFetcher DetailsFetcher) { + r.detailsFetchers[ty] = detailsFetcher } func (r *RemoteLibrary) GetDetailsFetcher(ty resource.ResourceType) DetailsFetcher { diff --git a/pkg/remote/ec2_scanner_test.go b/pkg/remote/ec2_scanner_test.go index adab141d..7e7ec546 100644 --- a/pkg/remote/ec2_scanner_test.go +++ b/pkg/remote/ec2_scanner_test.go @@ -102,7 +102,7 @@ func TestEC2EbsVolume(t *testing.T) { Name: "test", DefaultAlias: "eu-west-3", })) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsEbsVolumeResourceType, common.NewGenericDetailFetcher(resourceaws.AwsEbsVolumeResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsEbsVolumeResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsEbsVolumeResourceType, provider, deserializer)) s := NewScanner(nil, remoteLibrary, alerter, scanOptions) got, err := s.Resources() @@ -193,7 +193,7 @@ func TestEC2EbsSnapshot(t *testing.T) { Name: "test", DefaultAlias: "eu-west-3", })) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsEbsSnapshotResourceType, common.NewGenericDetailFetcher(resourceaws.AwsEbsSnapshotResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsEbsSnapshotResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsEbsSnapshotResourceType, provider, deserializer)) s := NewScanner(nil, remoteLibrary, alerter, scanOptions) got, err := s.Resources() @@ -284,7 +284,7 @@ func TestEC2Eip(t *testing.T) { Name: "test", DefaultAlias: "eu-west-3", })) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsEipResourceType, common.NewGenericDetailFetcher(resourceaws.AwsEipResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsEipResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsEipResourceType, provider, deserializer)) s := NewScanner(nil, remoteLibrary, alerter, scanOptions) got, err := s.Resources() diff --git a/pkg/remote/github/init.go b/pkg/remote/github/init.go index 2bb583fc..99e53144 100644 --- a/pkg/remote/github/init.go +++ b/pkg/remote/github/init.go @@ -45,7 +45,7 @@ func Init(version string, alerter *alerter.Alerter, providerLibrary.AddProvider(terraform.GITHUB, provider) remoteLibrary.AddEnumerator(NewGithubTeamEnumerator(repository, factory, provider.Config)) - remoteLibrary.AddDetailsFetcher(github.GithubTeamResourceType, common.NewGenericDetailFetcher(github.GithubTeamResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(github.GithubTeamResourceType, common.NewGenericDetailsFetcher(github.GithubTeamResourceType, provider, deserializer)) supplierLibrary.AddSupplier(NewGithubRepositorySupplier(provider, repository, deserializer)) supplierLibrary.AddSupplier(NewGithubMembershipSupplier(provider, repository, deserializer)) diff --git a/pkg/remote/github_team_scanner_test.go b/pkg/remote/github_team_scanner_test.go index d9a5c6ca..2e8c2aaa 100644 --- a/pkg/remote/github_team_scanner_test.go +++ b/pkg/remote/github_team_scanner_test.go @@ -88,7 +88,7 @@ func TestScanGithubTeam(t *testing.T) { Name: "test", DefaultAlias: "eu-west-3", })) - remoteLibrary.AddDetailsFetcher(githubres.GithubTeamResourceType, common.NewGenericDetailFetcher(githubres.GithubTeamResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(githubres.GithubTeamResourceType, common.NewGenericDetailsFetcher(githubres.GithubTeamResourceType, provider, deserializer)) s := NewScanner(nil, remoteLibrary, alerter, scanOptions) got, err := s.Resources()