scram.route_manager.api package¶
Submodules¶
scram.route_manager.api.exceptions module¶
- exception scram.route_manager.api.exceptions.ActiontypeNotAllowed(detail=None, code=None)¶
Bases:
APIException
- default_code = 'actiontype_not_allowed'¶
- default_detail = 'This client is not allowed to use this actiontype'¶
- status_code = 403¶
- exception scram.route_manager.api.exceptions.IgnoredRoute(detail=None, code=None)¶
Bases:
APIException
- default_code = 'ignored_route'¶
- default_detail = 'This CIDR is on the ignore list. You are not allowed to add it here.'¶
- status_code = 400¶
- exception scram.route_manager.api.exceptions.PrefixTooLarge(detail=None, code=None)¶
Bases:
APIException
- default_code = 'prefix_too_large'¶
- default_detail = "You've supplied too large of a network. settings.V4_MINPREFIX = 32 settings.V6_MINPREFIX = 128"¶
- status_code = 400¶
- v4_min_prefix = 32¶
- v6_min_prefix = 128¶
scram.route_manager.api.serializers module¶
- class scram.route_manager.api.serializers.ActionTypeSerializer(*args, **kwargs)¶
Bases:
ModelSerializer
- class Meta¶
Bases:
object
- fields = ['pk', 'name', 'available']¶
- model¶
alias of
ActionType
- class scram.route_manager.api.serializers.ClientSerializer(*args, **kwargs)¶
Bases:
ModelSerializer
- class scram.route_manager.api.serializers.EntrySerializer(*args, **kwargs)¶
Bases:
HyperlinkedModelSerializer
- create(validated_data)¶
We have a bit of extra checking around this in order to provide descriptive messages when something goes wrong, but this method is essentially just:
return ExampleModel.objects.create(**validated_data)
If there are many to many fields present on the instance then they cannot be set until the model is instantiated, in which case the implementation is like so:
example_relationship = validated_data.pop(‘example_relationship’) instance = ExampleModel.objects.create(**validated_data) instance.example_relationship = example_relationship return instance
The default implementation also does not handle nested relationships. If you want to support writable nested relationships you’ll need to write an explicit .create() method.
- get_comment(obj)¶
- who = CurrentUserDefault()¶
- class scram.route_manager.api.serializers.IgnoreEntrySerializer(*args, **kwargs)¶
Bases:
ModelSerializer
- class Meta¶
Bases:
object
- fields = ['route', 'comment']¶
- model¶
alias of
IgnoreEntry
scram.route_manager.api.views module¶
- class scram.route_manager.api.views.ActionTypeViewSet(**kwargs)¶
Bases:
ReadOnlyModelViewSet
- basename = None¶
- description = None¶
- detail = None¶
- lookup_field = 'name'¶
- name = None¶
- permission_classes = (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
- queryset¶
- serializer_class¶
alias of
ActionTypeSerializer
- suffix = None¶
- class scram.route_manager.api.views.ClientViewSet(**kwargs)¶
Bases:
ModelViewSet
- basename = None¶
- description = None¶
- detail = None¶
- http_method_names = ['post']¶
- lookup_field = 'hostname'¶
- name = None¶
- permission_classes = (<class 'rest_framework.permissions.AllowAny'>,)¶
- queryset¶
- serializer_class¶
alias of
ClientSerializer
- suffix = None¶
- class scram.route_manager.api.views.EntryViewSet(**kwargs)¶
Bases:
ModelViewSet
- basename = None¶
- description = None¶
- destroy(request, pk=None, *args, **kwargs)¶
- detail = None¶
- static find_entries(arg, active_filter=None)¶
- get_permissions()¶
Instantiates and returns the list of permissions that this view requires.
- http_method_names = ['get', 'post', 'head', 'delete']¶
- lookup_value_regex = '.*'¶
- name = None¶
- perform_create(serializer)¶
- permission_classes = (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
- queryset¶
- retrieve(request, pk=None, **kwargs)¶
- serializer_class¶
alias of
EntrySerializer
- suffix = None¶
- class scram.route_manager.api.views.IgnoreEntryViewSet(**kwargs)¶
Bases:
ModelViewSet
- basename = None¶
- description = None¶
- detail = None¶
- lookup_field = 'route'¶
- name = None¶
- permission_classes = (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
- queryset¶
- serializer_class¶
alias of
IgnoreEntrySerializer
- suffix = None¶