Skip to content

Commit 847ce3b

Browse files
author
Andrea Amorosi
committed
Added documentation for auto transform
1 parent 1135314 commit 847ce3b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

docs/utilities/parameters.md

+33
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,39 @@ For example, if you have three parameters, */param/a*, */param/b* and */param/c*
437437
values = ssm_provider.get_multiple("/param", transform="json", raise_on_transform_error=True)
438438
```
439439

440+
#### Infer transform from parameter suffix with `get_multiple()`
441+
442+
If you use `transform` with `get_multiple()`, you might want to retrieve and transform parameters encoded in different formats. You can do this with a single request by using `transform="auto"` and let the infer the transform type to use based on the parameter suffix.
443+
444+
!!! info "The `transform="auto"` feature is available across all providers, including the high level functions"
445+
446+
=== "partial_failures.py"
447+
448+
````python hl_lines="6"
449+
from aws_lambda_powertools.utilities import parameters
450+
451+
ssm_provider = parameters.SSMProvider()
452+
453+
def handler(event, context):
454+
values = ssm_provider.get_multiple("/param", transform="auto")
455+
456+
For example, if you have two parameters with the following suffixes `.json` and `.binary`:
457+
458+
| Parameter name | Parameter value |
459+
| --------------- | ----------------------- |
460+
| /param/a.json | [some encoded value] |
461+
| /param/a.binary | [some encoded value] |
462+
463+
The return of `ssm_provider.get_multiple("/param", transform="auto")` call will be a dictionary like:
464+
465+
```json
466+
{
467+
"a.json": [some value],
468+
"b.binary": [some value]
469+
}
470+
```
471+
````
472+
440473
### Passing additional SDK arguments
441474

442475
You can use arbitrary keyword arguments to pass it directly to the underlying SDK method.

0 commit comments

Comments
 (0)