Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/c7n/config.py: 61%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

23 statements  

1# Copyright The Cloud Custodian Authors. 

2# SPDX-License-Identifier: Apache-2.0 

3import os 

4import logging 

5 

6log = logging.getLogger('custodian.config') 

7 

8 

9class Bag(dict): 

10 def __getattr__(self, k): 

11 try: 

12 return self[k] 

13 except KeyError: 

14 raise AttributeError(k) 

15 

16 def __setattr__(self, k, v): 

17 self[k] = v 

18 

19 

20class Config(Bag): 

21 

22 def copy(self, **kw): 

23 d = {} 

24 d.update(self) 

25 d.update(**kw) 

26 return Config(d) 

27 

28 @classmethod 

29 def empty(cls, **kw): 

30 d = {} 

31 d.update({ 

32 'region': os.environ.get('AWS_DEFAULT_REGION', 'us-east-1'), 

33 'regions': (), 

34 'cache': '', 

35 'profile': None, 

36 'account_id': None, 

37 'assume_role': None, 

38 'session_policy': None, 

39 'external_id': None, 

40 'log_group': None, 

41 'tracer': 'default', 

42 'metrics_enabled': False, 

43 'metrics': None, 

44 'output_dir': '', 

45 'cache_period': 0, 

46 'dryrun': False, 

47 'authorization_file': None}) 

48 d.update(kw) 

49 return cls(d)