in modular_sdk/services/parent_service.py [0:0]
def build_type_scope(type_: ParentType, scope: Optional[ParentScope] = None,
tenant_name: Optional[str] = None,
cloud: Optional[str] = None) -> str:
"""
All asserts here are against developer errors
:param type_:
:param scope:
:param tenant_name:
:param cloud:
:return:
"""
scope = scope or ''
tenant_name = tenant_name or ''
cloud = (cloud or '').upper()
# assert type_ in ALL_PARENT_TYPES, f'Invalid parent type {type_}'
if not scope:
_LOG.debug('Scope was not provided to build_type_scope. '
'Keeping tenant and cloud empty')
return COMPOUND_KEYS_SEPARATOR.join((type_, scope, ''))
if cloud:
assert cloud in CLOUD_PROVIDERS, f'Invalid cloud: {cloud}'
if scope == ParentScope.ALL:
return COMPOUND_KEYS_SEPARATOR.join((type_, scope, cloud))
# scope in (ParentScope.DISABLED, ParentScope.SPECIFIC)
return COMPOUND_KEYS_SEPARATOR.join((type_, scope, tenant_name))