diff options
author | fengyuanxing <feng.yuanxing@zte.com.cn> | 2018-01-26 15:29:06 +0800 |
---|---|---|
committer | fengyuanxing <feng.yuanxing@zte.com.cn> | 2018-01-26 15:29:06 +0800 |
commit | 554ae571c0eef59503aa9a10a74380b8a7210ed2 (patch) | |
tree | fb61a30bc67ccf20ea85c62058e6f549ecd19752 | |
parent | 811c9bbe2f13ffbefa7bc59c58e7a8195042eaee (diff) |
Add swagger code for nf packages
Change-Id: I3af5b46d5541294054c46c182239c91fc0f30f46
Issue-ID: VFC-685
Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r-- | catalog/packages/views.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/catalog/packages/views.py b/catalog/packages/views.py index 84abdf42..a2861f06 100644 --- a/catalog/packages/views.py +++ b/catalog/packages/views.py @@ -26,6 +26,9 @@ from drf_yasg import openapi from drf_yasg.utils import no_body, swagger_auto_schema from catalog.serializers import NsPackagesSerializer +from catalog.serializers import NfPackageSerializer +from catalog.serializers import NfPackageDistributeRequestSerializer +from catalog.serializers import PostJobResponseResultSerializer logger = logging.getLogger(__name__) @@ -89,6 +92,27 @@ def nspackages_rc(request, *args, **kwargs): return Response(data=ret[1], status=normal_status) +@swagger_auto_schema( + method='POST', + operation_description="On distribute Nf package", + request_body=NfPackageDistributeRequestSerializer(), + responses={ + status.HTTP_202_ACCEPTED: PostJobResponseResultSerializer, + status.HTTP_500_INTERNAL_SERVER_ERROR: openapi.Response( + 'error message', + openapi.Schema( + type=openapi.TYPE_STRING))}) +@swagger_auto_schema( + method='GET', + operation_description="Query Nf packages", + request_body=no_body, + responses={ + status.HTTP_200_OK: NfPackageSerializer( + many=True), + status.HTTP_500_INTERNAL_SERVER_ERROR: openapi.Response( + 'error message', + openapi.Schema( + type=openapi.TYPE_STRING))}) @api_view(http_method_names=['POST', 'GET']) def nfpackages_rc(request, *args, **kwargs): logger.debug( |