def create_metric_rule(client, resource_group_name, rule_name, target, condition, description=None, disabled=False, location=None, tags=None, email_service_owners=False, actions=None):
    from azure.mgmt.monitor.models import AlertRuleResource, RuleEmailAction
    condition.data_source.resource_uri = target
    (custom_emails, webhooks, _) = _parse_actions(actions)
    actions = ([RuleEmailAction(send_to_service_owners=email_service_owners, custom_emails=custom_emails)] + (webhooks or []))
    rule = AlertRuleResource(location=location, alert_rule_resource_name=rule_name, is_enabled=(not disabled), condition=condition, tags=tags, description=description, actions=actions)
    return client.create_or_update(resource_group_name, rule_name, rule)
def create_metric_rule(client, resource_group_name, rule_name, target, condition, description=None, disabled=False, location=None, tags=None, email_service_owners=False, actions=None):
    from azure.mgmt.monitor.models import AlertRuleResource, RuleEmailAction
    condition.data_source.resource_uri = target
    (custom_emails, webhooks, _) = _parse_actions(actions)
    actions = ([RuleEmailAction(send_to_service_owners=email_service_owners, custom_emails=custom_emails)] + (webhooks or []))
    rule = AlertRuleResource(location=location, alert_rule_resource_name=rule_name, is_enabled=(not disabled), condition=condition, tags=tags, description=description, actions=actions)
    return client.create_or_update(resource_group_name, rule_name, rule)