1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use serde::Deserialize;
use stix::{CommonProperties, Object};
use crate::get_mitre_id;
#[stix::custom_properties(namespace = "mitre")]
#[derive(Deserialize)]
pub struct MitreCourseOfAction {
#[serde(default)]
pub deprecated: bool,
}
#[derive(Deserialize, stix::TypedObject)]
pub struct CourseOfAction {
#[serde(flatten)]
pub base: stix::CourseOfAction,
#[serde(flatten)]
pub mitre: MitreCourseOfAction,
}
impl CourseOfAction {
pub fn mitre_id(&self) -> Option<&str> {
self.external_references().iter().find_map(get_mitre_id)
}
}
impl AsRef<CommonProperties> for CourseOfAction {
fn as_ref(&self) -> &CommonProperties {
self.base.as_ref()
}
}