@@ -320,8 +320,11 @@ def build_source_params(self, props, source_json=None):
320
320
return source_json
321
321
322
322
@staticmethod
323
- def _prepare_aws_filter_tags (props , namespaces ):
323
+ def _prepare_aws_filter_tags (props ):
324
324
filters = []
325
+
326
+ namespaces = props .get ("Namespaces" , [])
327
+ namespaces = [namespace for namespace in namespaces if namespace .strip ().startswith ('AWS/' )]
325
328
aws_tag_filters = props .get ("AWSTagFilters" , {})
326
329
if aws_tag_filters :
327
330
# Convert the string to JSON (Python dictionary)
@@ -338,7 +341,7 @@ def _prepare_aws_filter_tags(props, namespaces):
338
341
else :
339
342
aws_tag_filters = {}
340
343
for key , value in aws_tag_filters .items ():
341
- if key in namespaces :
344
+ if key in namespaces or key . lower () == "all" :
342
345
filters .append ({
343
346
"type" : "TagFilters" ,
344
347
"namespace" : key ,
@@ -365,8 +368,7 @@ def _get_path(self, props):
365
368
path ["limitToRegions" ] = regions
366
369
if "Namespaces" in props :
367
370
path ["limitToNamespaces" ] = props .get ("Namespaces" )
368
- print ("limitToNamespaces: " , path ["limitToNamespaces" ])
369
- aws_filter_tag = self ._prepare_aws_filter_tags (props , props .get ("Namespaces" , []))
371
+ aws_filter_tag = self ._prepare_aws_filter_tags (props )
370
372
if aws_filter_tag :
371
373
path ["tagFilters" ] = aws_filter_tag
372
374
if source_type == "AwsCloudWatch" :
@@ -465,11 +467,12 @@ def _prepare_aws_filter_tags(props):
465
467
else :
466
468
aws_tag_filters = {}
467
469
for key , value in aws_tag_filters .items ():
468
- filters .append ({
469
- "type" : "TagFilters" ,
470
- "namespace" : key ,
471
- "tags" : value ["tags" ]
472
- })
470
+ if key .strip ().startswith ('AWS/' ) or key .lower () == "all" :
471
+ filters .append ({
472
+ "type" : "TagFilters" ,
473
+ "namespace" : key ,
474
+ "tags" : value ["tags" ]
475
+ })
473
476
return filters
474
477
475
478
def _get_path (self , props ):
0 commit comments