Skip to content

Commit

Permalink
Merge pull request #33 from tmclaugh/elasticache_filtering
Browse files Browse the repository at this point in the history
Add some basic filtering on elasticache instances
  • Loading branch information
crccheck committed Mar 5, 2016
2 parents 8c8841e + d83b533 commit 2bee5b6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plumbum.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ def list_elasticache(region, filter_by_kwargs):
conn = boto.elasticache.connect_to_region(region)
req = conn.describe_cache_clusters()
data = req["DescribeCacheClustersResponse"]["DescribeCacheClustersResult"]["CacheClusters"]
clusters = [x['CacheClusterId'] for x in data]
if filter_by_kwargs:
clusters = [x['CacheClusterId'] for x in data if x[filter_by_kwargs.keys()[0]] == filter_by_kwargs.values()[0]]
else:
clusters = [x['CacheClusterId'] for x in data]
return clusters


Expand Down

0 comments on commit 2bee5b6

Please sign in to comment.