@@ -186,7 +186,12 @@ def _get_multiple(self, path: str, decrypt: bool = False, recursive: bool = Fals
186186
187187
188188def get_parameter (
189- name : str , transform : Optional [str ] = None , decrypt : bool = False , force_fetch : bool = False , ** sdk_options
189+ name : str ,
190+ transform : Optional [str ] = None ,
191+ decrypt : bool = False ,
192+ force_fetch : bool = False ,
193+ max_age : int = DEFAULT_MAX_AGE_SECS ,
194+ ** sdk_options
190195) -> Union [str , list , dict , bytes ]:
191196 """
192197 Retrieve a parameter value from AWS Systems Manager (SSM) Parameter Store
@@ -201,6 +206,8 @@ def get_parameter(
201206 If the parameter values should be decrypted
202207 force_fetch: bool, optional
203208 Force update even before a cached item has expired, defaults to False
209+ max_age: int
210+ Maximum age of the cached value
204211 sdk_options: dict, optional
205212 Dictionary of options that will be passed to the Parameter Store get_parameter API call
206213
@@ -240,7 +247,9 @@ def get_parameter(
240247 # Add to `decrypt` sdk_options to we can have an explicit option for this
241248 sdk_options ["decrypt" ] = decrypt
242249
243- return DEFAULT_PROVIDERS ["ssm" ].get (name , transform = transform , force_fetch = force_fetch , ** sdk_options )
250+ return DEFAULT_PROVIDERS ["ssm" ].get (
251+ name , max_age = max_age , transform = transform , force_fetch = force_fetch , ** sdk_options
252+ )
244253
245254
246255def get_parameters (
@@ -249,6 +258,8 @@ def get_parameters(
249258 recursive : bool = True ,
250259 decrypt : bool = False ,
251260 force_fetch : bool = False ,
261+ max_age : int = DEFAULT_MAX_AGE_SECS ,
262+ raise_on_transform_error : bool = False ,
252263 ** sdk_options
253264) -> Union [Dict [str , str ], Dict [str , dict ], Dict [str , bytes ]]:
254265 """
@@ -266,6 +277,11 @@ def get_parameters(
266277 If the parameter values should be decrypted
267278 force_fetch: bool, optional
268279 Force update even before a cached item has expired, defaults to False
280+ max_age: int
281+ Maximum age of the cached value
282+ raise_on_transform_error: bool, optional
283+ Raises an exception if any transform fails, otherwise this will
284+ return a None value for each transform that failed
269285 sdk_options: dict, optional
270286 Dictionary of options that will be passed to the Parameter Store get_parameters_by_path API call
271287
@@ -305,4 +321,11 @@ def get_parameters(
305321 sdk_options ["recursive" ] = recursive
306322 sdk_options ["decrypt" ] = decrypt
307323
308- return DEFAULT_PROVIDERS ["ssm" ].get_multiple (path , transform = transform , force_fetch = force_fetch , ** sdk_options )
324+ return DEFAULT_PROVIDERS ["ssm" ].get_multiple (
325+ path ,
326+ max_age = max_age ,
327+ transform = transform ,
328+ raise_on_transform_error = raise_on_transform_error ,
329+ force_fetch = force_fetch ,
330+ ** sdk_options
331+ )
0 commit comments