-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
268e9d7
commit a45daae
Showing
2 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
libs/cti/src/breaches/application/create_one/create_breach_command.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
use cqrs::domain::command::Command; | ||
|
||
pub struct CreateBreachCommand { | ||
pub id: Option<String>, | ||
|
||
pub vendor: Option<String>, | ||
pub product: Option<String>, | ||
pub product_version: Option<String>, | ||
pub product_type: Option<String>, | ||
|
||
pub cve_id: Option<String>, | ||
pub cve_state: Option<String>, | ||
pub cve_description: Option<String>, | ||
pub cve_assigner_id: Option<String>, | ||
pub cve_assigner_name: Option<String>, | ||
pub cve_date_published: Option<String>, | ||
pub cve_date_updated: Option<String>, | ||
} | ||
|
||
impl CreateBreachCommand { | ||
pub const COMMAND_TYPE: &'static str = "[email protected]"; | ||
|
||
pub fn new( | ||
id: Option<String>, | ||
vendor: Option<String>, | ||
product: Option<String>, | ||
product_version: Option<String>, | ||
product_type: Option<String>, | ||
cve_id: Option<String>, | ||
cve_state: Option<String>, | ||
cve_description: Option<String>, | ||
cve_assigner_id: Option<String>, | ||
cve_assigner_name: Option<String>, | ||
cve_date_published: Option<String>, | ||
cve_date_updated: Option<String>, | ||
) -> CreateBreachCommand { | ||
CreateBreachCommand { | ||
id, | ||
vendor, | ||
product, | ||
product_version, | ||
product_type, | ||
cve_id, | ||
cve_state, | ||
cve_description, | ||
cve_assigner_id, | ||
cve_assigner_name, | ||
cve_date_published, | ||
cve_date_updated, | ||
} | ||
} | ||
|
||
pub fn new_boxed( | ||
id: Option<String>, | ||
vendor: Option<String>, | ||
product: Option<String>, | ||
product_version: Option<String>, | ||
product_type: Option<String>, | ||
cve_id: Option<String>, | ||
cve_state: Option<String>, | ||
cve_description: Option<String>, | ||
cve_assigner_id: Option<String>, | ||
cve_assigner_name: Option<String>, | ||
cve_date_published: Option<String>, | ||
cve_date_updated: Option<String>, | ||
) -> Box<dyn Command> { | ||
Box::new(CreateBreachCommand::new( | ||
id, | ||
vendor, | ||
product, | ||
product_version, | ||
product_type, | ||
cve_id, | ||
cve_state, | ||
cve_description, | ||
cve_assigner_id, | ||
cve_assigner_name, | ||
cve_date_published, | ||
cve_date_updated, | ||
)) | ||
} | ||
} | ||
|
||
impl Command for CreateBreachCommand { | ||
fn command_type(&self) -> String { | ||
CreateBreachCommand::COMMAND_TYPE.to_string() | ||
} | ||
|
||
fn as_any(&self) -> &dyn std::any::Any { | ||
self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod create_breach_command; |