from catalog.pub.utils.syscomm import fun_name
from catalog.pub.utils.values import ignore_case_get
from .common import view_safe_call_with_log
+from catalog.swagger.views import EtsiCatalogFileAutoSchema
logger = logging.getLogger(__name__)
}
)
@swagger_auto_schema(
+ auto_schema=EtsiCatalogFileAutoSchema,
method='GET',
operation_description="Fetch PNFD content",
tags=[TAG_PNFD_API],
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'])
from catalog.packages.biz.vnf_pkg_artifacts import FetchVnfPkgArtifact
from catalog.packages.const import TAG_VNF_PACKAGE_API
from .common import view_safe_call_with_log
+from catalog.swagger.views import EtsiCatalogFileAutoSchema
logger = logging.getLogger(__name__)
class FetchVnfPkgmArtifactsView(APIView):
@swagger_auto_schema(
+ auto_schema=EtsiCatalogFileAutoSchema,
tags=[TAG_VNF_PACKAGE_API],
responses={
status.HTTP_200_OK: openapi.Response("Return the artifact file",
from catalog.packages.serializers.vnf_pkg_subscription import PkgmSubscriptionRequestSerializer
from catalog.packages.serializers.vnf_pkg_subscription import PkgmSubscriptionSerializer
from catalog.packages.serializers.vnf_pkg_subscription import PkgmSubscriptionsSerializer
-from catalog.packages.views.common import validate_data
+from catalog.packages.views.common import validate_data, validate_req_data
from catalog.pub.exceptions import BadRequestException
from catalog.pub.exceptions import VnfPkgSubscriptionException
from .common import view_safe_call_with_log
request_body=PkgmSubscriptionRequestSerializer,
responses={
status.HTTP_201_CREATED: PkgmSubscriptionSerializer(),
- status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
+ status.HTTP_400_BAD_REQUEST: ProblemDetailsSerializer(),
+ status.HTTP_500_INTERNAL_SERVER_ERROR: ProblemDetailsSerializer()
}
)
@view_safe_call_with_log(logger=logger)
def post(self, request):
logger.debug("Create VNF package Subscription> %s" % request.data)
- vnf_pkg_subscription_request = validate_data(request.data, PkgmSubscriptionRequestSerializer)
+ vnf_pkg_subscription_request = validate_req_data(request.data, PkgmSubscriptionRequestSerializer)
data = CreateSubscription(vnf_pkg_subscription_request.data).do_biz()
subscription_info = validate_data(data, PkgmSubscriptionSerializer)
return Response(data=subscription_info.data, status=status.HTTP_201_CREATED)
from catalog.packages.serializers.vnf_pkg_infos import VnfPkgInfosSerializer
from .common import validate_data, validate_req_data
from .common import view_safe_call_with_log
+from catalog.swagger.views import EtsiCatalogFileAutoSchema
logger = logging.getLogger(__name__)
@swagger_auto_schema(
+ auto_schema=EtsiCatalogFileAutoSchema,
method="GET",
operation_description="Read VNFD of an on-boarded VNF package",
tags=[TAG_VNF_PACKAGE_API],
status.HTTP_500_INTERNAL_SERVER_ERROR: openapi.Response("Internal error",
schema=openapi.Schema(type=openapi.TYPE_STRING))
},
- produces='application/octet-stream',
operation_id='VNFD of an on-boarded VNF package'
)
@api_view(http_method_names=["GET"])
}
)
@swagger_auto_schema(
+ auto_schema=EtsiCatalogFileAutoSchema,
method="GET",
operation_description="Fetch VNF package content",
tags=[TAG_VNF_PACKAGE_API],
from rest_framework.response import Response
from rest_framework.views import APIView
+from drf_yasg.inspectors import SwaggerAutoSchema
class SwaggerJsonView(APIView):
json_data = json.JSONDecoder().decode(f.read())
f.close()
return Response(json_data)
+
+
+class EtsiCatalogFileAutoSchema(SwaggerAutoSchema):
+ def get_produces(self):
+ super(EtsiCatalogFileAutoSchema, self).get_produces()
+ return ["application/octet-stream", "application/json"]