* Allow REALPEER to overwrite GHOSTPEER netixlan entry, if asn and IPv6/v4 addresses matches the IX-F Members Export information #983 * Lightweight user notification mechanism #758 * do not allow affiliation with a deleted organisation #953 * Improve readability when users have special permissions #659 * fix advanced search export when api-cache exist and no filters were supplied #1153 * Ops: Throttle strings with "Response size" should be renamed "Repeated request" #1168 * allow ixlan prefix to be changed / deleted regardless of existence of netixlans in the address space #924 * linting * poetry relock * remove debug code * linting * fixed Reset IX-F suggestions link non-functional #1253 * solved UI shows own email when viewing affiliation requests for an organization #1250 * Adjust "Add Facility" menu to include newly defined fields #1091 * Footer "Global System Statistics" should be cached within django instance, not updated with every page load #1283 * linting * django-handleref to 1.1.0 and relock poetry * GLOBAL_STATS_CACHE_DURATION default to 900 seconds * remove vscode and idea * remove Ctl/dev/docker-compose.debug.yml * remove unsused variable * rename STATS to __STATS * linting * regen docs
7.1 KiB
Generated from rest.py on 2022-11-08 14:31:50.933987
peeringdb_server.rest
REST API view definitions.
REST API path routing.
REST API permission checking (facilitated through django-grainy).
REST API error handling.
REST API list filtering logic.
peeringdb-py client compatibility checking.
The peeringdb REST API is implemented through django-rest-framework.
Functions
model_view_set
def model_view_set(model, methods=None, mixins=None)
Shortcut for peeringdb models to generate viewset and register in the API urls.
Classes
ASSetViewSet
ASSetViewSet(peeringdb_server.rest.ReadOnlyMixin, rest_framework.viewsets.ModelViewSet)
AS-SET endpoint.
List all as sets mapped by asn.
Methods
get_queryset
def get_queryset(self)
Get the list of items for this view.
This must be an iterable, and may be a queryset.
Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset
directly, as self.queryset gets evaluated only once, and those results
are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
BasicAuthMFABlockWrite
BasicAuthMFABlockWrite(rest_framework.permissions.BasePermission)
When an account has MFA enabled and basic-auth is used to authenticate the account for a write operation on the API block the request.
Methods
has_permission
def has_permission(self, request, view)
Return True if permission is granted, False otherwise.
DataException
DataException(builtins.ValueError)
Inappropriate argument value (of correct type).
DataMissingException
DataMissingException(peeringdb_server.rest.DataException)
"" Raised when the json data sent with a POST, PUT or PATCH request is missing.
Methods
_init_
def __init__(self, method)
Initialize self. See help(type(self)) for accurate signature.
DataParseException
DataParseException(peeringdb_server.rest.DataException)
Raised when the json data sent with a POST, PUT or PATCH request could not be parsed.
Methods
_init_
def __init__(self, method, exc)
Initialize self. See help(type(self)) for accurate signature.
FacilityViewSet
FacilityViewSet(peeringdb_server.rest.ModelViewSet)
Generic ModelViewSet Base Class. This should probably be moved to a common lib ?
IXLanPrefixViewSet
IXLanPrefixViewSet(peeringdb_server.rest.ModelViewSet)
Generic ModelViewSet Base Class. This should probably be moved to a common lib ?
IXLanViewSet
IXLanViewSet(peeringdb_server.rest.ModelViewSet)
Generic ModelViewSet Base Class. This should probably be moved to a common lib ?
InternetExchangeFacilityViewSet
InternetExchangeFacilityViewSet(peeringdb_server.rest.ModelViewSet)
Generic ModelViewSet Base Class. This should probably be moved to a common lib ?
InternetExchangeMixin
InternetExchangeMixin(builtins.object)
Custom API endpoints for the internet exchange object, exposed to api/ix/{id}/{action}
Methods
request_ixf_import
def request_ixf_import(self, request, *args, **kwargs)
Allows managers of an ix to request an ix-f import. (#779)
InternetExchangeViewSet
InternetExchangeViewSet(peeringdb_server.rest.InternetExchangeMixin, peeringdb_server.rest.ModelViewSet)
Custom API endpoints for the internet exchange object, exposed to api/ix/{id}/{action}
ModelViewSet
ModelViewSet(rest_framework.viewsets.ModelViewSet)
Generic ModelViewSet Base Class. This should probably be moved to a common lib ?
Methods
get_queryset
def get_queryset(self)
Prepare the queryset.
partial_update
def partial_update(self, request, *args, **kwargs)
PATCH (partial update) is currently disabled.
require_data
def require_data(self, request)
Test that the request contains data in its body that can be parsed to the required format (json) and is not empty.
Will raise DataParseException error if request payload could not be parsed.
Will raise DataMissingException error if request payload is missing or was parsed to an empty object.
NetworkContactViewSet
NetworkContactViewSet(peeringdb_server.rest.ModelViewSet)
Generic ModelViewSet Base Class. This should probably be moved to a common lib ?
NetworkFacilityViewSet
NetworkFacilityViewSet(peeringdb_server.rest.ModelViewSet)
Generic ModelViewSet Base Class. This should probably be moved to a common lib ?
NetworkIXLanViewSet
NetworkIXLanViewSet(peeringdb_server.rest.ModelViewSet)
Generic ModelViewSet Base Class. This should probably be moved to a common lib ?
NetworkViewSet
NetworkViewSet(peeringdb_server.rest.ModelViewSet)
Generic ModelViewSet Base Class. This should probably be moved to a common lib ?
OrganizationViewSet
OrganizationViewSet(peeringdb_server.rest.ModelViewSet)
Generic ModelViewSet Base Class. This should probably be moved to a common lib ?
RestRouter
RestRouter(rest_framework.routers.DefaultRouter)
The default router extends the SimpleRouter, but also adds in a default API root view, and adds format suffix patterns to the URLs.
Methods
_init_
def __init__(self, trailing_slash=False)
Initialize self. See help(type(self)) for accurate signature.
client_check
client_check(builtins.object)
Decorator that can be attached to rest viewset responses and will generate an error response if the requesting peeringdb client is running a client or backend version that is incompatible with the server.
Compatibilty is controlled via facsimile during deploy and can be configured in env.misc.api.compat
Methods
_call_
def __call__(self, fn)
Call self as a function.
_init_
def __init__(self)
Initialize self. See help(type(self)) for accurate signature.
backend_max_version
def backend_max_version(self, backend)
Return the max supported version for the specified backend.
backend_min_version
def backend_min_version(self, backend)
Return the min supported version for the specified backend.
client_info
def client_info(self, request)
Parse the useragent in the request and return client version info if possible.
Any connecting client that is NOT the peeringdb client will currently return an empty dict and not compatibility checking will be done.
compat_check
def compat_check(self, request)
Check if the connecting client is compatible with the API.
This is currently only sensible when the request is made through the official peeringdb-py client, any other client will be passed through without checks.
On incompatibility a ValueError is raised.
version_pad
def version_pad(self, version)
Take a semantic version tuple and zero pad to dev version.
version_string
def version_string(self, version)
Take a semantic version tuple and turn into a "." delimited string.
version_tuple
def version_tuple(self, str_version)
Take a semantic version string and turn into a tuple.