authentik.events.api.notification_rules
NotificationRule API Views
1"""NotificationRule API Views""" 2 3from rest_framework.viewsets import ModelViewSet 4 5from authentik.core.api.groups import GroupSerializer 6from authentik.core.api.used_by import UsedByMixin 7from authentik.core.api.utils import ModelSerializer 8from authentik.events.models import NotificationRule 9 10 11class NotificationRuleSerializer(ModelSerializer): 12 """NotificationRule Serializer""" 13 14 destination_group_obj = GroupSerializer(read_only=True, source="destination_group") 15 16 class Meta: 17 model = NotificationRule 18 fields = [ 19 "pk", 20 "name", 21 "transports", 22 "severity", 23 "destination_group", 24 "destination_group_obj", 25 "destination_event_user", 26 ] 27 28 29class NotificationRuleViewSet(UsedByMixin, ModelViewSet): 30 """NotificationRule Viewset""" 31 32 queryset = NotificationRule.objects.all() 33 serializer_class = NotificationRuleSerializer 34 filterset_fields = ["name", "severity", "destination_group__name"] 35 ordering = ["name"] 36 search_fields = ["name", "destination_group__name"]
12class NotificationRuleSerializer(ModelSerializer): 13 """NotificationRule Serializer""" 14 15 destination_group_obj = GroupSerializer(read_only=True, source="destination_group") 16 17 class Meta: 18 model = NotificationRule 19 fields = [ 20 "pk", 21 "name", 22 "transports", 23 "severity", 24 "destination_group", 25 "destination_group_obj", 26 "destination_event_user", 27 ]
NotificationRule Serializer
Inherited Members
class
NotificationRuleSerializer.Meta:
17 class Meta: 18 model = NotificationRule 19 fields = [ 20 "pk", 21 "name", 22 "transports", 23 "severity", 24 "destination_group", 25 "destination_group_obj", 26 "destination_event_user", 27 ]
model =
<class 'authentik.events.models.NotificationRule'>
class
NotificationRuleViewSet(authentik.core.api.used_by.UsedByMixin, rest_framework.viewsets.ModelViewSet):
30class NotificationRuleViewSet(UsedByMixin, ModelViewSet): 31 """NotificationRule Viewset""" 32 33 queryset = NotificationRule.objects.all() 34 serializer_class = NotificationRuleSerializer 35 filterset_fields = ["name", "severity", "destination_group__name"] 36 ordering = ["name"] 37 search_fields = ["name", "destination_group__name"]
NotificationRule Viewset
serializer_class =
<class 'NotificationRuleSerializer'>