def from_model(cls, model, mask_secrets=False): action = cls._from_model(model) action['runner_type'] = action.get('runner_type', {}).get('name', None) action['tags'] = TagsHelper.from_model(model.tags) if getattr(model, 'notify', None): action['notify'] = NotificationsHelper.from_model(model.notify) return cls(**action)
def from_model(cls, model, mask_secrets=False): action = cls._from_model(model) action['runner_type'] = action['runner_type']['name'] action['tags'] = TagsHelper.from_model(model.tags) if getattr(model, 'notify', None): action['notify'] = NotificationsHelper.from_model(model.notify) return cls(**action)
def from_model(cls, model): action = cls._from_model(model) action['runner_type'] = action['runner_type']['name'] action['tags'] = TagsHelper.from_model(model.tags) if getattr(model, 'notify', None): action['notify'] = NotificationsHelper.from_model(model.notify) return cls(**action)
def from_model(cls, model, mask_secrets=False): action = cls._from_model(model) action["runner_type"] = action.get("runner_type", {}).get("name", None) action["tags"] = TagsHelper.from_model(model.tags) if getattr(model, "notify", None): action["notify"] = NotificationsHelper.from_model(model.notify) return cls(**action)
def from_model(cls, model, mask_secrets=False): action = cls._from_model(model) action["runner_type"] = action["runner_type"]["name"] action["tags"] = TagsHelper.from_model(model.tags) if getattr(model, "notify", None): action["notify"] = NotificationsHelper.from_model(model.notify) return cls(**action)
def from_model(cls, model): rule = cls._from_model(model) trigger_db = reference.get_model_by_resource_ref(Trigger, model.trigger) if not trigger_db: raise ValueError('Missing TriggerDB object for rule %s' % (rule['id'])) rule['trigger'] = vars(TriggerAPI.from_model(trigger_db)) del rule['trigger']['id'] del rule['trigger']['name'] rule['tags'] = TagsHelper.from_model(model.tags) return cls(**rule)
def from_model(cls, model): rule = cls._from_model(model) trigger_db = reference.get_model_by_resource_ref(Trigger, model.trigger) if not trigger_db: raise ValueError('Missing TriggerDB object for rule %s' % (rule['id'])) rule['trigger'] = vars(TriggerAPI.from_model(trigger_db)) del rule['trigger']['id'] del rule['trigger']['name'] rule['tags'] = TagsHelper.from_model(model.tags) return cls(**rule)
def from_model(cls, model, mask_secrets=False): rule = cls._from_model(model, mask_secrets=mask_secrets) trigger_db = reference.get_model_by_resource_ref(Trigger, model.trigger) if not trigger_db: raise ValueError('Missing TriggerDB object for rule %s' % (rule['id'])) rule['trigger'] = { 'type': trigger_db.type, 'parameters': trigger_db.parameters, 'ref': model.trigger } rule['tags'] = TagsHelper.from_model(model.tags) return cls(**rule)
def from_model(cls, model, mask_secrets=False): rule = cls._from_model(model, mask_secrets=mask_secrets) trigger_db = reference.get_model_by_resource_ref( Trigger, model.trigger) if not trigger_db: raise ValueError('Missing TriggerDB object for rule %s' % (rule['id'])) rule['trigger'] = { 'type': trigger_db.type, 'parameters': trigger_db.parameters, 'ref': model.trigger } rule['tags'] = TagsHelper.from_model(model.tags) return cls(**rule)
def from_model(cls, model, mask_secrets=False, ignore_missing_trigger=False): rule = cls._from_model(model, mask_secrets=mask_secrets) trigger_db = reference.get_model_by_resource_ref(Trigger, model.trigger) if not ignore_missing_trigger and not trigger_db: raise ValueError("Missing TriggerDB object for rule %s" % (rule["id"])) if trigger_db: rule["trigger"] = { "type": trigger_db.type, "parameters": trigger_db.parameters, "ref": model.trigger, } rule["tags"] = TagsHelper.from_model(model.tags) return cls(**rule)
def from_model(cls, model): triggertype = cls._from_model(model) triggertype['tags'] = TagsHelper.from_model(model.tags) return cls(**triggertype)
def from_model(cls, model, mask_secrets=False): triggertype = cls._from_model(model, mask_secrets=mask_secrets) triggertype['tags'] = TagsHelper.from_model(model.tags) return cls(**triggertype)
def from_model(cls, model, mask_secrets=False): triggertype = cls._from_model(model, mask_secrets=mask_secrets) triggertype['tags'] = TagsHelper.from_model(model.tags) return cls(**triggertype)
def from_model(cls, model): action = cls._from_model(model) action['runner_type'] = action['runner_type']['name'] action['tags'] = TagsHelper.from_model(model.tags) return cls(**action)
def from_model(cls, model): triggertype = cls._from_model(model) triggertype['tags'] = TagsHelper.from_model(model.tags) return cls(**triggertype)