mirror of https://github.com/jumpserver/jumpserver
Add proxy log api for create or update
parent
0c8922e30f
commit
081af2f953
|
@ -6,8 +6,16 @@ from rest_framework import generics
|
|||
|
||||
import serializers
|
||||
|
||||
from .models import ProxyLog
|
||||
|
||||
class ProxyLogCreateApi(generics.CreateAPIView):
|
||||
|
||||
class ProxyLogListCreateApi(generics.ListCreateAPIView):
|
||||
queryset = ProxyLog.objects.all()
|
||||
serializer_class = serializers.ProxyLogSerializer
|
||||
|
||||
|
||||
class ProxyLogDetailApi(generics.RetrieveUpdateDestroyAPIView):
|
||||
queryset = ProxyLog.objects.all()
|
||||
serializer_class = serializers.ProxyLogSerializer
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ class ProxyLog(models.Model):
|
|||
system_user = models.CharField(max_length=20, verbose_name=_('System user'))
|
||||
login_type = models.CharField(choices=LOGIN_TYPE_CHOICE, max_length=1, verbose_name=_('Login type'))
|
||||
log_file = models.CharField(max_length=1000, blank=True, null=True)
|
||||
was_failed = models.BooleanField(default=False, verbose_name=_('Did connect failed'))
|
||||
is_finished = models.BooleanField(default=False, verbose_name=_('Is finished'))
|
||||
date_start = models.DateTimeField(auto_now=True, verbose_name=_('Date start'))
|
||||
date_finished = models.DateTimeField(null=True, verbose_name=_('Date finished'))
|
||||
|
|
|
@ -11,6 +11,7 @@ urlpatterns = [
|
|||
|
||||
|
||||
urlpatterns += [
|
||||
url(r'^v1/proxy-log$', api.ProxyLogCreateApi.as_view(), name='proxy-log-create-api'),
|
||||
url(r'^v1/command-log$', api.CommandLogCreateApi.as_view(), name='command-log-create-api'),
|
||||
url(r'^v1/proxy-log/$', api.ProxyLogListCreateApi.as_view(), name='proxy-log-list-create-api'),
|
||||
url(r'^v1/proxy-log/(?P<pk>\d+)/$', api.ProxyLogDetailApi.as_view(), name='proxy-log-detail-api'),
|
||||
url(r'^v1/command-log/$', api.CommandLogCreateApi.as_view(), name='command-log-create-api'),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue