def create_metric_alert(client, resource_group_name, rule_name, scopes, condition, disabled=False, description=None, tags=None, actions=None, severity=2, window_size='5m', evaluation_frequency='1m', auto_mitigate=None):
    from azure.mgmt.monitor.models import MetricAlertResource, MetricAlertSingleResourceMultipleMetricCriteria, MetricAlertMultipleResourceMultipleMetricCriteria
    for (i, cond) in enumerate(condition):
        cond.name = 'cond{}'.format(i)
    criteria = None
    target_resource_type = None
    target_resource_region = None
    if (len(scopes) == 1):
        criteria = MetricAlertSingleResourceMultipleMetricCriteria(all_of=condition)
    else:
        criteria = MetricAlertMultipleResourceMultipleMetricCriteria(all_of=condition)
        target_resource_type = _parse_resource_type(scopes)
        target_resource_region = 'global'
    kwargs = {'description': description, 'severity': severity, 'enabled': (not disabled), 'scopes': scopes, 'evaluation_frequency': evaluation_frequency, 'window_size': window_size, 'criteria': criteria, 'target_resource_type': target_resource_type, 'target_resource_region': target_resource_region, 'actions': actions, 'tags': tags, 'location': 'global', 'auto_mitigate': auto_mitigate}
    return client.create_or_update(resource_group_name, rule_name, MetricAlertResource(**kwargs))
def create_metric_alert(client, resource_group_name, rule_name, scopes, condition, disabled=False, description=None, tags=None, actions=None, severity=2, window_size='5m', evaluation_frequency='1m', auto_mitigate=None):
    from azure.mgmt.monitor.models import MetricAlertResource, MetricAlertSingleResourceMultipleMetricCriteria, MetricAlertMultipleResourceMultipleMetricCriteria
    for (i, cond) in enumerate(condition):
        cond.name = 'cond{}'.format(i)
    criteria = None
    target_resource_type = None
    target_resource_region = None
    if (len(scopes) == 1):
        criteria = MetricAlertSingleResourceMultipleMetricCriteria(all_of=condition)
    else:
        criteria = MetricAlertMultipleResourceMultipleMetricCriteria(all_of=condition)
        target_resource_type = _parse_resource_type(scopes)
        target_resource_region = 'global'
    kwargs = {'description': description, 'severity': severity, 'enabled': (not disabled), 'scopes': scopes, 'evaluation_frequency': evaluation_frequency, 'window_size': window_size, 'criteria': criteria, 'target_resource_type': target_resource_type, 'target_resource_region': target_resource_region, 'actions': actions, 'tags': tags, 'location': 'global', 'auto_mitigate': auto_mitigate}
    return client.create_or_update(resource_group_name, rule_name, MetricAlertResource(**kwargs))