implement check API route for automation

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-01-15 14:34:03 +01:00
parent 3d2849dddc
commit b4909ce192
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
3 changed files with 24 additions and 3 deletions

View File

@ -19,3 +19,11 @@ This plugin requries one environment variable:
```sh
STATUS_GO_CANARY_PATH=<path_to_status_go_canary_binary>
```
# API
The plugin exposes the standard check API under:
```
/plugins/cabot_check_status_go/api/status_go_checks/
```
Which accepts the standard `GET`/`POST`/`OPTIONS` methods.

View File

@ -1,5 +1,4 @@
import socket
import logging
import subprocess
from os import path
from os import environ as env

View File

@ -1,6 +1,19 @@
from django.conf.urls import url
from django.conf.urls import include, url
from rest_framework.routers import DefaultRouter
from cabot.rest_urls import create_viewset, status_check_fields
from .views import (StatusGoCheckCreateView, StatusGoCheckUpdateView, duplicate_check)
from .models import StatusGoStatusCheck
api_router = DefaultRouter()
api_router.register(r'status_go_checks', create_viewset(
arg_model=StatusGoStatusCheck,
arg_fields=status_check_fields + (
'node_type',
'enode',
),
))
urlpatterns = [
@ -14,6 +27,7 @@ urlpatterns = [
url(r'^statusgocheck/duplicate/(?P<pk>\d+)/',
view=duplicate_check,
name='duplicate-status-go-check')
name='duplicate-status-go-check'),
url(r'^api/', include(api_router.urls)),
]