API proposal for functest
[functest.git] / functest / api / resources / v1 / creds.py
1 #!/usr/bin/env python
2
3 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9
10 """
11 Resources to handle openstack related requests
12 """
13
14 from flask import jsonify
15
16 from functest.api.base import ApiResource
17 from functest.cli.commands.cli_os import OpenStack
18 from functest.utils import openstack_utils as os_utils
19 from functest.utils.constants import CONST
20
21
22 class V1Creds(ApiResource):
23     """ V1Creds Resource class"""
24
25     def get(self):  # pylint: disable=no-self-use
26         """ Get credentials """
27         os_utils.source_credentials(CONST.__getattribute__('openstack_creds'))
28         credentials_show = OpenStack.show_credentials()
29         return jsonify(credentials_show)