Skip to main content

swf_core/models/task/
raise_task.rs

1use serde::{Deserialize, Serialize};
2
3use super::TaskDefinitionFields;
4use crate::models::error::OneOfErrorDefinitionOrReference;
5
6/// Represents the configuration of a task used to listen to specific events
7#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
8pub struct RaiseTaskDefinition {
9    /// Gets/sets the definition of the error to raise
10    #[serde(rename = "raise")]
11    pub raise: RaiseErrorDefinition,
12
13    /// Gets/sets the task's common fields
14    #[serde(flatten)]
15    pub common: TaskDefinitionFields,
16}
17impl RaiseTaskDefinition {
18    /// Initializes a new RaiseTaskDefinition
19    pub fn new(raise: RaiseErrorDefinition) -> Self {
20        Self {
21            raise,
22            common: TaskDefinitionFields::new(),
23        }
24    }
25}
26
27/// Represents the definition of the error to raise
28#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
29pub struct RaiseErrorDefinition {
30    /// Gets/sets the error to raise
31    #[serde(rename = "error")]
32    pub error: OneOfErrorDefinitionOrReference,
33}
34impl RaiseErrorDefinition {
35    /// Initializes a new RaiseErrorDefinition
36    pub fn new(error: OneOfErrorDefinitionOrReference) -> Self {
37        Self { error }
38    }
39}