commit
dceec03941
|
@ -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))
|
||||
|
|
|
@ -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(),
|
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue