add escalator frame
[escalator.git] / api / escalator / opts.py
1 # Copyright (c) 2014 OpenStack Foundation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14
15 import copy
16 import itertools
17
18 import escalator.api.middleware.context
19 import escalator.api.versions
20 import escalator.common.config
21 import escalator.common.rpc
22 import escalator.common.wsgi
23 import escalator.notifier
24
25 __all__ = [
26     'list_api_opts',
27 ]
28
29
30 _api_opts = [
31     (None, list(itertools.chain(
32         escalator.api.middleware.context.context_opts,
33         escalator.api.versions.versions_opts,
34         escalator.common.config.common_opts,
35         escalator.common.rpc.rpc_opts,
36         escalator.common.wsgi.bind_opts,
37         escalator.common.wsgi.eventlet_opts,
38         escalator.common.wsgi.socket_opts,
39         escalator.notifier.notifier_opts))),
40     ('task', escalator.common.config.task_opts),
41     ('paste_deploy', escalator.common.config.paste_deploy_opts)
42 ]
43
44
45 def list_api_opts():
46     """Return a list of oslo_config options available in Escalator API service.
47
48     Each element of the list is a tuple. The first element is the name of the
49     group under which the list of elements in the second element will be
50     registered. A group name of None corresponds to the [DEFAULT] group in
51     config files.
52
53     This function is also discoverable via the 'escalator.api' entry point
54     under the 'oslo_config.opts' namespace.
55
56     The purpose of this is to allow tools like the Oslo sample config file
57     generator to discover the options exposed to users by escalator.
58
59     :returns: a list of (group_name, opts) tuples
60     """
61
62     return [(g, copy.deepcopy(o)) for g, o in _api_opts]