@@ -320,8 +320,11 @@ def build_source_params(self, props, source_json=None):
320320 return source_json
321321
322322 @staticmethod
323- def _prepare_aws_filter_tags (props , namespaces ):
323+ def _prepare_aws_filter_tags (props ):
324324 filters = []
325+
326+ namespaces = props .get ("Namespaces" , [])
327+ namespaces = [namespace for namespace in namespaces if namespace .strip ().startswith ('AWS/' )]
325328 aws_tag_filters = props .get ("AWSTagFilters" , {})
326329 if aws_tag_filters :
327330 # Convert the string to JSON (Python dictionary)
@@ -338,7 +341,7 @@ def _prepare_aws_filter_tags(props, namespaces):
338341 else :
339342 aws_tag_filters = {}
340343 for key , value in aws_tag_filters .items ():
341- if key in namespaces :
344+ if key in namespaces or key . lower () == "all" :
342345 filters .append ({
343346 "type" : "TagFilters" ,
344347 "namespace" : key ,
@@ -365,8 +368,7 @@ def _get_path(self, props):
365368 path ["limitToRegions" ] = regions
366369 if "Namespaces" in props :
367370 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 )
370372 if aws_filter_tag :
371373 path ["tagFilters" ] = aws_filter_tag
372374 if source_type == "AwsCloudWatch" :
@@ -465,11 +467,12 @@ def _prepare_aws_filter_tags(props):
465467 else :
466468 aws_tag_filters = {}
467469 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+ })
473476 return filters
474477
475478 def _get_path (self , props ):
0 commit comments