diff options
-rw-r--r-- | zte/vmanager/driver/interfaces/serializers.py | 35 | ||||
-rw-r--r-- | zte/vmanager/driver/interfaces/views.py | 8 |
2 files changed, 42 insertions, 1 deletions
diff --git a/zte/vmanager/driver/interfaces/serializers.py b/zte/vmanager/driver/interfaces/serializers.py index eafe0939..2e7cbae7 100644 --- a/zte/vmanager/driver/interfaces/serializers.py +++ b/zte/vmanager/driver/interfaces/serializers.py @@ -433,3 +433,38 @@ class InstScaleHealRespSerializer(serializers.Serializer): max_length=255, required=True, allow_null=True) + + +class SubscribeFilterSerializer(serializers.Serializer): + vendor = serializers.CharField( + help_text="vendor", + max_length=255, + required=True, + allow_null=True) + type = serializers.CharField( + help_text="type", + max_length=255, + required=True, + allow_null=True) + + +class SubscribeSerializer(serializers.Serializer): + subscribeid = serializers.CharField( + help_text="subscribeid", + max_length=255, + required=True, + allow_null=True) + notificationuri = serializers.CharField( + help_text="notificationuri", + max_length=255, + required=True, + allow_null=True) + filter = SubscribeFilterSerializer( + help_text="filter", + many=True, + required=False, + allow_null=True) + + +class SubscribesRespSerializer(serializers.Serializer): + child = SubscribeSerializer() diff --git a/zte/vmanager/driver/interfaces/views.py b/zte/vmanager/driver/interfaces/views.py index 54325b39..579da8d0 100644 --- a/zte/vmanager/driver/interfaces/views.py +++ b/zte/vmanager/driver/interfaces/views.py @@ -27,7 +27,7 @@ from django.http import StreamingHttpResponse from driver.interfaces.serializers import HealReqSerializer, InstScaleHealRespSerializer, ScaleReqSerializer, \ NotifyReqSerializer, GrantRespSerializer, GrantReqSerializer, JobQueryRespSerializer, TerminateVnfRequestSerializer, \ - InstantiateVnfRequestSerializer, QueryVnfResponseSerializer + InstantiateVnfRequestSerializer, QueryVnfResponseSerializer, SubscribesRespSerializer from driver.pub.config.config import VNF_FTP from driver.pub.utils import restcall from driver.pub.utils.restcall import req_by_msb @@ -628,6 +628,12 @@ class SampleList(APIView): class Subscribe(APIView): + @swagger_auto_schema( + responses={ + status.HTTP_200_OK: SubscribesRespSerializer(), + status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error" + } + ) def get(self, request): logger.debug("====Subscribe get====") resp_data = { |