From d83b53381976ddefaaed21a7514159e5e33f6115 Mon Sep 17 00:00:00 2001 From: Tom McLaughlin Date: Thu, 3 Mar 2016 21:51:26 -0500 Subject: [PATCH] Add some basic filtering on elasticache instances --- plumbum.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plumbum.py b/plumbum.py index b8030ff..75e6b32 100644 --- a/plumbum.py +++ b/plumbum.py @@ -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