Payload Handling
Most AWS actions require data to be sent, whether it’s the JSON body for a Lambda function or the message body for an SQS queue. myna standardizes how you define this data using the [payload] block.
Configuration
Section titled “Configuration”The [payload] block supports two mutually exclusive fields: data and file.
| Field | Type | Description |
|---|---|---|
data | string | Inline content (string or JSON). Supports variable interpolation. |
file | string | Path to a file containing the payload. Relative to the action file. |
Precedence: If both are present,
filetakes precedence.
Inline Data
Section titled “Inline Data”Use the data field for simple, self-contained payloads. Multi-line strings in TOML (""") make this easy for JSON.
[payload]data = """{ "user_id": "{{USER_ID}}", "action": "create"}"""Variable Substitution
Section titled “Variable Substitution”Inline data automatically supports Handlebars-style variable substitution ({{VAR}}).
[pre]ENV = "dev"
[payload]data = "Processing in environment: {{ENV}}"File-Based Payloads
Section titled “File-Based Payloads”For larger or binary payloads, use the file field.
[payload]file = "./payloads/large-event.json"Resolution Logic
Section titled “Resolution Logic”- Relative Path: If the path is relative (e.g.,
./data.json), it is resolved relative to the Action file’s directory. - Absolute Path: You can provide a full absolute path (not recommended for sharing code).
- Variable Substitution: Content loaded from files also supports variable substitution.
{ "complex_object": { "id": "{{ID_FROM_VARS}}" }}