in src/services/rule_meta_service.py [0:0]
def gen_rule_id(customer: str, cloud: Optional[str] = None,
name: Optional[str] = None,
version: Optional[str] = None) -> str:
"""
Make sure to supply this method with ALL the attributes in case
you create a new rule
:param customer:
:param cloud:
:param name:
:param version:
:return:
"""
if name and not cloud:
_LOG.warning('Cloud was not provided but name was. '
'Trying to resolve cloud from name')
cloud = RuleName(name).cloud.value
if name and not cloud or version and not name:
raise AssertionError('Invalid usage')
_id = f'{customer}{COMPOUND_KEYS_SEPARATOR}'
if cloud:
_id += f'{cloud}{COMPOUND_KEYS_SEPARATOR}'
if name:
_id += f'{name}{COMPOUND_KEYS_SEPARATOR}'
if version: # or Rule.latest_version(), or any str, or None
_id += f'{version}'
return _id