Debian Codegraph @

masakarimonitors/conf/api.py

raw
1 # Copyright(c) 2016 Nippon Telegraph and Telephone Corporation
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain 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,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 from keystoneauth1 import loading as ks_loading
15 from oslo_config import cfg
16
17 API_GROUP = 'api'
18
19 api_group = cfg.OptGroup(
20 API_GROUP,
21 title='Api Options',
22 help="""
23 Configuration options for sending notifications.
24 """)
25
26 monitor_api_opts = [
27 cfg.StrOpt('region',
28 default='RegionOne',
29 help='Region name.'),
30 cfg.StrOpt('api_version',
31 default='v1',
32 help='Masakari API Version.'),
33 cfg.StrOpt('api_interface',
34 default='public',
35 help='Interface of endpoint.'),
36 ]
37
38
39 def register_opts(conf):
40 conf.register_group(api_group)
41 conf.register_opts(monitor_api_opts, group=api_group)
42 ks_loading.register_session_conf_options(conf, api_group)
43 ks_loading.register_auth_conf_options(conf, api_group)
44 conf.set_default('auth_type', 'password', group=api_group)
45
46
47 def list_opts():
48 return {
49 api_group: (
50 monitor_api_opts +
51 ks_loading.get_auth_plugin_conf_options('password'))
52 }