aboutsummaryrefslogtreecommitdiffstats
path: root/moon_manager/moon_manager/api/json_export.py
diff options
context:
space:
mode:
Diffstat (limited to 'moon_manager/moon_manager/api/json_export.py')
-rw-r--r--moon_manager/moon_manager/api/json_export.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/moon_manager/moon_manager/api/json_export.py b/moon_manager/moon_manager/api/json_export.py
new file mode 100644
index 00000000..06a7ba71
--- /dev/null
+++ b/moon_manager/moon_manager/api/json_export.py
@@ -0,0 +1,37 @@
+# Software Name: MOON
+
+# Version: 5.4
+
+# SPDX-FileCopyrightText: Copyright (c) 2018-2020 Orange and its contributors
+# SPDX-License-Identifier: Apache-2.0
+
+# This software is distributed under the 'Apache License 2.0',
+# the text of which is available at 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+# or see the "LICENSE" file for more details.
+
+
+import hug
+import logging
+from moon_manager import db_driver as driver
+from moon_utilities.auth_functions import api_key_authentication
+from moon_utilities.json_utils import JsonExport
+
+logger = logging.getLogger("moon.manager.api." + __name__)
+
+
+class Export(object):
+
+ @staticmethod
+ @hug.get("/export", requires=api_key_authentication)
+ def get(authed_user: hug.directives.user = None):
+ """Import file.
+
+ :param authed_user: user ID who do the request
+ :return: {
+
+ }
+ :internal_api:
+ """
+ json_file = JsonExport(driver_name="db", driver=driver).export_json(
+ moon_user_id=authed_user)
+ return {"content": json_file}