mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-23 07:29:00 -08:00
23 lines
370 B
Go
23 lines
370 B
Go
package terraform
|
|
|
|
type Blocks []*Block
|
|
|
|
func (blocks Blocks) OfType(t string) Blocks {
|
|
var results []*Block
|
|
for _, block := range blocks {
|
|
if block.Type() == t {
|
|
results = append(results, block)
|
|
}
|
|
}
|
|
return results
|
|
}
|
|
|
|
func (blocks Blocks) WithID(id string) *Block {
|
|
for _, block := range blocks {
|
|
if block.ID() == id {
|
|
return block
|
|
}
|
|
}
|
|
return nil
|
|
}
|