Coverage for watcher/conf/api.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2025-06-17 12:22 +0000

1# -*- encoding: utf-8 -*- 

2# Copyright (c) 2016 Intel Corp 

3# 

4# Authors: Prudhvi Rao Shedimbi <prudhvi.rao.shedimbi@intel.com> 

5# 

6# Licensed under the Apache License, Version 2.0 (the "License"); 

7# you may not use this file except in compliance with the License. 

8# You may obtain a copy of the License at 

9# 

10# http://www.apache.org/licenses/LICENSE-2.0 

11# 

12# Unless required by applicable law or agreed to in writing, software 

13# distributed under the License is distributed on an "AS IS" BASIS, 

14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 

15# implied. 

16# See the License for the specific language governing permissions and 

17# limitations under the License. 

18 

19from oslo_config import cfg 

20 

21api = cfg.OptGroup(name='api', 

22 title='Options for the Watcher API service') 

23 

24AUTH_OPTS = [ 

25 cfg.BoolOpt('enable_authentication', 

26 default=True, 

27 help='This option enables or disables user authentication ' 

28 'via keystone. Default value is True.'), 

29] 

30 

31API_SERVICE_OPTS = [ 

32 cfg.PortOpt('port', 

33 default=9322, 

34 help='The port for the watcher API server'), 

35 cfg.HostAddressOpt('host', 

36 default='127.0.0.1', 

37 help='The listen IP address for the watcher API server' 

38 ), 

39 cfg.IntOpt('max_limit', 

40 default=1000, 

41 help='The maximum number of items returned in a single ' 

42 'response from a collection resource'), 

43 cfg.IntOpt('workers', 

44 min=1, 

45 help='Number of workers for Watcher API service. ' 

46 'The default is equal to the number of CPUs available ' 

47 'if that can be determined, else a default worker ' 

48 'count of 1 is returned.'), 

49 

50 cfg.BoolOpt('enable_ssl_api', 

51 default=False, 

52 help="Enable the integrated stand-alone API to service " 

53 "requests via HTTPS instead of HTTP. If there is a " 

54 "front-end service performing HTTPS offloading from " 

55 "the service, this option should be False; note, you " 

56 "will want to change public API endpoint to represent " 

57 "SSL termination URL with 'public_endpoint' option."), 

58 

59 cfg.BoolOpt('enable_webhooks_auth', 

60 default=True, 

61 help='This option enables or disables webhook request ' 

62 'authentication via keystone. Default value is True.'), 

63] 

64 

65 

66def register_opts(conf): 

67 conf.register_group(api) 

68 conf.register_opts(API_SERVICE_OPTS, group=api) 

69 conf.register_opts(AUTH_OPTS) 

70 

71 

72def list_opts(): 

73 return [(api, API_SERVICE_OPTS), ('DEFAULT', AUTH_OPTS)]