github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/internal/adapters/cloudformation/aws/elasticache/cluster.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 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  }