core: remove provider and outpostserviceconnection base model create operations

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-03-30 18:35:06 +02:00
parent d1dd6b7a8f
commit 23d7ef36d2
3 changed files with 16 additions and 168 deletions

View File

@ -2,12 +2,13 @@
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from drf_yasg.utils import swagger_auto_schema
from rest_framework import mixins
from rest_framework.decorators import action
from rest_framework.fields import ReadOnlyField
from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework.serializers import ModelSerializer, SerializerMethodField
from rest_framework.viewsets import ModelViewSet
from rest_framework.viewsets import GenericViewSet
from authentik.core.api.utils import MetaNameSerializer, TypeCreateSerializer
from authentik.core.models import Provider
@ -44,7 +45,12 @@ class ProviderSerializer(ModelSerializer, MetaNameSerializer):
]
class ProviderViewSet(ModelViewSet):
class ProviderViewSet(
mixins.RetrieveModelMixin,
mixins.DestroyModelMixin,
mixins.ListModelMixin,
GenericViewSet,
):
"""Provider Viewset"""
queryset = Provider.objects.none()

View File

@ -3,12 +3,13 @@ from dataclasses import asdict
from django.urls import reverse
from drf_yasg.utils import swagger_auto_schema
from rest_framework import mixins
from rest_framework.decorators import action
from rest_framework.fields import BooleanField, CharField, SerializerMethodField
from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework.serializers import ModelSerializer
from rest_framework.viewsets import ModelViewSet
from rest_framework.viewsets import GenericViewSet, ModelViewSet
from authentik.core.api.utils import (
MetaNameSerializer,
@ -53,7 +54,12 @@ class ServiceConnectionStateSerializer(PassiveSerializer):
version = CharField(read_only=True)
class ServiceConnectionViewSet(ModelViewSet):
class ServiceConnectionViewSet(
mixins.RetrieveModelMixin,
mixins.DestroyModelMixin,
mixins.ListModelMixin,
GenericViewSet,
):
"""ServiceConnection Viewset"""
queryset = OutpostServiceConnection.objects.select_subclasses()

View File

@ -4943,30 +4943,6 @@ paths:
$ref: '#/definitions/GenericError'
tags:
- outposts
post:
operationId: outposts_service_connections_all_create
description: ServiceConnection Viewset
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/ServiceConnection'
responses:
'201':
description: ''
schema:
$ref: '#/definitions/ServiceConnection'
'400':
description: Invalid input.
schema:
$ref: '#/definitions/ValidationError'
'403':
description: Authentication credentials were invalid, absent or insufficient.
schema:
$ref: '#/definitions/GenericError'
tags:
- outposts
parameters: []
/outposts/service_connections/all/types/:
get:
@ -5033,64 +5009,6 @@ paths:
$ref: '#/definitions/APIException'
tags:
- outposts
put:
operationId: outposts_service_connections_all_update
description: ServiceConnection Viewset
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/ServiceConnection'
responses:
'200':
description: ''
schema:
$ref: '#/definitions/ServiceConnection'
'400':
description: Invalid input.
schema:
$ref: '#/definitions/ValidationError'
'403':
description: Authentication credentials were invalid, absent or insufficient.
schema:
$ref: '#/definitions/GenericError'
'404':
description: Object does not exist or caller has insufficient permissions
to access it.
schema:
$ref: '#/definitions/APIException'
tags:
- outposts
patch:
operationId: outposts_service_connections_all_partial_update
description: ServiceConnection Viewset
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/ServiceConnection'
responses:
'200':
description: ''
schema:
$ref: '#/definitions/ServiceConnection'
'400':
description: Invalid input.
schema:
$ref: '#/definitions/ValidationError'
'403':
description: Authentication credentials were invalid, absent or insufficient.
schema:
$ref: '#/definitions/GenericError'
'404':
description: Object does not exist or caller has insufficient permissions
to access it.
schema:
$ref: '#/definitions/APIException'
tags:
- outposts
delete:
operationId: outposts_service_connections_all_delete
description: ServiceConnection Viewset
@ -8689,30 +8607,6 @@ paths:
$ref: '#/definitions/GenericError'
tags:
- providers
post:
operationId: providers_all_create
description: Provider Viewset
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/Provider'
responses:
'201':
description: ''
schema:
$ref: '#/definitions/Provider'
'400':
description: Invalid input.
schema:
$ref: '#/definitions/ValidationError'
'403':
description: Authentication credentials were invalid, absent or insufficient.
schema:
$ref: '#/definitions/GenericError'
tags:
- providers
parameters: []
/providers/all/types/:
get:
@ -8779,64 +8673,6 @@ paths:
$ref: '#/definitions/APIException'
tags:
- providers
put:
operationId: providers_all_update
description: Provider Viewset
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/Provider'
responses:
'200':
description: ''
schema:
$ref: '#/definitions/Provider'
'400':
description: Invalid input.
schema:
$ref: '#/definitions/ValidationError'
'403':
description: Authentication credentials were invalid, absent or insufficient.
schema:
$ref: '#/definitions/GenericError'
'404':
description: Object does not exist or caller has insufficient permissions
to access it.
schema:
$ref: '#/definitions/APIException'
tags:
- providers
patch:
operationId: providers_all_partial_update
description: Provider Viewset
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/Provider'
responses:
'200':
description: ''
schema:
$ref: '#/definitions/Provider'
'400':
description: Invalid input.
schema:
$ref: '#/definitions/ValidationError'
'403':
description: Authentication credentials were invalid, absent or insufficient.
schema:
$ref: '#/definitions/GenericError'
'404':
description: Object does not exist or caller has insufficient permissions
to access it.
schema:
$ref: '#/definitions/APIException'
tags:
- providers
delete:
operationId: providers_all_delete
description: Provider Viewset