Skip to main content

swf_builders/services/task/
emit.rs

1use super::*;
2
3// ============== EmitTaskDefinitionBuilder ==============
4/// Builder for constructing an emit task that produces a workflow event.
5pub struct EmitTaskDefinitionBuilder {
6    task: EmitTaskDefinition,
7}
8
9impl EmitTaskDefinitionBuilder {
10    pub fn new(event: EventDefinition) -> Self {
11        let mut task = EmitTaskDefinition::default();
12        task.emit.event = event;
13        Self { task }
14    }
15
16    /// Replaces all event attributes with the provided map.
17    pub fn with_attributes(&mut self, attrs: HashMap<String, Value>) -> &mut Self {
18        self.task.emit.event.with = attrs;
19        self
20    }
21}
22
23impl_task_definition_builder_base!(EmitTaskDefinitionBuilder, task, TaskDefinition::Emit);