github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/internal/adapters/cloudformation/aws/elasticache/security_group.go (about)

     1  package elasticache
     2  
     3  import (
     4  	"github.com/khulnasoft-lab/defsec/pkg/providers/aws/elasticache"
     5  	"github.com/khulnasoft-lab/defsec/pkg/scanners/cloudformation/parser"
     6  )
     7  
     8  func getSecurityGroups(ctx parser.FileContext) (securityGroups []elasticache.SecurityGroup) {
     9  
    10  	sgResources := ctx.GetResourcesByType("AWS::ElastiCache::SecurityGroup")
    11  
    12  	for _, r := range sgResources {
    13  
    14  		sg := elasticache.SecurityGroup{
    15  			Metadata:    r.Metadata(),
    16  			Description: r.GetStringProperty("Description"),
    17  		}
    18  		securityGroups = append(securityGroups, sg)
    19  	}
    20  
    21  	return securityGroups
    22  }