cyberstorm/src/domains/react.rs

72 lines
1.5 KiB
Rust

use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use crate::domains::common::*;
#[derive(Debug, Serialize, Deserialize)]
pub struct Stage {
pub name: String,
pub description: String,
#[serde(default)]
pub additional: Vec<(String, Value)>,
}
impl DomainModel for Stage {
fn kind() -> DomainModelKind {
DomainModelKind::ReactStage
}
fn name(&self) -> &str {
self.name.as_str()
}
}
///////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Serialize, Deserialize)]
pub struct Action {
pub name: String,
pub description: String,
pub stage: DomainId,
#[serde(default)]
pub tags: Vec<String>,
#[serde(default)]
pub references: References,
#[serde(default)]
pub additional: Vec<(String, Value)>,
}
impl DomainModel for Action {
fn kind() -> DomainModelKind {
DomainModelKind::ReactAction
}
fn name(&self) -> &str {
self.name.as_str()
}
}
///////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Serialize, Deserialize)]
pub struct Playbook {
pub name: String,
pub tags: Vec<String>,
pub description: String,
pub references: References,
pub stages: HashMap<DomainId, Vec<DomainId>>,
#[serde(default)]
pub additional: Vec<(String, Value)>,
}
impl DomainModel for Playbook {
fn kind() -> DomainModelKind {
DomainModelKind::ReactPlaybook
}
fn name(&self) -> &str {
self.name.as_str()
}
}