Skip to content

Commit

Permalink
add(cloud): listfinding call added
Browse files Browse the repository at this point in the history
  • Loading branch information
realwebdev committed Feb 15, 2023
1 parent 88d9a3a commit 33a32bd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions internal/adapters/cloud/aws/accessanalyzer/adapt.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,28 @@ func (a *adapter) adaptAnalyzer(apiAnalyzer aatypes.AnalyzerSummary) (*accessana
if apiAnalyzer.Name != nil {
name = *apiAnalyzer.Name
}

var findings []accessanalyzer.Findings
output, err := a.api.ListFindings(a.Context(), &api.ListFindingsInput{
AnalyzerArn: apiAnalyzer.Arn,
})
if err != nil {
return nil, err
}
if output.Findings != nil {
for _, r := range output.Findings {
findings = append(findings, accessanalyzer.Findings{
Metadata: metadata,
})
_ = r
}
}

return &accessanalyzer.Analyzer{
Metadata: metadata,
ARN: types.String(*apiAnalyzer.Arn, metadata),
Name: types.String(name, metadata),
Active: types.Bool(apiAnalyzer.Status == aatypes.AnalyzerStatusActive, metadata),
Findings: findings,
}, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func getAccessAnalyzer(ctx parser.FileContext) (analyzers []accessanalyzer.Analy
aa := accessanalyzer.Analyzer{
Metadata: r.Metadata(),
Name: r.GetStringProperty("AnalyzerName"),
ARN: r.StringDefault(""),
}

analyzers = append(analyzers, aa)
Expand Down
5 changes: 5 additions & 0 deletions pkg/providers/aws/accessanalyzer/aa.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ type Analyzer struct {
ARN types.StringValue
Name types.StringValue
Active types.BoolValue
Findings []Findings
}

type Findings struct {
Metadata types.Metadata
}

0 comments on commit 33a32bd

Please sign in to comment.