예제 #1
0
    def post(self, request, *args, **kwargs):
        try:
            log.info("POST Datacenter")

            if not request.DATA.get('dc'):
                raise exceptions.InvalidInputException()

            dc = facade.save_dc(request.DATA.get('dc'))
            dc_serializer = DCSerializer(dc)

            data = dict()
            data['dc'] = dc_serializer.data

            return Response(data, status=status.HTTP_201_CREATED)

        except Exception, e:
            raise api_exceptions.NetworkAPIException(e)
예제 #2
0
    def post(self, request, *args, **kwargs):
        try:
            log.info("POST Datacenter")

            if not request.DATA.get('dc'):
                raise exceptions.InvalidInputException()

            dc = facade.save_dc(request.DATA.get('dc'))
            dc_serializer = DCSerializer(dc)

            data = dict()
            data['dc'] = dc_serializer.data

            return Response(data, status=status.HTTP_201_CREATED)

        except Exception, e:
            raise api_exceptions.NetworkAPIException(e)