aboutsummaryrefslogtreecommitdiffstats
path: root/moon_manager/moon_manager/api/json_export.py
blob: 06a7ba713dcf0ccce0d7b6e5a700cc2ddaa6466b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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}