github.com/aquasecurity/trivy-iac@v0.8.1-0.20240127024015-3d8e412cf0ab/internal/adapters/cloudformation/aws/elasticache/cluster.go (about)

     1  package elasticache
     2  
     3  import (
     4  	"github.com/aquasecurity/defsec/pkg/providers/aws/elasticache"
     5  	"github.com/aquasecurity/trivy-iac/pkg/scanners/cloudformation/parser"
     6  )
     7  
     8  func getClusterGroups(ctx parser.FileContext) (clusters []elasticache.Cluster) {
     9  
    10  	clusterResources := ctx.GetResourcesByType("AWS::ElastiCache::CacheCluster")
    11  
    12  	for _, r := range clusterResources {
    13  		cluster := elasticache.Cluster{
    14  			Metadata:               r.Metadata(),
    15  			Engine:                 r.GetStringProperty("Engine"),
    16  			NodeType:               r.GetStringProperty("CacheNodeType"),
    17  			SnapshotRetentionLimit: r.GetIntProperty("SnapshotRetentionLimit"),
    18  		}
    19  
    20  		clusters = append(clusters, cluster)
    21  	}
    22  
    23  	return clusters
    24  }