Step-functions task that applies the substitution, then formats the results using a map of supplied arguments, and returns the results
function.handler
{ "Results": "my string {foobar} to format", "Arguments": { "foobar": 1, } "Pattern": "string", "Replacement": "gnirts", "SubstituteFirst": true } { "Results": [ "my string {foobar} to format" ], "Arguments":{ "foobar": 1, } "Pattern": "string", "Replacement": "gnirts", "SubstituteFirst": true } { "Results":{ "myname": "my string {foobar} to format", } "Arguments":{ "foobar": 1, } "Pattern": "string", "Replacement": "gnirts", "SubstituteFirst": true }
- Results: Required
- A
string
,map
ofstring
orlist
ofstring
to format using Arguments and substitute using Pattern and Replacement. The response type will mirror the type used here. Formatting will be using the PyFormat named placeholders. Substitution will be using the Python re.sub method. - Arguments: Optional
- A
map
of arguments to use to format the Results. Keys in thismap
should correspond to the format keys in Results. If absent an empty map will be used. - Pattern: Optional
- A regular expression used to identify replacements in
Results. if absent a default of
a^
will be used. - Replacement: Optional
- The replacement string to use. If absent, then empty string will be used.
- SubstituteFirst: Optional
true
if substitution should be applied before formatting,false
otherwise. If absent defaults totrue
.
"my gnirts 1 to format" { "myname": "my gnirts 1 to format", } [ "my gnirts 1 to format" ]
https://s3.amazonaws.com/lambdalambdalambda-repo/quinovas/format-task/format-task-0.0.1.zip
License: APL2