in src/sfctl/custom_health.py [0:0]
def parse_service_health_policy_map(formatted_policy):
"""Parse a service health policy map from a string"""
from azure.servicefabric.models import ServiceTypeHealthPolicyMapItem #pylint: disable=line-too-long
if formatted_policy is None:
return None
map_shp = []
for st_desc in formatted_policy:
st_name = st_desc.get('Key', None)
if st_name is None:
raise CLIError('Could not find service type name in service '
'health policy map')
st_policy = st_desc.get('Value', None)
if st_policy is None:
raise CLIError('Could not find service type policy in service '
'health policy map')
service_p = parse_service_health_policy(st_policy)
std_list_item = ServiceTypeHealthPolicyMapItem(key=st_name, value=service_p)
map_shp.append(std_list_item)
return map_shp