@@ -55,9 +55,31 @@ def __init__(
55
55
self .jmespath_options = jmespath_options
56
56
self ._conf_store = AppConfigProvider (environment = environment , application = application , config = sdk_config )
57
57
58
+ @property
59
+ def get_raw_configuration (self ) -> Dict [str , Any ]:
60
+ """Fetch feature schema configuration from AWS AppConfig"""
61
+ try :
62
+ # parse result conf as JSON, keep in cache for self.max_age seconds
63
+ return cast (
64
+ dict ,
65
+ self ._conf_store .get (
66
+ name = self .name ,
67
+ transform = TRANSFORM_TYPE ,
68
+ max_age = self .cache_seconds ,
69
+ ),
70
+ )
71
+ except (GetParameterError , TransformParameterError ) as exc :
72
+ err_msg = traceback .format_exc ()
73
+ if "AccessDenied" in err_msg :
74
+ raise StoreClientError (err_msg ) from exc
75
+ raise ConfigurationStoreError ("Unable to get AWS AppConfig configuration file" ) from exc
76
+
58
77
def get_configuration (self ) -> Dict [str , Any ]:
59
78
"""Fetch feature schema configuration from AWS AppConfig
60
79
80
+ If envelope is set, it'll extract and return feature flags from configuration,
81
+ otherwise it'll return the entire configuration fetched from AWS AppConfig.
82
+
61
83
Raises
62
84
------
63
85
ConfigurationStoreError
@@ -68,25 +90,11 @@ def get_configuration(self) -> Dict[str, Any]:
68
90
Dict[str, Any]
69
91
parsed JSON dictionary
70
92
"""
71
- try :
72
- # parse result conf as JSON, keep in cache for self.max_age seconds
73
- config = cast (
74
- dict ,
75
- self ._conf_store .get (
76
- name = self .name ,
77
- transform = TRANSFORM_TYPE ,
78
- max_age = self .cache_seconds ,
79
- ),
80
- )
93
+ config = self .get_raw_configuration
81
94
82
- if self .envelope :
83
- config = jmespath_utils .extract_data_from_envelope (
84
- data = config , envelope = self .envelope , jmespath_options = self .jmespath_options
85
- )
95
+ if self .envelope :
96
+ config = jmespath_utils .extract_data_from_envelope (
97
+ data = config , envelope = self .envelope , jmespath_options = self .jmespath_options
98
+ )
86
99
87
- return config
88
- except (GetParameterError , TransformParameterError ) as exc :
89
- err_msg = traceback .format_exc ()
90
- if "AccessDenied" in err_msg :
91
- raise StoreClientError (err_msg ) from exc
92
- raise ConfigurationStoreError ("Unable to get AWS AppConfig configuration file" ) from exc
100
+ return config
0 commit comments