@@ -186,7 +186,12 @@ def _get_multiple(self, path: str, decrypt: bool = False, recursive: bool = Fals
186
186
187
187
188
188
def 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
190
195
) -> Union [str , list , dict , bytes ]:
191
196
"""
192
197
Retrieve a parameter value from AWS Systems Manager (SSM) Parameter Store
@@ -201,6 +206,8 @@ def get_parameter(
201
206
If the parameter values should be decrypted
202
207
force_fetch: bool, optional
203
208
Force update even before a cached item has expired, defaults to False
209
+ max_age: int
210
+ Maximum age of the cached value
204
211
sdk_options: dict, optional
205
212
Dictionary of options that will be passed to the Parameter Store get_parameter API call
206
213
@@ -240,7 +247,9 @@ def get_parameter(
240
247
# Add to `decrypt` sdk_options to we can have an explicit option for this
241
248
sdk_options ["decrypt" ] = decrypt
242
249
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
+ )
244
253
245
254
246
255
def get_parameters (
@@ -249,6 +258,8 @@ def get_parameters(
249
258
recursive : bool = True ,
250
259
decrypt : bool = False ,
251
260
force_fetch : bool = False ,
261
+ max_age : int = DEFAULT_MAX_AGE_SECS ,
262
+ raise_on_transform_error : bool = False ,
252
263
** sdk_options
253
264
) -> Union [Dict [str , str ], Dict [str , dict ], Dict [str , bytes ]]:
254
265
"""
@@ -266,6 +277,11 @@ def get_parameters(
266
277
If the parameter values should be decrypted
267
278
force_fetch: bool, optional
268
279
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
269
285
sdk_options: dict, optional
270
286
Dictionary of options that will be passed to the Parameter Store get_parameters_by_path API call
271
287
@@ -305,4 +321,11 @@ def get_parameters(
305
321
sdk_options ["recursive" ] = recursive
306
322
sdk_options ["decrypt" ] = decrypt
307
323
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