Ejemplo n.º 1
0
 def __call__(self, parser, namespace, values, option_string=None):
     from azure.mgmt.monitor.models import MetricAlertAction
     action = MetricAlertAction(
         action_group_id=values[0],
         webhook_properties=dict(x.split('=', 1) for x in values[1:]) if len(values) > 1 else None
     )
     action.odatatype = 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.' \
                        'DataContracts.Resources.ScheduledQueryRules.Action'
     super(MetricAlertAddAction, self).__call__(parser, namespace, action, option_string)
Ejemplo n.º 2
0
 def __call__(self, parser, namespace, values, option_string=None):
     from azure.mgmt.monitor.models import MetricAlertAction
     action = MetricAlertAction(
         action_group_id=values[0],
         webhook_properties=dict(x.split('=', 1) for x in values[1:]) if len(values) > 1 else None
     )
     action.odatatype = 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.' \
                        'DataContracts.Resources.ScheduledQueryRules.Action'
     super(MetricAlertAddAction, self).__call__(parser, namespace, action, option_string)
Ejemplo n.º 3
0
    def __call__(self, parser, namespace, values, option_string=None):
        action_group_id = values[0]
        try:
            webhook_property_candidates = dict(
                x.split('=', 1)
                for x in values[1:]) if len(values) > 1 else None
        except ValueError:
            err_msg = "value of {} is invalid. Please refer to --help to get insight of correct format".format(
                option_string)
            raise InvalidArgumentValueError(err_msg)

        from azure.mgmt.monitor.models import MetricAlertAction
        action = MetricAlertAction(
            action_group_id=action_group_id,
            web_hook_properties=webhook_property_candidates)
        action.odatatype = 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.' \
                           'DataContracts.Resources.ScheduledQueryRules.Action'
        super(MetricAlertAddAction, self).__call__(parser, namespace, action,
                                                   option_string)