from rest_framework import serializers
-class LinkSerializer(serializers.Serializer):
+class UriLinkSerializer(serializers.Serializer):
href = serializers.CharField(
help_text='URI of the referenced resource',
required=True,
from rest_framework import serializers
from .problem_details import ProblemDetailsSerializer
-from .link import LinkSerializer
+from .link import UriLinkSerializer
class _LinkSerializer(serializers.Serializer):
- self = LinkSerializer(
+ self = UriLinkSerializer(
help_text="URI of this resource.",
required=True,
allow_null=False
)
- nsd_content = LinkSerializer(
+ nsd_content = UriLinkSerializer(
help_text="Link to the NSD content resource.",
required=True,
allow_null=False
from rest_framework import serializers
-from .link import LinkSerializer
+from .link import UriLinkSerializer
from .subscription_auth_data import SubscriptionAuthenticationSerializer
from .nsdm_filter_data import NsdmNotificationsFilter
class NsdmSubscriptionLinkSerializer(serializers.Serializer):
- self = LinkSerializer(
+ self = UriLinkSerializer(
help_text="Links to resources related to this resource.",
required=True
)
+ class Meta:
+ ref_name = "NSDM_SUB_LinkSerializer"
+
class NsdmSubscriptionSerializer(serializers.Serializer):
id = serializers.CharField(
from rest_framework import serializers
from .problem_details import ProblemDetailsSerializer
-from .link import LinkSerializer
+from .link import UriLinkSerializer
-class _LinkSerializer(serializers.Serializer):
- self = LinkSerializer(
+class PnfdInfoLinksSerializer(serializers.Serializer):
+ self = UriLinkSerializer(
help_text='URI of this resource.',
required=True,
allow_null=False
)
- pnfd_content = LinkSerializer(
+ pnfd_content = UriLinkSerializer(
help_text='Link to the PNFD content resource.',
required=True,
allow_null=False
)
+ class Meta:
+ ref_name = "PNFD_LinkSerializer"
+
class PnfdInfoSerializer(serializers.Serializer):
id = serializers.CharField(
required=False,
allow_null=True
)
- _links = _LinkSerializer(
+ _links = PnfdInfoLinksSerializer(
help_text='Links to resources related to this resource.',
required=True,
allow_null=True # TODO: supposed to be False
from .checksum import ChecksumSerializer
from .vnf_pkg_software_image_info import VnfPackageSoftwareImageInfoSerializer
from .vnf_pkg_artifact_info import VnfPackageArtifactInfoSerializer
-from .link import LinkSerializer
+from .link import UriLinkSerializer
-class _LinkSerializer(serializers.Serializer):
- self = LinkSerializer(
+class VnfPkgInfoLinkSerializer(serializers.Serializer):
+ self = UriLinkSerializer(
help_text='URI of this resource.',
required=True,
allow_null=False
)
- vnfd = LinkSerializer(
+ vnfd = UriLinkSerializer(
help_text='Link to the VNFD resource.',
required=False,
allow_null=False
)
- packageContent = LinkSerializer(
+ packageContent = UriLinkSerializer(
help_text='Link to the "VNF package content resource.',
required=True,
allow_null=False
required=False,
allow_null=True
)
- _links = _LinkSerializer(
+ _links = VnfPkgInfoLinkSerializer(
help_text='Links to resources related to this resource.',
required=True,
allow_null=True # TODO supposed to be False
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
+from drf_yasg import openapi
from catalog.packages.biz.pnf_descriptor import PnfDescriptor
from catalog.packages.const import TAG_PNFD_API, TAG_PARSER_API
tags=[TAG_PNFD_API],
request_body=no_body,
responses={
- status.HTTP_204_NO_CONTENT: 'PNFD file',
+ status.HTTP_200_OK: openapi.Response('PNFD file', schema=openapi.Schema(format=openapi.FORMAT_BINARY,
+ type=openapi.TYPE_STRING)),
status.HTTP_404_NOT_FOUND: ProblemDetailsSerializer(),
status.HTTP_500_INTERNAL_SERVER_ERROR: ProblemDetailsSerializer()
- }
+ },
+ produces='application/octet-stream',
+ operation_id='Fetch PNFD content'
)
@api_view(http_method_names=['PUT', 'GET'])
@view_safe_call_with_log(logger=logger)
from django.http import StreamingHttpResponse
from drf_yasg.utils import swagger_auto_schema, no_body
+from drf_yasg import openapi
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
tags=[TAG_VNF_PACKAGE_API],
request_body=no_body,
responses={
- status.HTTP_200_OK: VnfPkgInfosSerializer(),
+ status.HTTP_200_OK: openapi.Response('VNFD of an on-boarded VNF package',
+ schema=openapi.Schema(format=openapi.FORMAT_BINARY,
+ type=openapi.TYPE_STRING)),
status.HTTP_404_NOT_FOUND: "VNF package does not exist",
status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
- }
+ },
+ produces='application/octet-stream',
+ operation_id='VNFD of an on-boarded VNF package'
)
@api_view(http_method_names=["GET"])
@view_safe_call_with_log(logger=logger)
tags=[TAG_VNF_PACKAGE_API],
request_body=no_body,
responses={
- status.HTTP_200_OK: "Return csar file of VNF package",
+ status.HTTP_200_OK: openapi.Response('VNF package file',
+ schema=openapi.Schema(format=openapi.FORMAT_BINARY,
+ type=openapi.TYPE_STRING)),
status.HTTP_404_NOT_FOUND: "VNF package does not exist",
status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
}