#![allow(
clippy::all,
clippy::pedantic,
clippy::nursery,
unused_imports,
unused_mut,
unreachable_code,
dead_code
)]
use serde::{Deserialize, Serialize};
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
pub enum BuildError {
#[error("missing required field: {0}")]
MissingField(&'static str),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ImportSsp {
pub href: crate::primitives::UriReference,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ImportSspBuilder {
href: Option<crate::primitives::UriReference>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ImportSspBuilder {
pub fn new() -> Self {
Self {
href: None,
remarks: None,
}
}
}
impl Default for ImportSspBuilder {
fn default() -> Self {
Self::new()
}
}
impl ImportSspBuilder {
pub fn href(mut self, v: impl Into<crate::primitives::UriReference>) -> Self {
self.href = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ImportSsp, BuildError> {
let href = self
.href
.ok_or_else(|| BuildError::MissingField("required field `href` not set"))?;
Ok(ImportSsp {
href,
remarks: self.remarks,
})
}
}
impl ImportSsp {
pub fn builder() -> ImportSspBuilder {
ImportSspBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct LocalObjective {
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default)]
pub parts: Vec<Part>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct LocalObjectiveBuilder {
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
parts: Vec<Part>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl LocalObjectiveBuilder {
pub fn new() -> Self {
Self {
description: None,
props: Vec::new(),
links: Vec::new(),
parts: Vec::new(),
remarks: None,
}
}
}
impl Default for LocalObjectiveBuilder {
fn default() -> Self {
Self::new()
}
}
impl LocalObjectiveBuilder {
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn parts(mut self, v: impl Into<Part>) -> Self {
self.parts.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<LocalObjective, BuildError> {
Ok(LocalObjective {
description: self.description,
props: self.props,
links: self.links,
parts: self.parts,
remarks: self.remarks,
})
}
}
impl LocalObjective {
pub fn builder() -> LocalObjectiveBuilder {
LocalObjectiveBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AssessmentMethod {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
pub assessment_part: AssessmentPart,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct AssessmentMethodBuilder {
uuid: Option<uuid::Uuid>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
assessment_part: Option<AssessmentPart>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl AssessmentMethodBuilder {
pub fn new() -> Self {
Self {
uuid: None,
description: None,
props: Vec::new(),
links: Vec::new(),
assessment_part: None,
remarks: None,
}
}
}
impl Default for AssessmentMethodBuilder {
fn default() -> Self {
Self::new()
}
}
impl AssessmentMethodBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn assessment_part(mut self, v: impl Into<AssessmentPart>) -> Self {
self.assessment_part = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<AssessmentMethod, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let assessment_part = self
.assessment_part
.ok_or_else(|| BuildError::MissingField("required field `assessment-part` not set"))?;
Ok(AssessmentMethod {
uuid,
description: self.description,
props: self.props,
links: self.links,
assessment_part,
remarks: self.remarks,
})
}
}
impl AssessmentMethod {
pub fn builder() -> AssessmentMethodBuilder {
AssessmentMethodBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Step {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reviewed_controls: Option<ReviewedControls>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_roles: Vec<ResponsibleRole>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct StepBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
reviewed_controls: Option<ReviewedControls>,
responsible_roles: Vec<ResponsibleRole>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl StepBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
description: None,
props: Vec::new(),
links: Vec::new(),
reviewed_controls: None,
responsible_roles: Vec::new(),
remarks: None,
}
}
}
impl Default for StepBuilder {
fn default() -> Self {
Self::new()
}
}
impl StepBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn reviewed_controls(mut self, v: impl Into<ReviewedControls>) -> Self {
self.reviewed_controls = Some(v.into());
self
}
pub fn responsible_roles(mut self, v: impl Into<ResponsibleRole>) -> Self {
self.responsible_roles.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Step, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(Step {
uuid,
title: self.title,
description,
props: self.props,
links: self.links,
reviewed_controls: self.reviewed_controls,
responsible_roles: self.responsible_roles,
remarks: self.remarks,
})
}
}
impl Step {
pub fn builder() -> StepBuilder {
StepBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Activity {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub step: Vec<Step>,
#[serde(skip_serializing_if = "Option::is_none")]
pub related_controls: Option<ReviewedControls>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_roles: Vec<ResponsibleRole>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ActivityBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
step: Vec<Step>,
related_controls: Option<ReviewedControls>,
responsible_roles: Vec<ResponsibleRole>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ActivityBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
description: None,
props: Vec::new(),
links: Vec::new(),
step: Vec::new(),
related_controls: None,
responsible_roles: Vec::new(),
remarks: None,
}
}
}
impl Default for ActivityBuilder {
fn default() -> Self {
Self::new()
}
}
impl ActivityBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn step(mut self, v: impl Into<Step>) -> Self {
self.step.push(v.into());
self
}
pub fn related_controls(mut self, v: impl Into<ReviewedControls>) -> Self {
self.related_controls = Some(v.into());
self
}
pub fn responsible_roles(mut self, v: impl Into<ResponsibleRole>) -> Self {
self.responsible_roles.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Activity, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(Activity {
uuid,
title: self.title,
description,
props: self.props,
links: self.links,
step: self.step,
related_controls: self.related_controls,
responsible_roles: self.responsible_roles,
remarks: self.remarks,
})
}
}
impl Activity {
pub fn builder() -> ActivityBuilder {
ActivityBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TimingChoice1 {}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Timing {
#[serde(skip_serializing_if = "Option::is_none")]
pub timing_choice1: Option<TimingChoice1>,
}
#[must_use]
#[derive(Debug)]
pub struct TimingBuilder {
timing_choice1: Option<TimingChoice1>,
}
impl TimingBuilder {
pub fn new() -> Self {
Self {
timing_choice1: None,
}
}
}
impl Default for TimingBuilder {
fn default() -> Self {
Self::new()
}
}
impl TimingBuilder {
pub fn timing_choice1(mut self, v: impl Into<TimingChoice1>) -> Self {
self.timing_choice1 = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Timing, BuildError> {
Ok(Timing {
timing_choice1: self.timing_choice1,
})
}
}
impl Timing {
pub fn builder() -> TimingBuilder {
TimingBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Dependency {
pub task_uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct DependencyBuilder {
task_uuid: Option<uuid::Uuid>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl DependencyBuilder {
pub fn new() -> Self {
Self {
task_uuid: None,
remarks: None,
}
}
}
impl Default for DependencyBuilder {
fn default() -> Self {
Self::new()
}
}
impl DependencyBuilder {
pub fn task_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.task_uuid = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Dependency, BuildError> {
let task_uuid = self
.task_uuid
.ok_or_else(|| BuildError::MissingField("required field `task-uuid` not set"))?;
Ok(Dependency {
task_uuid,
remarks: self.remarks,
})
}
}
impl Dependency {
pub fn builder() -> DependencyBuilder {
DependencyBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AssociatedActivity {
pub activity_uuid: uuid::Uuid,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_roles: Vec<ResponsibleRole>,
#[serde(default)]
pub subjects: Vec<AssessmentSubject>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct AssociatedActivityBuilder {
activity_uuid: Option<uuid::Uuid>,
props: Vec<Property>,
links: Vec<Link>,
responsible_roles: Vec<ResponsibleRole>,
subjects: Vec<AssessmentSubject>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl AssociatedActivityBuilder {
pub fn new() -> Self {
Self {
activity_uuid: None,
props: Vec::new(),
links: Vec::new(),
responsible_roles: Vec::new(),
subjects: Vec::new(),
remarks: None,
}
}
}
impl Default for AssociatedActivityBuilder {
fn default() -> Self {
Self::new()
}
}
impl AssociatedActivityBuilder {
pub fn activity_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.activity_uuid = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn responsible_roles(mut self, v: impl Into<ResponsibleRole>) -> Self {
self.responsible_roles.push(v.into());
self
}
pub fn subjects(mut self, v: impl Into<AssessmentSubject>) -> Self {
self.subjects.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<AssociatedActivity, BuildError> {
let activity_uuid = self
.activity_uuid
.ok_or_else(|| BuildError::MissingField("required field `activity-uuid` not set"))?;
Ok(AssociatedActivity {
activity_uuid,
props: self.props,
links: self.links,
responsible_roles: self.responsible_roles,
subjects: self.subjects,
remarks: self.remarks,
})
}
}
impl AssociatedActivity {
pub fn builder() -> AssociatedActivityBuilder {
AssociatedActivityBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Task {
pub uuid: uuid::Uuid,
#[serde(rename = "type")]
pub type_: String,
pub title: crate::primitives::MarkupLine,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub timing: Option<Timing>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub dependency: Vec<Dependency>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub tasks: Vec<Task>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub associated_activity: Vec<AssociatedActivity>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub subjects: Vec<AssessmentSubject>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_roles: Vec<ResponsibleRole>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct TaskBuilder {
uuid: Option<uuid::Uuid>,
type_: Option<String>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
timing: Option<Timing>,
dependency: Vec<Dependency>,
tasks: Vec<Task>,
associated_activity: Vec<AssociatedActivity>,
subjects: Vec<AssessmentSubject>,
responsible_roles: Vec<ResponsibleRole>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl TaskBuilder {
pub fn new() -> Self {
Self {
uuid: None,
type_: None,
title: None,
description: None,
props: Vec::new(),
links: Vec::new(),
timing: None,
dependency: Vec::new(),
tasks: Vec::new(),
associated_activity: Vec::new(),
subjects: Vec::new(),
responsible_roles: Vec::new(),
remarks: None,
}
}
}
impl Default for TaskBuilder {
fn default() -> Self {
Self::new()
}
}
impl TaskBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn type_(mut self, v: impl Into<String>) -> Self {
self.type_ = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn timing(mut self, v: impl Into<Timing>) -> Self {
self.timing = Some(v.into());
self
}
pub fn dependency(mut self, v: impl Into<Dependency>) -> Self {
self.dependency.push(v.into());
self
}
pub fn tasks(mut self, v: impl Into<Task>) -> Self {
self.tasks.push(v.into());
self
}
pub fn associated_activity(mut self, v: impl Into<AssociatedActivity>) -> Self {
self.associated_activity.push(v.into());
self
}
pub fn subjects(mut self, v: impl Into<AssessmentSubject>) -> Self {
self.subjects.push(v.into());
self
}
pub fn responsible_roles(mut self, v: impl Into<ResponsibleRole>) -> Self {
self.responsible_roles.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Task, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let type_ = self
.type_
.ok_or_else(|| BuildError::MissingField("required field `type` not set"))?;
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
Ok(Task {
uuid,
type_,
title,
description: self.description,
props: self.props,
links: self.links,
timing: self.timing,
dependency: self.dependency,
tasks: self.tasks,
associated_activity: self.associated_activity,
subjects: self.subjects,
responsible_roles: self.responsible_roles,
remarks: self.remarks,
})
}
}
impl Task {
pub fn builder() -> TaskBuilder {
TaskBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ControlSelectionChoice1 {
IncludeAll(IncludeAll),
SelectControlById(Vec<SelectControlById>),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ControlSelection {
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub control_selection_choice1: Option<ControlSelectionChoice1>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub exclude_controls: Vec<SelectControlById>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ControlSelectionBuilder {
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
control_selection_choice1: Option<ControlSelectionChoice1>,
exclude_controls: Vec<SelectControlById>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ControlSelectionBuilder {
pub fn new() -> Self {
Self {
description: None,
props: Vec::new(),
links: Vec::new(),
control_selection_choice1: None,
exclude_controls: Vec::new(),
remarks: None,
}
}
}
impl Default for ControlSelectionBuilder {
fn default() -> Self {
Self::new()
}
}
impl ControlSelectionBuilder {
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn control_selection_choice1(mut self, v: impl Into<ControlSelectionChoice1>) -> Self {
self.control_selection_choice1 = Some(v.into());
self
}
pub fn exclude_controls(mut self, v: impl Into<SelectControlById>) -> Self {
self.exclude_controls.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ControlSelection, BuildError> {
Ok(ControlSelection {
description: self.description,
props: self.props,
links: self.links,
control_selection_choice1: self.control_selection_choice1,
exclude_controls: self.exclude_controls,
remarks: self.remarks,
})
}
}
impl ControlSelection {
pub fn builder() -> ControlSelectionBuilder {
ControlSelectionBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ControlObjectiveSelectionChoice1 {
IncludeAll(IncludeAll),
SelectObjectiveById(Vec<SelectObjectiveById>),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ControlObjectiveSelection {
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub control_objective_selection_choice1: Option<ControlObjectiveSelectionChoice1>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub exclude_objectives: Vec<SelectObjectiveById>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ControlObjectiveSelectionBuilder {
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
control_objective_selection_choice1: Option<ControlObjectiveSelectionChoice1>,
exclude_objectives: Vec<SelectObjectiveById>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ControlObjectiveSelectionBuilder {
pub fn new() -> Self {
Self {
description: None,
props: Vec::new(),
links: Vec::new(),
control_objective_selection_choice1: None,
exclude_objectives: Vec::new(),
remarks: None,
}
}
}
impl Default for ControlObjectiveSelectionBuilder {
fn default() -> Self {
Self::new()
}
}
impl ControlObjectiveSelectionBuilder {
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn control_objective_selection_choice1(
mut self,
v: impl Into<ControlObjectiveSelectionChoice1>,
) -> Self {
self.control_objective_selection_choice1 = Some(v.into());
self
}
pub fn exclude_objectives(mut self, v: impl Into<SelectObjectiveById>) -> Self {
self.exclude_objectives.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ControlObjectiveSelection, BuildError> {
Ok(ControlObjectiveSelection {
description: self.description,
props: self.props,
links: self.links,
control_objective_selection_choice1: self.control_objective_selection_choice1,
exclude_objectives: self.exclude_objectives,
remarks: self.remarks,
})
}
}
impl ControlObjectiveSelection {
pub fn builder() -> ControlObjectiveSelectionBuilder {
ControlObjectiveSelectionBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ReviewedControls {
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default)]
pub control_selection: Vec<ControlSelection>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub control_objective_selection: Vec<ControlObjectiveSelection>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ReviewedControlsBuilder {
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
control_selection: Vec<ControlSelection>,
control_objective_selection: Vec<ControlObjectiveSelection>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ReviewedControlsBuilder {
pub fn new() -> Self {
Self {
description: None,
props: Vec::new(),
links: Vec::new(),
control_selection: Vec::new(),
control_objective_selection: Vec::new(),
remarks: None,
}
}
}
impl Default for ReviewedControlsBuilder {
fn default() -> Self {
Self::new()
}
}
impl ReviewedControlsBuilder {
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn control_selection(mut self, v: impl Into<ControlSelection>) -> Self {
self.control_selection.push(v.into());
self
}
pub fn control_objective_selection(mut self, v: impl Into<ControlObjectiveSelection>) -> Self {
self.control_objective_selection.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ReviewedControls, BuildError> {
Ok(ReviewedControls {
description: self.description,
props: self.props,
links: self.links,
control_selection: self.control_selection,
control_objective_selection: self.control_objective_selection,
remarks: self.remarks,
})
}
}
impl ReviewedControls {
pub fn builder() -> ReviewedControlsBuilder {
ReviewedControlsBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct SelectControlById {
pub control_id: String,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub statement_id: Vec<String>,
}
#[must_use]
#[derive(Debug)]
pub struct SelectControlByIdBuilder {
control_id: Option<String>,
statement_id: Vec<String>,
}
impl SelectControlByIdBuilder {
pub fn new() -> Self {
Self {
control_id: None,
statement_id: Vec::new(),
}
}
}
impl Default for SelectControlByIdBuilder {
fn default() -> Self {
Self::new()
}
}
impl SelectControlByIdBuilder {
pub fn control_id(mut self, v: impl Into<String>) -> Self {
self.control_id = Some(v.into());
self
}
pub fn statement_id(mut self, v: impl Into<String>) -> Self {
self.statement_id.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<SelectControlById, BuildError> {
let control_id = self
.control_id
.ok_or_else(|| BuildError::MissingField("required field `control-id` not set"))?;
Ok(SelectControlById {
control_id,
statement_id: self.statement_id,
})
}
}
impl SelectControlById {
pub fn builder() -> SelectControlByIdBuilder {
SelectControlByIdBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct SelectObjectiveById {
pub objective_id: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct SelectObjectiveByIdBuilder {
objective_id: Option<String>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl SelectObjectiveByIdBuilder {
pub fn new() -> Self {
Self {
objective_id: None,
remarks: None,
}
}
}
impl Default for SelectObjectiveByIdBuilder {
fn default() -> Self {
Self::new()
}
}
impl SelectObjectiveByIdBuilder {
pub fn objective_id(mut self, v: impl Into<String>) -> Self {
self.objective_id = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<SelectObjectiveById, BuildError> {
let objective_id = self
.objective_id
.ok_or_else(|| BuildError::MissingField("required field `objective-id` not set"))?;
Ok(SelectObjectiveById {
objective_id,
remarks: self.remarks,
})
}
}
impl SelectObjectiveById {
pub fn builder() -> SelectObjectiveByIdBuilder {
SelectObjectiveByIdBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Source {
pub task_uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct SourceBuilder {
task_uuid: Option<uuid::Uuid>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl SourceBuilder {
pub fn new() -> Self {
Self {
task_uuid: None,
remarks: None,
}
}
}
impl Default for SourceBuilder {
fn default() -> Self {
Self::new()
}
}
impl SourceBuilder {
pub fn task_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.task_uuid = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Source, BuildError> {
let task_uuid = self
.task_uuid
.ok_or_else(|| BuildError::MissingField("required field `task-uuid` not set"))?;
Ok(Source {
task_uuid,
remarks: self.remarks,
})
}
}
impl Source {
pub fn builder() -> SourceBuilder {
SourceBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AssessmentSubjectPlaceholder {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default)]
pub source: Vec<Source>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct AssessmentSubjectPlaceholderBuilder {
uuid: Option<uuid::Uuid>,
description: Option<crate::primitives::MarkupMultiline>,
source: Vec<Source>,
props: Vec<Property>,
links: Vec<Link>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl AssessmentSubjectPlaceholderBuilder {
pub fn new() -> Self {
Self {
uuid: None,
description: None,
source: Vec::new(),
props: Vec::new(),
links: Vec::new(),
remarks: None,
}
}
}
impl Default for AssessmentSubjectPlaceholderBuilder {
fn default() -> Self {
Self::new()
}
}
impl AssessmentSubjectPlaceholderBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn source(mut self, v: impl Into<Source>) -> Self {
self.source.push(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<AssessmentSubjectPlaceholder, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
Ok(AssessmentSubjectPlaceholder {
uuid,
description: self.description,
source: self.source,
props: self.props,
links: self.links,
remarks: self.remarks,
})
}
}
impl AssessmentSubjectPlaceholder {
pub fn builder() -> AssessmentSubjectPlaceholderBuilder {
AssessmentSubjectPlaceholderBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AssessmentSubjectChoice1 {
IncludeAll(IncludeAll),
SelectSubjectById(Vec<SelectSubjectById>),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AssessmentSubject {
#[serde(rename = "type")]
pub type_: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub assessment_subject_choice1: Option<AssessmentSubjectChoice1>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub exclude_subjects: Vec<SelectSubjectById>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct AssessmentSubjectBuilder {
type_: Option<String>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
assessment_subject_choice1: Option<AssessmentSubjectChoice1>,
exclude_subjects: Vec<SelectSubjectById>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl AssessmentSubjectBuilder {
pub fn new() -> Self {
Self {
type_: None,
description: None,
props: Vec::new(),
links: Vec::new(),
assessment_subject_choice1: None,
exclude_subjects: Vec::new(),
remarks: None,
}
}
}
impl Default for AssessmentSubjectBuilder {
fn default() -> Self {
Self::new()
}
}
impl AssessmentSubjectBuilder {
pub fn type_(mut self, v: impl Into<String>) -> Self {
self.type_ = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn assessment_subject_choice1(mut self, v: impl Into<AssessmentSubjectChoice1>) -> Self {
self.assessment_subject_choice1 = Some(v.into());
self
}
pub fn exclude_subjects(mut self, v: impl Into<SelectSubjectById>) -> Self {
self.exclude_subjects.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<AssessmentSubject, BuildError> {
let type_ = self
.type_
.ok_or_else(|| BuildError::MissingField("required field `type` not set"))?;
Ok(AssessmentSubject {
type_,
description: self.description,
props: self.props,
links: self.links,
assessment_subject_choice1: self.assessment_subject_choice1,
exclude_subjects: self.exclude_subjects,
remarks: self.remarks,
})
}
}
impl AssessmentSubject {
pub fn builder() -> AssessmentSubjectBuilder {
AssessmentSubjectBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct SelectSubjectById {
pub subject_uuid: String,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct SelectSubjectByIdBuilder {
subject_uuid: Option<String>,
props: Vec<Property>,
links: Vec<Link>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl SelectSubjectByIdBuilder {
pub fn new() -> Self {
Self {
subject_uuid: None,
props: Vec::new(),
links: Vec::new(),
remarks: None,
}
}
}
impl Default for SelectSubjectByIdBuilder {
fn default() -> Self {
Self::new()
}
}
impl SelectSubjectByIdBuilder {
pub fn subject_uuid(mut self, v: impl Into<String>) -> Self {
self.subject_uuid = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<SelectSubjectById, BuildError> {
let subject_uuid = self
.subject_uuid
.ok_or_else(|| BuildError::MissingField("required field `subject-uuid` not set"))?;
Ok(SelectSubjectById {
subject_uuid,
props: self.props,
links: self.links,
remarks: self.remarks,
})
}
}
impl SelectSubjectById {
pub fn builder() -> SelectSubjectByIdBuilder {
SelectSubjectByIdBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct SubjectReference {
pub subject_uuid: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct SubjectReferenceBuilder {
subject_uuid: Option<String>,
title: Option<crate::primitives::MarkupLine>,
props: Vec<Property>,
links: Vec<Link>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl SubjectReferenceBuilder {
pub fn new() -> Self {
Self {
subject_uuid: None,
title: None,
props: Vec::new(),
links: Vec::new(),
remarks: None,
}
}
}
impl Default for SubjectReferenceBuilder {
fn default() -> Self {
Self::new()
}
}
impl SubjectReferenceBuilder {
pub fn subject_uuid(mut self, v: impl Into<String>) -> Self {
self.subject_uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<SubjectReference, BuildError> {
let subject_uuid = self
.subject_uuid
.ok_or_else(|| BuildError::MissingField("required field `subject-uuid` not set"))?;
Ok(SubjectReference {
subject_uuid,
title: self.title,
props: self.props,
links: self.links,
remarks: self.remarks,
})
}
}
impl SubjectReference {
pub fn builder() -> SubjectReferenceBuilder {
SubjectReferenceBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct UsesComponent {
pub component_uuid: uuid::Uuid,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_parties: Vec<ResponsibleParty>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct UsesComponentBuilder {
component_uuid: Option<uuid::Uuid>,
props: Vec<Property>,
links: Vec<Link>,
responsible_parties: Vec<ResponsibleParty>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl UsesComponentBuilder {
pub fn new() -> Self {
Self {
component_uuid: None,
props: Vec::new(),
links: Vec::new(),
responsible_parties: Vec::new(),
remarks: None,
}
}
}
impl Default for UsesComponentBuilder {
fn default() -> Self {
Self::new()
}
}
impl UsesComponentBuilder {
pub fn component_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.component_uuid = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn responsible_parties(mut self, v: impl Into<ResponsibleParty>) -> Self {
self.responsible_parties.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<UsesComponent, BuildError> {
let component_uuid = self
.component_uuid
.ok_or_else(|| BuildError::MissingField("required field `component-uuid` not set"))?;
Ok(UsesComponent {
component_uuid,
props: self.props,
links: self.links,
responsible_parties: self.responsible_parties,
remarks: self.remarks,
})
}
}
impl UsesComponent {
pub fn builder() -> UsesComponentBuilder {
UsesComponentBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AssessmentPlatform {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub uses_component: Vec<UsesComponent>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct AssessmentPlatformBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
props: Vec<Property>,
links: Vec<Link>,
uses_component: Vec<UsesComponent>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl AssessmentPlatformBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
props: Vec::new(),
links: Vec::new(),
uses_component: Vec::new(),
remarks: None,
}
}
}
impl Default for AssessmentPlatformBuilder {
fn default() -> Self {
Self::new()
}
}
impl AssessmentPlatformBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn uses_component(mut self, v: impl Into<UsesComponent>) -> Self {
self.uses_component.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<AssessmentPlatform, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
Ok(AssessmentPlatform {
uuid,
title: self.title,
props: self.props,
links: self.links,
uses_component: self.uses_component,
remarks: self.remarks,
})
}
}
impl AssessmentPlatform {
pub fn builder() -> AssessmentPlatformBuilder {
AssessmentPlatformBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AssessmentAssets {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub components: Vec<SystemComponent>,
#[serde(default)]
pub assessment_platform: Vec<AssessmentPlatform>,
}
#[must_use]
#[derive(Debug)]
pub struct AssessmentAssetsBuilder {
components: Vec<SystemComponent>,
assessment_platform: Vec<AssessmentPlatform>,
}
impl AssessmentAssetsBuilder {
pub fn new() -> Self {
Self {
components: Vec::new(),
assessment_platform: Vec::new(),
}
}
}
impl Default for AssessmentAssetsBuilder {
fn default() -> Self {
Self::new()
}
}
impl AssessmentAssetsBuilder {
pub fn components(mut self, v: impl Into<SystemComponent>) -> Self {
self.components.push(v.into());
self
}
pub fn assessment_platform(mut self, v: impl Into<AssessmentPlatform>) -> Self {
self.assessment_platform.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<AssessmentAssets, BuildError> {
Ok(AssessmentAssets {
components: self.components,
assessment_platform: self.assessment_platform,
})
}
}
impl AssessmentAssets {
pub fn builder() -> AssessmentAssetsBuilder {
AssessmentAssetsBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Status {
pub state: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct StatusBuilder {
state: Option<String>,
reason: Option<String>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl StatusBuilder {
pub fn new() -> Self {
Self {
state: None,
reason: None,
remarks: None,
}
}
}
impl Default for StatusBuilder {
fn default() -> Self {
Self::new()
}
}
impl StatusBuilder {
pub fn state(mut self, v: impl Into<String>) -> Self {
self.state = Some(v.into());
self
}
pub fn reason(mut self, v: impl Into<String>) -> Self {
self.reason = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Status, BuildError> {
let state = self
.state
.ok_or_else(|| BuildError::MissingField("required field `state` not set"))?;
Ok(Status {
state,
reason: self.reason,
remarks: self.remarks,
})
}
}
impl Status {
pub fn builder() -> StatusBuilder {
StatusBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct FindingTarget {
#[serde(rename = "type")]
pub type_: String,
pub target_id: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
pub status: Status,
#[serde(skip_serializing_if = "Option::is_none")]
pub implementation_status: Option<ImplementationStatus>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct FindingTargetBuilder {
type_: Option<String>,
target_id: Option<String>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
status: Option<Status>,
implementation_status: Option<ImplementationStatus>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl FindingTargetBuilder {
pub fn new() -> Self {
Self {
type_: None,
target_id: None,
title: None,
description: None,
props: Vec::new(),
links: Vec::new(),
status: None,
implementation_status: None,
remarks: None,
}
}
}
impl Default for FindingTargetBuilder {
fn default() -> Self {
Self::new()
}
}
impl FindingTargetBuilder {
pub fn type_(mut self, v: impl Into<String>) -> Self {
self.type_ = Some(v.into());
self
}
pub fn target_id(mut self, v: impl Into<String>) -> Self {
self.target_id = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn status(mut self, v: impl Into<Status>) -> Self {
self.status = Some(v.into());
self
}
pub fn implementation_status(mut self, v: impl Into<ImplementationStatus>) -> Self {
self.implementation_status = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<FindingTarget, BuildError> {
let type_ = self
.type_
.ok_or_else(|| BuildError::MissingField("required field `type` not set"))?;
let target_id = self
.target_id
.ok_or_else(|| BuildError::MissingField("required field `target-id` not set"))?;
let status = self
.status
.ok_or_else(|| BuildError::MissingField("required field `status` not set"))?;
Ok(FindingTarget {
type_,
target_id,
title: self.title,
description: self.description,
props: self.props,
links: self.links,
status,
implementation_status: self.implementation_status,
remarks: self.remarks,
})
}
}
impl FindingTarget {
pub fn builder() -> FindingTargetBuilder {
FindingTargetBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Finding {
pub uuid: uuid::Uuid,
pub title: crate::primitives::MarkupLine,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub origins: Vec<Origin>,
pub target: FindingTarget,
#[serde(skip_serializing_if = "Option::is_none")]
pub implementation_statement_uuid: Option<uuid::Uuid>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub related_observations: Vec<RelatedObservation>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub related_risks: Vec<AssociatedRisk>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct FindingBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
origins: Vec<Origin>,
target: Option<FindingTarget>,
implementation_statement_uuid: Option<uuid::Uuid>,
related_observations: Vec<RelatedObservation>,
related_risks: Vec<AssociatedRisk>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl FindingBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
description: None,
props: Vec::new(),
links: Vec::new(),
origins: Vec::new(),
target: None,
implementation_statement_uuid: None,
related_observations: Vec::new(),
related_risks: Vec::new(),
remarks: None,
}
}
}
impl Default for FindingBuilder {
fn default() -> Self {
Self::new()
}
}
impl FindingBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn origins(mut self, v: impl Into<Origin>) -> Self {
self.origins.push(v.into());
self
}
pub fn target(mut self, v: impl Into<FindingTarget>) -> Self {
self.target = Some(v.into());
self
}
pub fn implementation_statement_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.implementation_statement_uuid = Some(v.into());
self
}
pub fn related_observations(mut self, v: impl Into<RelatedObservation>) -> Self {
self.related_observations.push(v.into());
self
}
pub fn related_risks(mut self, v: impl Into<AssociatedRisk>) -> Self {
self.related_risks.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Finding, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
let target = self
.target
.ok_or_else(|| BuildError::MissingField("required field `target` not set"))?;
Ok(Finding {
uuid,
title,
description,
props: self.props,
links: self.links,
origins: self.origins,
target,
implementation_statement_uuid: self.implementation_statement_uuid,
related_observations: self.related_observations,
related_risks: self.related_risks,
remarks: self.remarks,
})
}
}
impl Finding {
pub fn builder() -> FindingBuilder {
FindingBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct RelatedObservation {
pub observation_uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct RelatedObservationBuilder {
observation_uuid: Option<uuid::Uuid>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl RelatedObservationBuilder {
pub fn new() -> Self {
Self {
observation_uuid: None,
remarks: None,
}
}
}
impl Default for RelatedObservationBuilder {
fn default() -> Self {
Self::new()
}
}
impl RelatedObservationBuilder {
pub fn observation_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.observation_uuid = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<RelatedObservation, BuildError> {
let observation_uuid = self
.observation_uuid
.ok_or_else(|| BuildError::MissingField("required field `observation-uuid` not set"))?;
Ok(RelatedObservation {
observation_uuid,
remarks: self.remarks,
})
}
}
impl RelatedObservation {
pub fn builder() -> RelatedObservationBuilder {
RelatedObservationBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AssociatedRisk {
pub risk_uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct AssociatedRiskBuilder {
risk_uuid: Option<uuid::Uuid>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl AssociatedRiskBuilder {
pub fn new() -> Self {
Self {
risk_uuid: None,
remarks: None,
}
}
}
impl Default for AssociatedRiskBuilder {
fn default() -> Self {
Self::new()
}
}
impl AssociatedRiskBuilder {
pub fn risk_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.risk_uuid = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<AssociatedRisk, BuildError> {
let risk_uuid = self
.risk_uuid
.ok_or_else(|| BuildError::MissingField("required field `risk-uuid` not set"))?;
Ok(AssociatedRisk {
risk_uuid,
remarks: self.remarks,
})
}
}
impl AssociatedRisk {
pub fn builder() -> AssociatedRiskBuilder {
AssociatedRiskBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct RelevantEvidence {
#[serde(skip_serializing_if = "Option::is_none")]
pub href: Option<crate::primitives::UriReference>,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct RelevantEvidenceBuilder {
href: Option<crate::primitives::UriReference>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl RelevantEvidenceBuilder {
pub fn new() -> Self {
Self {
href: None,
description: None,
props: Vec::new(),
links: Vec::new(),
remarks: None,
}
}
}
impl Default for RelevantEvidenceBuilder {
fn default() -> Self {
Self::new()
}
}
impl RelevantEvidenceBuilder {
pub fn href(mut self, v: impl Into<crate::primitives::UriReference>) -> Self {
self.href = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<RelevantEvidence, BuildError> {
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(RelevantEvidence {
href: self.href,
description,
props: self.props,
links: self.links,
remarks: self.remarks,
})
}
}
impl RelevantEvidence {
pub fn builder() -> RelevantEvidenceBuilder {
RelevantEvidenceBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Observation {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default)]
pub method: Vec<String>,
#[serde(rename = "type", default, skip_serializing_if = "Vec::is_empty")]
pub type_: Vec<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub origins: Vec<Origin>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub subjects: Vec<SubjectReference>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub relevant_evidence: Vec<RelevantEvidence>,
pub collected: chrono::DateTime<chrono::Utc>,
#[serde(skip_serializing_if = "Option::is_none")]
pub expires: Option<chrono::DateTime<chrono::Utc>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ObservationBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
method: Vec<String>,
type_: Vec<String>,
origins: Vec<Origin>,
subjects: Vec<SubjectReference>,
relevant_evidence: Vec<RelevantEvidence>,
collected: Option<chrono::DateTime<chrono::Utc>>,
expires: Option<chrono::DateTime<chrono::Utc>>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ObservationBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
description: None,
props: Vec::new(),
links: Vec::new(),
method: Vec::new(),
type_: Vec::new(),
origins: Vec::new(),
subjects: Vec::new(),
relevant_evidence: Vec::new(),
collected: None,
expires: None,
remarks: None,
}
}
}
impl Default for ObservationBuilder {
fn default() -> Self {
Self::new()
}
}
impl ObservationBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn method(mut self, v: impl Into<String>) -> Self {
self.method.push(v.into());
self
}
pub fn type_(mut self, v: impl Into<String>) -> Self {
self.type_.push(v.into());
self
}
pub fn origins(mut self, v: impl Into<Origin>) -> Self {
self.origins.push(v.into());
self
}
pub fn subjects(mut self, v: impl Into<SubjectReference>) -> Self {
self.subjects.push(v.into());
self
}
pub fn relevant_evidence(mut self, v: impl Into<RelevantEvidence>) -> Self {
self.relevant_evidence.push(v.into());
self
}
pub fn collected(mut self, v: impl Into<chrono::DateTime<chrono::Utc>>) -> Self {
self.collected = Some(v.into());
self
}
pub fn expires(mut self, v: impl Into<chrono::DateTime<chrono::Utc>>) -> Self {
self.expires = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Observation, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
let collected = self
.collected
.ok_or_else(|| BuildError::MissingField("required field `collected` not set"))?;
Ok(Observation {
uuid,
title: self.title,
description,
props: self.props,
links: self.links,
method: self.method,
type_: self.type_,
origins: self.origins,
subjects: self.subjects,
relevant_evidence: self.relevant_evidence,
collected,
expires: self.expires,
remarks: self.remarks,
})
}
}
impl Observation {
pub fn builder() -> ObservationBuilder {
ObservationBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Origin {
#[serde(default)]
pub actors: Vec<OriginActor>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub related_tasks: Vec<RelatedTask>,
}
#[must_use]
#[derive(Debug)]
pub struct OriginBuilder {
actors: Vec<OriginActor>,
related_tasks: Vec<RelatedTask>,
}
impl OriginBuilder {
pub fn new() -> Self {
Self {
actors: Vec::new(),
related_tasks: Vec::new(),
}
}
}
impl Default for OriginBuilder {
fn default() -> Self {
Self::new()
}
}
impl OriginBuilder {
pub fn actors(mut self, v: impl Into<OriginActor>) -> Self {
self.actors.push(v.into());
self
}
pub fn related_tasks(mut self, v: impl Into<RelatedTask>) -> Self {
self.related_tasks.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Origin, BuildError> {
Ok(Origin {
actors: self.actors,
related_tasks: self.related_tasks,
})
}
}
impl Origin {
pub fn builder() -> OriginBuilder {
OriginBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct OriginActor {
#[serde(rename = "type")]
pub type_: String,
pub actor_uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub role_id: Option<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
}
#[must_use]
#[derive(Debug)]
pub struct OriginActorBuilder {
type_: Option<String>,
actor_uuid: Option<uuid::Uuid>,
role_id: Option<String>,
props: Vec<Property>,
links: Vec<Link>,
}
impl OriginActorBuilder {
pub fn new() -> Self {
Self {
type_: None,
actor_uuid: None,
role_id: None,
props: Vec::new(),
links: Vec::new(),
}
}
}
impl Default for OriginActorBuilder {
fn default() -> Self {
Self::new()
}
}
impl OriginActorBuilder {
pub fn type_(mut self, v: impl Into<String>) -> Self {
self.type_ = Some(v.into());
self
}
pub fn actor_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.actor_uuid = Some(v.into());
self
}
pub fn role_id(mut self, v: impl Into<String>) -> Self {
self.role_id = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<OriginActor, BuildError> {
let type_ = self
.type_
.ok_or_else(|| BuildError::MissingField("required field `type` not set"))?;
let actor_uuid = self
.actor_uuid
.ok_or_else(|| BuildError::MissingField("required field `actor-uuid` not set"))?;
Ok(OriginActor {
type_,
actor_uuid,
role_id: self.role_id,
props: self.props,
links: self.links,
})
}
}
impl OriginActor {
pub fn builder() -> OriginActorBuilder {
OriginActorBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct IdentifiedSubject {
pub subject_placeholder_uuid: uuid::Uuid,
#[serde(default)]
pub subjects: Vec<AssessmentSubject>,
}
#[must_use]
#[derive(Debug)]
pub struct IdentifiedSubjectBuilder {
subject_placeholder_uuid: Option<uuid::Uuid>,
subjects: Vec<AssessmentSubject>,
}
impl IdentifiedSubjectBuilder {
pub fn new() -> Self {
Self {
subject_placeholder_uuid: None,
subjects: Vec::new(),
}
}
}
impl Default for IdentifiedSubjectBuilder {
fn default() -> Self {
Self::new()
}
}
impl IdentifiedSubjectBuilder {
pub fn subject_placeholder_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.subject_placeholder_uuid = Some(v.into());
self
}
pub fn subjects(mut self, v: impl Into<AssessmentSubject>) -> Self {
self.subjects.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<IdentifiedSubject, BuildError> {
let subject_placeholder_uuid = self.subject_placeholder_uuid.ok_or_else(|| {
BuildError::MissingField("required field `subject-placeholder-uuid` not set")
})?;
Ok(IdentifiedSubject {
subject_placeholder_uuid,
subjects: self.subjects,
})
}
}
impl IdentifiedSubject {
pub fn builder() -> IdentifiedSubjectBuilder {
IdentifiedSubjectBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct RelatedTask {
pub task_uuid: uuid::Uuid,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_parties: Vec<ResponsibleParty>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub subjects: Vec<AssessmentSubject>,
#[serde(skip_serializing_if = "Option::is_none")]
pub identified_subject: Option<IdentifiedSubject>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct RelatedTaskBuilder {
task_uuid: Option<uuid::Uuid>,
props: Vec<Property>,
links: Vec<Link>,
responsible_parties: Vec<ResponsibleParty>,
subjects: Vec<AssessmentSubject>,
identified_subject: Option<IdentifiedSubject>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl RelatedTaskBuilder {
pub fn new() -> Self {
Self {
task_uuid: None,
props: Vec::new(),
links: Vec::new(),
responsible_parties: Vec::new(),
subjects: Vec::new(),
identified_subject: None,
remarks: None,
}
}
}
impl Default for RelatedTaskBuilder {
fn default() -> Self {
Self::new()
}
}
impl RelatedTaskBuilder {
pub fn task_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.task_uuid = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn responsible_parties(mut self, v: impl Into<ResponsibleParty>) -> Self {
self.responsible_parties.push(v.into());
self
}
pub fn subjects(mut self, v: impl Into<AssessmentSubject>) -> Self {
self.subjects.push(v.into());
self
}
pub fn identified_subject(mut self, v: impl Into<IdentifiedSubject>) -> Self {
self.identified_subject = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<RelatedTask, BuildError> {
let task_uuid = self
.task_uuid
.ok_or_else(|| BuildError::MissingField("required field `task-uuid` not set"))?;
Ok(RelatedTask {
task_uuid,
props: self.props,
links: self.links,
responsible_parties: self.responsible_parties,
subjects: self.subjects,
identified_subject: self.identified_subject,
remarks: self.remarks,
})
}
}
impl RelatedTask {
pub fn builder() -> RelatedTaskBuilder {
RelatedTaskBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ThreatId {
pub system: url::Url,
#[serde(skip_serializing_if = "Option::is_none")]
pub href: Option<crate::primitives::UriReference>,
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<url::Url>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct MitigatingFactor {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub implementation_uuid: Option<uuid::Uuid>,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub subjects: Vec<SubjectReference>,
}
#[must_use]
#[derive(Debug)]
pub struct MitigatingFactorBuilder {
uuid: Option<uuid::Uuid>,
implementation_uuid: Option<uuid::Uuid>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
subjects: Vec<SubjectReference>,
}
impl MitigatingFactorBuilder {
pub fn new() -> Self {
Self {
uuid: None,
implementation_uuid: None,
description: None,
props: Vec::new(),
links: Vec::new(),
subjects: Vec::new(),
}
}
}
impl Default for MitigatingFactorBuilder {
fn default() -> Self {
Self::new()
}
}
impl MitigatingFactorBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn implementation_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.implementation_uuid = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn subjects(mut self, v: impl Into<SubjectReference>) -> Self {
self.subjects.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<MitigatingFactor, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(MitigatingFactor {
uuid,
implementation_uuid: self.implementation_uuid,
description,
props: self.props,
links: self.links,
subjects: self.subjects,
})
}
}
impl MitigatingFactor {
pub fn builder() -> MitigatingFactorBuilder {
MitigatingFactorBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct RelatedResponse {
pub response_uuid: uuid::Uuid,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub related_tasks: Vec<RelatedTask>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct RelatedResponseBuilder {
response_uuid: Option<uuid::Uuid>,
props: Vec<Property>,
links: Vec<Link>,
related_tasks: Vec<RelatedTask>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl RelatedResponseBuilder {
pub fn new() -> Self {
Self {
response_uuid: None,
props: Vec::new(),
links: Vec::new(),
related_tasks: Vec::new(),
remarks: None,
}
}
}
impl Default for RelatedResponseBuilder {
fn default() -> Self {
Self::new()
}
}
impl RelatedResponseBuilder {
pub fn response_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.response_uuid = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn related_tasks(mut self, v: impl Into<RelatedTask>) -> Self {
self.related_tasks.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<RelatedResponse, BuildError> {
let response_uuid = self
.response_uuid
.ok_or_else(|| BuildError::MissingField("required field `response-uuid` not set"))?;
Ok(RelatedResponse {
response_uuid,
props: self.props,
links: self.links,
related_tasks: self.related_tasks,
remarks: self.remarks,
})
}
}
impl RelatedResponse {
pub fn builder() -> RelatedResponseBuilder {
RelatedResponseBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Entry {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
pub start: chrono::DateTime<chrono::Utc>,
#[serde(skip_serializing_if = "Option::is_none")]
pub end: Option<chrono::DateTime<chrono::Utc>>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub logged_by: Vec<LoggedBy>,
#[serde(skip_serializing_if = "Option::is_none")]
pub status_change: Option<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub related_response: Vec<RelatedResponse>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct EntryBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
start: Option<chrono::DateTime<chrono::Utc>>,
end: Option<chrono::DateTime<chrono::Utc>>,
props: Vec<Property>,
links: Vec<Link>,
logged_by: Vec<LoggedBy>,
status_change: Option<String>,
related_response: Vec<RelatedResponse>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl EntryBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
description: None,
start: None,
end: None,
props: Vec::new(),
links: Vec::new(),
logged_by: Vec::new(),
status_change: None,
related_response: Vec::new(),
remarks: None,
}
}
}
impl Default for EntryBuilder {
fn default() -> Self {
Self::new()
}
}
impl EntryBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn start(mut self, v: impl Into<chrono::DateTime<chrono::Utc>>) -> Self {
self.start = Some(v.into());
self
}
pub fn end(mut self, v: impl Into<chrono::DateTime<chrono::Utc>>) -> Self {
self.end = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn logged_by(mut self, v: impl Into<LoggedBy>) -> Self {
self.logged_by.push(v.into());
self
}
pub fn status_change(mut self, v: impl Into<String>) -> Self {
self.status_change = Some(v.into());
self
}
pub fn related_response(mut self, v: impl Into<RelatedResponse>) -> Self {
self.related_response.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Entry, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let start = self
.start
.ok_or_else(|| BuildError::MissingField("required field `start` not set"))?;
Ok(Entry {
uuid,
title: self.title,
description: self.description,
start,
end: self.end,
props: self.props,
links: self.links,
logged_by: self.logged_by,
status_change: self.status_change,
related_response: self.related_response,
remarks: self.remarks,
})
}
}
impl Entry {
pub fn builder() -> EntryBuilder {
EntryBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct RiskLog {
#[serde(default)]
pub entry: Vec<Entry>,
}
#[must_use]
#[derive(Debug)]
pub struct RiskLogBuilder {
entry: Vec<Entry>,
}
impl RiskLogBuilder {
pub fn new() -> Self {
Self { entry: Vec::new() }
}
}
impl Default for RiskLogBuilder {
fn default() -> Self {
Self::new()
}
}
impl RiskLogBuilder {
pub fn entry(mut self, v: impl Into<Entry>) -> Self {
self.entry.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<RiskLog, BuildError> {
Ok(RiskLog { entry: self.entry })
}
}
impl RiskLog {
pub fn builder() -> RiskLogBuilder {
RiskLogBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Risk {
pub uuid: uuid::Uuid,
pub title: crate::primitives::MarkupLine,
pub description: crate::primitives::MarkupMultiline,
pub statement: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
pub status: String,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub origins: Vec<Origin>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub threat_ids: Vec<ThreatId>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub characterizations: Vec<Characterization>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub mitigating_factor: Vec<MitigatingFactor>,
#[serde(skip_serializing_if = "Option::is_none")]
pub deadline: Option<chrono::DateTime<chrono::Utc>>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub remediations: Vec<Response>,
#[serde(skip_serializing_if = "Option::is_none")]
pub risk_log: Option<RiskLog>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub related_observations: Vec<RelatedObservation>,
}
#[must_use]
#[derive(Debug)]
pub struct RiskBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
statement: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
status: Option<String>,
origins: Vec<Origin>,
threat_ids: Vec<ThreatId>,
characterizations: Vec<Characterization>,
mitigating_factor: Vec<MitigatingFactor>,
deadline: Option<chrono::DateTime<chrono::Utc>>,
remediations: Vec<Response>,
risk_log: Option<RiskLog>,
related_observations: Vec<RelatedObservation>,
}
impl RiskBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
description: None,
statement: None,
props: Vec::new(),
links: Vec::new(),
status: None,
origins: Vec::new(),
threat_ids: Vec::new(),
characterizations: Vec::new(),
mitigating_factor: Vec::new(),
deadline: None,
remediations: Vec::new(),
risk_log: None,
related_observations: Vec::new(),
}
}
}
impl Default for RiskBuilder {
fn default() -> Self {
Self::new()
}
}
impl RiskBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn statement(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.statement = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn status(mut self, v: impl Into<String>) -> Self {
self.status = Some(v.into());
self
}
pub fn origins(mut self, v: impl Into<Origin>) -> Self {
self.origins.push(v.into());
self
}
pub fn threat_ids(mut self, v: impl Into<ThreatId>) -> Self {
self.threat_ids.push(v.into());
self
}
pub fn characterizations(mut self, v: impl Into<Characterization>) -> Self {
self.characterizations.push(v.into());
self
}
pub fn mitigating_factor(mut self, v: impl Into<MitigatingFactor>) -> Self {
self.mitigating_factor.push(v.into());
self
}
pub fn deadline(mut self, v: impl Into<chrono::DateTime<chrono::Utc>>) -> Self {
self.deadline = Some(v.into());
self
}
pub fn remediations(mut self, v: impl Into<Response>) -> Self {
self.remediations.push(v.into());
self
}
pub fn risk_log(mut self, v: impl Into<RiskLog>) -> Self {
self.risk_log = Some(v.into());
self
}
pub fn related_observations(mut self, v: impl Into<RelatedObservation>) -> Self {
self.related_observations.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Risk, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
let statement = self
.statement
.ok_or_else(|| BuildError::MissingField("required field `statement` not set"))?;
let status = self
.status
.ok_or_else(|| BuildError::MissingField("required field `status` not set"))?;
Ok(Risk {
uuid,
title,
description,
statement,
props: self.props,
links: self.links,
status,
origins: self.origins,
threat_ids: self.threat_ids,
characterizations: self.characterizations,
mitigating_factor: self.mitigating_factor,
deadline: self.deadline,
remediations: self.remediations,
risk_log: self.risk_log,
related_observations: self.related_observations,
})
}
}
impl Risk {
pub fn builder() -> RiskBuilder {
RiskBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct LoggedBy {
pub party_uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub role_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct LoggedByBuilder {
party_uuid: Option<uuid::Uuid>,
role_id: Option<String>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl LoggedByBuilder {
pub fn new() -> Self {
Self {
party_uuid: None,
role_id: None,
remarks: None,
}
}
}
impl Default for LoggedByBuilder {
fn default() -> Self {
Self::new()
}
}
impl LoggedByBuilder {
pub fn party_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.party_uuid = Some(v.into());
self
}
pub fn role_id(mut self, v: impl Into<String>) -> Self {
self.role_id = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<LoggedBy, BuildError> {
let party_uuid = self
.party_uuid
.ok_or_else(|| BuildError::MissingField("required field `party-uuid` not set"))?;
Ok(LoggedBy {
party_uuid,
role_id: self.role_id,
remarks: self.remarks,
})
}
}
impl LoggedBy {
pub fn builder() -> LoggedByBuilder {
LoggedByBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct RiskStatus {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Facet {
pub name: String,
pub system: url::Url,
pub value: String,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct FacetBuilder {
name: Option<String>,
system: Option<url::Url>,
value: Option<String>,
props: Vec<Property>,
links: Vec<Link>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl FacetBuilder {
pub fn new() -> Self {
Self {
name: None,
system: None,
value: None,
props: Vec::new(),
links: Vec::new(),
remarks: None,
}
}
}
impl Default for FacetBuilder {
fn default() -> Self {
Self::new()
}
}
impl FacetBuilder {
pub fn name(mut self, v: impl Into<String>) -> Self {
self.name = Some(v.into());
self
}
pub fn system(mut self, v: impl Into<url::Url>) -> Self {
self.system = Some(v.into());
self
}
pub fn value(mut self, v: impl Into<String>) -> Self {
self.value = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Facet, BuildError> {
let name = self
.name
.ok_or_else(|| BuildError::MissingField("required field `name` not set"))?;
let system = self
.system
.ok_or_else(|| BuildError::MissingField("required field `system` not set"))?;
let value = self
.value
.ok_or_else(|| BuildError::MissingField("required field `value` not set"))?;
Ok(Facet {
name,
system,
value,
props: self.props,
links: self.links,
remarks: self.remarks,
})
}
}
impl Facet {
pub fn builder() -> FacetBuilder {
FacetBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Characterization {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
pub origin: Origin,
#[serde(default)]
pub facet: Vec<Facet>,
}
#[must_use]
#[derive(Debug)]
pub struct CharacterizationBuilder {
props: Vec<Property>,
links: Vec<Link>,
origin: Option<Origin>,
facet: Vec<Facet>,
}
impl CharacterizationBuilder {
pub fn new() -> Self {
Self {
props: Vec::new(),
links: Vec::new(),
origin: None,
facet: Vec::new(),
}
}
}
impl Default for CharacterizationBuilder {
fn default() -> Self {
Self::new()
}
}
impl CharacterizationBuilder {
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn origin(mut self, v: impl Into<Origin>) -> Self {
self.origin = Some(v.into());
self
}
pub fn facet(mut self, v: impl Into<Facet>) -> Self {
self.facet.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Characterization, BuildError> {
let origin = self
.origin
.ok_or_else(|| BuildError::MissingField("required field `origin` not set"))?;
Ok(Characterization {
props: self.props,
links: self.links,
origin,
facet: self.facet,
})
}
}
impl Characterization {
pub fn builder() -> CharacterizationBuilder {
CharacterizationBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct RequiredAsset {
pub uuid: uuid::Uuid,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub subjects: Vec<SubjectReference>,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct RequiredAssetBuilder {
uuid: Option<uuid::Uuid>,
subjects: Vec<SubjectReference>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl RequiredAssetBuilder {
pub fn new() -> Self {
Self {
uuid: None,
subjects: Vec::new(),
title: None,
description: None,
props: Vec::new(),
links: Vec::new(),
remarks: None,
}
}
}
impl Default for RequiredAssetBuilder {
fn default() -> Self {
Self::new()
}
}
impl RequiredAssetBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn subjects(mut self, v: impl Into<SubjectReference>) -> Self {
self.subjects.push(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<RequiredAsset, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(RequiredAsset {
uuid,
subjects: self.subjects,
title: self.title,
description,
props: self.props,
links: self.links,
remarks: self.remarks,
})
}
}
impl RequiredAsset {
pub fn builder() -> RequiredAssetBuilder {
RequiredAssetBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Response {
pub uuid: uuid::Uuid,
pub lifecycle: String,
pub title: crate::primitives::MarkupLine,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub origins: Vec<Origin>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub required_asset: Vec<RequiredAsset>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub tasks: Vec<Task>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ResponseBuilder {
uuid: Option<uuid::Uuid>,
lifecycle: Option<String>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
origins: Vec<Origin>,
required_asset: Vec<RequiredAsset>,
tasks: Vec<Task>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ResponseBuilder {
pub fn new() -> Self {
Self {
uuid: None,
lifecycle: None,
title: None,
description: None,
props: Vec::new(),
links: Vec::new(),
origins: Vec::new(),
required_asset: Vec::new(),
tasks: Vec::new(),
remarks: None,
}
}
}
impl Default for ResponseBuilder {
fn default() -> Self {
Self::new()
}
}
impl ResponseBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn lifecycle(mut self, v: impl Into<String>) -> Self {
self.lifecycle = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn origins(mut self, v: impl Into<Origin>) -> Self {
self.origins.push(v.into());
self
}
pub fn required_asset(mut self, v: impl Into<RequiredAsset>) -> Self {
self.required_asset.push(v.into());
self
}
pub fn tasks(mut self, v: impl Into<Task>) -> Self {
self.tasks.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Response, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let lifecycle = self
.lifecycle
.ok_or_else(|| BuildError::MissingField("required field `lifecycle` not set"))?;
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(Response {
uuid,
lifecycle,
title,
description,
props: self.props,
links: self.links,
origins: self.origins,
required_asset: self.required_asset,
tasks: self.tasks,
remarks: self.remarks,
})
}
}
impl Response {
pub fn builder() -> ResponseBuilder {
ResponseBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AssessmentPart {
#[serde(skip_serializing_if = "Option::is_none")]
pub uuid: Option<uuid::Uuid>,
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub ns: Option<url::Url>,
#[serde(skip_serializing_if = "Option::is_none")]
pub class: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(skip_serializing_if = "Option::is_none")]
pub prose: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub parts: Vec<AssessmentPart>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
}
#[must_use]
#[derive(Debug)]
pub struct AssessmentPartBuilder {
uuid: Option<uuid::Uuid>,
name: Option<String>,
ns: Option<url::Url>,
class: Option<String>,
title: Option<crate::primitives::MarkupLine>,
props: Vec<Property>,
prose: Option<crate::primitives::MarkupMultiline>,
parts: Vec<AssessmentPart>,
links: Vec<Link>,
}
impl AssessmentPartBuilder {
pub fn new() -> Self {
Self {
uuid: None,
name: None,
ns: None,
class: None,
title: None,
props: Vec::new(),
prose: None,
parts: Vec::new(),
links: Vec::new(),
}
}
}
impl Default for AssessmentPartBuilder {
fn default() -> Self {
Self::new()
}
}
impl AssessmentPartBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn name(mut self, v: impl Into<String>) -> Self {
self.name = Some(v.into());
self
}
pub fn ns(mut self, v: impl Into<url::Url>) -> Self {
self.ns = Some(v.into());
self
}
pub fn class(mut self, v: impl Into<String>) -> Self {
self.class = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn prose(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.prose = Some(v.into());
self
}
pub fn parts(mut self, v: impl Into<AssessmentPart>) -> Self {
self.parts.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<AssessmentPart, BuildError> {
let name = self
.name
.ok_or_else(|| BuildError::MissingField("required field `name` not set"))?;
Ok(AssessmentPart {
uuid: self.uuid,
name,
ns: self.ns,
class: self.class,
title: self.title,
props: self.props,
prose: self.prose,
parts: self.parts,
links: self.links,
})
}
}
impl AssessmentPart {
pub fn builder() -> AssessmentPartBuilder {
AssessmentPartBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Part {
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub ns: Option<url::Url>,
#[serde(skip_serializing_if = "Option::is_none")]
pub class: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(skip_serializing_if = "Option::is_none")]
pub prose: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub parts: Vec<Part>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
}
#[must_use]
#[derive(Debug)]
pub struct PartBuilder {
id: Option<String>,
name: Option<String>,
ns: Option<url::Url>,
class: Option<String>,
title: Option<crate::primitives::MarkupLine>,
props: Vec<Property>,
prose: Option<crate::primitives::MarkupMultiline>,
parts: Vec<Part>,
links: Vec<Link>,
}
impl PartBuilder {
pub fn new() -> Self {
Self {
id: None,
name: None,
ns: None,
class: None,
title: None,
props: Vec::new(),
prose: None,
parts: Vec::new(),
links: Vec::new(),
}
}
}
impl Default for PartBuilder {
fn default() -> Self {
Self::new()
}
}
impl PartBuilder {
pub fn id(mut self, v: impl Into<String>) -> Self {
self.id = Some(v.into());
self
}
pub fn name(mut self, v: impl Into<String>) -> Self {
self.name = Some(v.into());
self
}
pub fn ns(mut self, v: impl Into<url::Url>) -> Self {
self.ns = Some(v.into());
self
}
pub fn class(mut self, v: impl Into<String>) -> Self {
self.class = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn prose(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.prose = Some(v.into());
self
}
pub fn parts(mut self, v: impl Into<Part>) -> Self {
self.parts.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Part, BuildError> {
let name = self
.name
.ok_or_else(|| BuildError::MissingField("required field `name` not set"))?;
Ok(Part {
id: self.id,
name,
ns: self.ns,
class: self.class,
title: self.title,
props: self.props,
prose: self.prose,
parts: self.parts,
links: self.links,
})
}
}
impl Part {
pub fn builder() -> PartBuilder {
PartBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ParameterChoice1 {
ParameterValue(Vec<String>),
ParameterSelection(Option<ParameterSelection>),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Parameter {
pub id: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub class: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub depends_on: Option<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub label: Option<crate::primitives::MarkupLine>,
#[serde(skip_serializing_if = "Option::is_none")]
pub usage: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub constraints: Vec<ParameterConstraint>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub guidelines: Vec<ParameterGuideline>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parameter_choice1: Option<ParameterChoice1>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ParameterBuilder {
id: Option<String>,
class: Option<String>,
depends_on: Option<String>,
props: Vec<Property>,
links: Vec<Link>,
label: Option<crate::primitives::MarkupLine>,
usage: Option<crate::primitives::MarkupMultiline>,
constraints: Vec<ParameterConstraint>,
guidelines: Vec<ParameterGuideline>,
parameter_choice1: Option<ParameterChoice1>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ParameterBuilder {
pub fn new() -> Self {
Self {
id: None,
class: None,
depends_on: None,
props: Vec::new(),
links: Vec::new(),
label: None,
usage: None,
constraints: Vec::new(),
guidelines: Vec::new(),
parameter_choice1: None,
remarks: None,
}
}
}
impl Default for ParameterBuilder {
fn default() -> Self {
Self::new()
}
}
impl ParameterBuilder {
pub fn id(mut self, v: impl Into<String>) -> Self {
self.id = Some(v.into());
self
}
pub fn class(mut self, v: impl Into<String>) -> Self {
self.class = Some(v.into());
self
}
pub fn depends_on(mut self, v: impl Into<String>) -> Self {
self.depends_on = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn label(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.label = Some(v.into());
self
}
pub fn usage(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.usage = Some(v.into());
self
}
pub fn constraints(mut self, v: impl Into<ParameterConstraint>) -> Self {
self.constraints.push(v.into());
self
}
pub fn guidelines(mut self, v: impl Into<ParameterGuideline>) -> Self {
self.guidelines.push(v.into());
self
}
pub fn parameter_choice1(mut self, v: impl Into<ParameterChoice1>) -> Self {
self.parameter_choice1 = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Parameter, BuildError> {
let id = self
.id
.ok_or_else(|| BuildError::MissingField("required field `id` not set"))?;
Ok(Parameter {
id,
class: self.class,
depends_on: self.depends_on,
props: self.props,
links: self.links,
label: self.label,
usage: self.usage,
constraints: self.constraints,
guidelines: self.guidelines,
parameter_choice1: self.parameter_choice1,
remarks: self.remarks,
})
}
}
impl Parameter {
pub fn builder() -> ParameterBuilder {
ParameterBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Test {
pub expression: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct TestBuilder {
expression: Option<String>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl TestBuilder {
pub fn new() -> Self {
Self {
expression: None,
remarks: None,
}
}
}
impl Default for TestBuilder {
fn default() -> Self {
Self::new()
}
}
impl TestBuilder {
pub fn expression(mut self, v: impl Into<String>) -> Self {
self.expression = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Test, BuildError> {
let expression = self
.expression
.ok_or_else(|| BuildError::MissingField("required field `expression` not set"))?;
Ok(Test {
expression,
remarks: self.remarks,
})
}
}
impl Test {
pub fn builder() -> TestBuilder {
TestBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ParameterConstraint {
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub test: Vec<Test>,
}
#[must_use]
#[derive(Debug)]
pub struct ParameterConstraintBuilder {
description: Option<crate::primitives::MarkupMultiline>,
test: Vec<Test>,
}
impl ParameterConstraintBuilder {
pub fn new() -> Self {
Self {
description: None,
test: Vec::new(),
}
}
}
impl Default for ParameterConstraintBuilder {
fn default() -> Self {
Self::new()
}
}
impl ParameterConstraintBuilder {
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn test(mut self, v: impl Into<Test>) -> Self {
self.test.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ParameterConstraint, BuildError> {
Ok(ParameterConstraint {
description: self.description,
test: self.test,
})
}
}
impl ParameterConstraint {
pub fn builder() -> ParameterConstraintBuilder {
ParameterConstraintBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ParameterGuideline {
pub prose: crate::primitives::MarkupMultiline,
}
#[must_use]
#[derive(Debug)]
pub struct ParameterGuidelineBuilder {
prose: Option<crate::primitives::MarkupMultiline>,
}
impl ParameterGuidelineBuilder {
pub fn new() -> Self {
Self { prose: None }
}
}
impl Default for ParameterGuidelineBuilder {
fn default() -> Self {
Self::new()
}
}
impl ParameterGuidelineBuilder {
pub fn prose(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.prose = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ParameterGuideline, BuildError> {
let prose = self
.prose
.ok_or_else(|| BuildError::MissingField("required field `prose` not set"))?;
Ok(ParameterGuideline { prose })
}
}
impl ParameterGuideline {
pub fn builder() -> ParameterGuidelineBuilder {
ParameterGuidelineBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ParameterValue {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ParameterSelection {
#[serde(skip_serializing_if = "Option::is_none")]
pub how_many: Option<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub choice: Vec<crate::primitives::MarkupLine>,
}
#[must_use]
#[derive(Debug)]
pub struct ParameterSelectionBuilder {
how_many: Option<String>,
choice: Vec<crate::primitives::MarkupLine>,
}
impl ParameterSelectionBuilder {
pub fn new() -> Self {
Self {
how_many: None,
choice: Vec::new(),
}
}
}
impl Default for ParameterSelectionBuilder {
fn default() -> Self {
Self::new()
}
}
impl ParameterSelectionBuilder {
pub fn how_many(mut self, v: impl Into<String>) -> Self {
self.how_many = Some(v.into());
self
}
pub fn choice(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.choice.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ParameterSelection, BuildError> {
Ok(ParameterSelection {
how_many: self.how_many,
choice: self.choice,
})
}
}
impl ParameterSelection {
pub fn builder() -> ParameterSelectionBuilder {
ParameterSelectionBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct IncludeAll {}
#[must_use]
#[derive(Debug)]
pub struct IncludeAllBuilder {}
impl IncludeAllBuilder {
pub fn new() -> Self {
Self {}
}
}
impl Default for IncludeAllBuilder {
fn default() -> Self {
Self::new()
}
}
impl IncludeAllBuilder {
pub fn build(self) -> ::core::result::Result<IncludeAll, BuildError> {
Ok(IncludeAll {})
}
}
impl IncludeAll {
pub fn builder() -> IncludeAllBuilder {
IncludeAllBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct WithId {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Matching {
#[serde(skip_serializing_if = "Option::is_none")]
pub pattern: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct MatchingBuilder {
pattern: Option<String>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl MatchingBuilder {
pub fn new() -> Self {
Self {
pattern: None,
remarks: None,
}
}
}
impl Default for MatchingBuilder {
fn default() -> Self {
Self::new()
}
}
impl MatchingBuilder {
pub fn pattern(mut self, v: impl Into<String>) -> Self {
self.pattern = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Matching, BuildError> {
Ok(Matching {
pattern: self.pattern,
remarks: self.remarks,
})
}
}
impl Matching {
pub fn builder() -> MatchingBuilder {
MatchingBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Revision {
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
#[serde(skip_serializing_if = "Option::is_none")]
pub published: Option<chrono::DateTime<chrono::Utc>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modified: Option<chrono::DateTime<chrono::Utc>>,
pub version: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub oscal_version: Option<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct RevisionBuilder {
title: Option<crate::primitives::MarkupLine>,
published: Option<chrono::DateTime<chrono::Utc>>,
last_modified: Option<chrono::DateTime<chrono::Utc>>,
version: Option<String>,
oscal_version: Option<String>,
props: Vec<Property>,
links: Vec<Link>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl RevisionBuilder {
pub fn new() -> Self {
Self {
title: None,
published: None,
last_modified: None,
version: None,
oscal_version: None,
props: Vec::new(),
links: Vec::new(),
remarks: None,
}
}
}
impl Default for RevisionBuilder {
fn default() -> Self {
Self::new()
}
}
impl RevisionBuilder {
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn published(mut self, v: impl Into<chrono::DateTime<chrono::Utc>>) -> Self {
self.published = Some(v.into());
self
}
pub fn last_modified(mut self, v: impl Into<chrono::DateTime<chrono::Utc>>) -> Self {
self.last_modified = Some(v.into());
self
}
pub fn version(mut self, v: impl Into<String>) -> Self {
self.version = Some(v.into());
self
}
pub fn oscal_version(mut self, v: impl Into<String>) -> Self {
self.oscal_version = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Revision, BuildError> {
let version = self
.version
.ok_or_else(|| BuildError::MissingField("required field `version` not set"))?;
Ok(Revision {
title: self.title,
published: self.published,
last_modified: self.last_modified,
version,
oscal_version: self.oscal_version,
props: self.props,
links: self.links,
remarks: self.remarks,
})
}
}
impl Revision {
pub fn builder() -> RevisionBuilder {
RevisionBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Role {
pub id: String,
pub title: crate::primitives::MarkupLine,
#[serde(skip_serializing_if = "Option::is_none")]
pub short_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct RoleBuilder {
id: Option<String>,
title: Option<crate::primitives::MarkupLine>,
short_name: Option<String>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl RoleBuilder {
pub fn new() -> Self {
Self {
id: None,
title: None,
short_name: None,
description: None,
props: Vec::new(),
links: Vec::new(),
remarks: None,
}
}
}
impl Default for RoleBuilder {
fn default() -> Self {
Self::new()
}
}
impl RoleBuilder {
pub fn id(mut self, v: impl Into<String>) -> Self {
self.id = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn short_name(mut self, v: impl Into<String>) -> Self {
self.short_name = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Role, BuildError> {
let id = self
.id
.ok_or_else(|| BuildError::MissingField("required field `id` not set"))?;
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
Ok(Role {
id,
title,
short_name: self.short_name,
description: self.description,
props: self.props,
links: self.links,
remarks: self.remarks,
})
}
}
impl Role {
pub fn builder() -> RoleBuilder {
RoleBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Location {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<Address>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub email_addresses: Vec<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub telephone_numbers: Vec<TelephoneNumber>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub url: Vec<url::Url>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct LocationBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
address: Option<Address>,
email_addresses: Vec<String>,
telephone_numbers: Vec<TelephoneNumber>,
url: Vec<url::Url>,
props: Vec<Property>,
links: Vec<Link>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl LocationBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
address: None,
email_addresses: Vec::new(),
telephone_numbers: Vec::new(),
url: Vec::new(),
props: Vec::new(),
links: Vec::new(),
remarks: None,
}
}
}
impl Default for LocationBuilder {
fn default() -> Self {
Self::new()
}
}
impl LocationBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn address(mut self, v: impl Into<Address>) -> Self {
self.address = Some(v.into());
self
}
pub fn email_addresses(mut self, v: impl Into<String>) -> Self {
self.email_addresses.push(v.into());
self
}
pub fn telephone_numbers(mut self, v: impl Into<TelephoneNumber>) -> Self {
self.telephone_numbers.push(v.into());
self
}
pub fn url(mut self, v: impl Into<url::Url>) -> Self {
self.url.push(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Location, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
Ok(Location {
uuid,
title: self.title,
address: self.address,
email_addresses: self.email_addresses,
telephone_numbers: self.telephone_numbers,
url: self.url,
props: self.props,
links: self.links,
remarks: self.remarks,
})
}
}
impl Location {
pub fn builder() -> LocationBuilder {
LocationBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ExternalId {
pub scheme: url::Url,
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PartyChoice1 {
Address(Vec<Address>),
LocationUuid(Vec<uuid::Uuid>),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Party {
pub uuid: uuid::Uuid,
#[serde(rename = "type")]
pub type_: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub short_name: Option<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub external_id: Vec<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub email_addresses: Vec<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub telephone_numbers: Vec<TelephoneNumber>,
#[serde(skip_serializing_if = "Option::is_none")]
pub party_choice1: Option<PartyChoice1>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub member_of_organization: Vec<uuid::Uuid>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct PartyBuilder {
uuid: Option<uuid::Uuid>,
type_: Option<String>,
name: Option<String>,
short_name: Option<String>,
external_id: Vec<String>,
props: Vec<Property>,
links: Vec<Link>,
email_addresses: Vec<String>,
telephone_numbers: Vec<TelephoneNumber>,
party_choice1: Option<PartyChoice1>,
member_of_organization: Vec<uuid::Uuid>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl PartyBuilder {
pub fn new() -> Self {
Self {
uuid: None,
type_: None,
name: None,
short_name: None,
external_id: Vec::new(),
props: Vec::new(),
links: Vec::new(),
email_addresses: Vec::new(),
telephone_numbers: Vec::new(),
party_choice1: None,
member_of_organization: Vec::new(),
remarks: None,
}
}
}
impl Default for PartyBuilder {
fn default() -> Self {
Self::new()
}
}
impl PartyBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn type_(mut self, v: impl Into<String>) -> Self {
self.type_ = Some(v.into());
self
}
pub fn name(mut self, v: impl Into<String>) -> Self {
self.name = Some(v.into());
self
}
pub fn short_name(mut self, v: impl Into<String>) -> Self {
self.short_name = Some(v.into());
self
}
pub fn external_id(mut self, v: impl Into<String>) -> Self {
self.external_id.push(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn email_addresses(mut self, v: impl Into<String>) -> Self {
self.email_addresses.push(v.into());
self
}
pub fn telephone_numbers(mut self, v: impl Into<TelephoneNumber>) -> Self {
self.telephone_numbers.push(v.into());
self
}
pub fn party_choice1(mut self, v: impl Into<PartyChoice1>) -> Self {
self.party_choice1 = Some(v.into());
self
}
pub fn member_of_organization(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.member_of_organization.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Party, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let type_ = self
.type_
.ok_or_else(|| BuildError::MissingField("required field `type` not set"))?;
Ok(Party {
uuid,
type_,
name: self.name,
short_name: self.short_name,
external_id: self.external_id,
props: self.props,
links: self.links,
email_addresses: self.email_addresses,
telephone_numbers: self.telephone_numbers,
party_choice1: self.party_choice1,
member_of_organization: self.member_of_organization,
remarks: self.remarks,
})
}
}
impl Party {
pub fn builder() -> PartyBuilder {
PartyBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Metadata {
pub title: crate::primitives::MarkupLine,
#[serde(skip_serializing_if = "Option::is_none")]
pub published: Option<chrono::DateTime<chrono::Utc>>,
pub last_modified: chrono::DateTime<chrono::Utc>,
pub version: String,
pub oscal_version: String,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub revision: Vec<Revision>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub document_ids: Vec<DocumentId>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub role: Vec<Role>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub location: Vec<Location>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub party: Vec<Party>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_parties: Vec<ResponsibleParty>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub actions: Vec<Action>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct MetadataBuilder {
title: Option<crate::primitives::MarkupLine>,
published: Option<chrono::DateTime<chrono::Utc>>,
last_modified: Option<chrono::DateTime<chrono::Utc>>,
version: Option<String>,
oscal_version: Option<String>,
revision: Vec<Revision>,
document_ids: Vec<DocumentId>,
props: Vec<Property>,
links: Vec<Link>,
role: Vec<Role>,
location: Vec<Location>,
party: Vec<Party>,
responsible_parties: Vec<ResponsibleParty>,
actions: Vec<Action>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl MetadataBuilder {
pub fn new() -> Self {
Self {
title: None,
published: None,
last_modified: None,
version: None,
oscal_version: None,
revision: Vec::new(),
document_ids: Vec::new(),
props: Vec::new(),
links: Vec::new(),
role: Vec::new(),
location: Vec::new(),
party: Vec::new(),
responsible_parties: Vec::new(),
actions: Vec::new(),
remarks: None,
}
}
}
impl Default for MetadataBuilder {
fn default() -> Self {
Self::new()
}
}
impl MetadataBuilder {
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn published(mut self, v: impl Into<chrono::DateTime<chrono::Utc>>) -> Self {
self.published = Some(v.into());
self
}
pub fn last_modified(mut self, v: impl Into<chrono::DateTime<chrono::Utc>>) -> Self {
self.last_modified = Some(v.into());
self
}
pub fn version(mut self, v: impl Into<String>) -> Self {
self.version = Some(v.into());
self
}
pub fn oscal_version(mut self, v: impl Into<String>) -> Self {
self.oscal_version = Some(v.into());
self
}
pub fn revision(mut self, v: impl Into<Revision>) -> Self {
self.revision.push(v.into());
self
}
pub fn document_ids(mut self, v: impl Into<DocumentId>) -> Self {
self.document_ids.push(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn role(mut self, v: impl Into<Role>) -> Self {
self.role.push(v.into());
self
}
pub fn location(mut self, v: impl Into<Location>) -> Self {
self.location.push(v.into());
self
}
pub fn party(mut self, v: impl Into<Party>) -> Self {
self.party.push(v.into());
self
}
pub fn responsible_parties(mut self, v: impl Into<ResponsibleParty>) -> Self {
self.responsible_parties.push(v.into());
self
}
pub fn actions(mut self, v: impl Into<Action>) -> Self {
self.actions.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Metadata, BuildError> {
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
let last_modified = self
.last_modified
.ok_or_else(|| BuildError::MissingField("required field `last-modified` not set"))?;
let version = self
.version
.ok_or_else(|| BuildError::MissingField("required field `version` not set"))?;
let oscal_version = self
.oscal_version
.ok_or_else(|| BuildError::MissingField("required field `oscal-version` not set"))?;
Ok(Metadata {
title,
published: self.published,
last_modified,
version,
oscal_version,
revision: self.revision,
document_ids: self.document_ids,
props: self.props,
links: self.links,
role: self.role,
location: self.location,
party: self.party,
responsible_parties: self.responsible_parties,
actions: self.actions,
remarks: self.remarks,
})
}
}
impl Metadata {
pub fn builder() -> MetadataBuilder {
MetadataBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct LocationUuid {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<uuid::Uuid>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct PartyUuid {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<uuid::Uuid>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct RoleId {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Citation {
pub text: crate::primitives::MarkupLine,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
}
#[must_use]
#[derive(Debug)]
pub struct CitationBuilder {
text: Option<crate::primitives::MarkupLine>,
props: Vec<Property>,
links: Vec<Link>,
}
impl CitationBuilder {
pub fn new() -> Self {
Self {
text: None,
props: Vec::new(),
links: Vec::new(),
}
}
}
impl Default for CitationBuilder {
fn default() -> Self {
Self::new()
}
}
impl CitationBuilder {
pub fn text(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.text = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Citation, BuildError> {
let text = self
.text
.ok_or_else(|| BuildError::MissingField("required field `text` not set"))?;
Ok(Citation {
text,
props: self.props,
links: self.links,
})
}
}
impl Citation {
pub fn builder() -> CitationBuilder {
CitationBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Rlink {
pub href: crate::primitives::UriReference,
#[serde(skip_serializing_if = "Option::is_none")]
pub media_type: Option<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub hashes: Vec<OscalHash>,
}
#[must_use]
#[derive(Debug)]
pub struct RlinkBuilder {
href: Option<crate::primitives::UriReference>,
media_type: Option<String>,
hashes: Vec<OscalHash>,
}
impl RlinkBuilder {
pub fn new() -> Self {
Self {
href: None,
media_type: None,
hashes: Vec::new(),
}
}
}
impl Default for RlinkBuilder {
fn default() -> Self {
Self::new()
}
}
impl RlinkBuilder {
pub fn href(mut self, v: impl Into<crate::primitives::UriReference>) -> Self {
self.href = Some(v.into());
self
}
pub fn media_type(mut self, v: impl Into<String>) -> Self {
self.media_type = Some(v.into());
self
}
pub fn hashes(mut self, v: impl Into<OscalHash>) -> Self {
self.hashes.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Rlink, BuildError> {
let href = self
.href
.ok_or_else(|| BuildError::MissingField("required field `href` not set"))?;
Ok(Rlink {
href,
media_type: self.media_type,
hashes: self.hashes,
})
}
}
impl Rlink {
pub fn builder() -> RlinkBuilder {
RlinkBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Base64 {
#[serde(skip_serializing_if = "Option::is_none")]
pub filename: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub media_type: Option<String>,
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Resource {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub document_ids: Vec<DocumentId>,
#[serde(skip_serializing_if = "Option::is_none")]
pub citation: Option<Citation>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub rlink: Vec<Rlink>,
#[serde(skip_serializing_if = "Option::is_none")]
pub base64: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ResourceBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
document_ids: Vec<DocumentId>,
citation: Option<Citation>,
rlink: Vec<Rlink>,
base64: Option<String>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ResourceBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
description: None,
props: Vec::new(),
document_ids: Vec::new(),
citation: None,
rlink: Vec::new(),
base64: None,
remarks: None,
}
}
}
impl Default for ResourceBuilder {
fn default() -> Self {
Self::new()
}
}
impl ResourceBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn document_ids(mut self, v: impl Into<DocumentId>) -> Self {
self.document_ids.push(v.into());
self
}
pub fn citation(mut self, v: impl Into<Citation>) -> Self {
self.citation = Some(v.into());
self
}
pub fn rlink(mut self, v: impl Into<Rlink>) -> Self {
self.rlink.push(v.into());
self
}
pub fn base64(mut self, v: impl Into<String>) -> Self {
self.base64 = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Resource, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
Ok(Resource {
uuid,
title: self.title,
description: self.description,
props: self.props,
document_ids: self.document_ids,
citation: self.citation,
rlink: self.rlink,
base64: self.base64,
remarks: self.remarks,
})
}
}
impl Resource {
pub fn builder() -> ResourceBuilder {
ResourceBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct BackMatter {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub resource: Vec<Resource>,
}
#[must_use]
#[derive(Debug)]
pub struct BackMatterBuilder {
resource: Vec<Resource>,
}
impl BackMatterBuilder {
pub fn new() -> Self {
Self {
resource: Vec::new(),
}
}
}
impl Default for BackMatterBuilder {
fn default() -> Self {
Self::new()
}
}
impl BackMatterBuilder {
pub fn resource(mut self, v: impl Into<Resource>) -> Self {
self.resource.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<BackMatter, BuildError> {
Ok(BackMatter {
resource: self.resource,
})
}
}
impl BackMatter {
pub fn builder() -> BackMatterBuilder {
BackMatterBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Property {
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub uuid: Option<uuid::Uuid>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ns: Option<url::Url>,
pub value: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub class: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub group: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct PropertyBuilder {
name: Option<String>,
uuid: Option<uuid::Uuid>,
ns: Option<url::Url>,
value: Option<String>,
class: Option<String>,
group: Option<String>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl PropertyBuilder {
pub fn new() -> Self {
Self {
name: None,
uuid: None,
ns: None,
value: None,
class: None,
group: None,
remarks: None,
}
}
}
impl Default for PropertyBuilder {
fn default() -> Self {
Self::new()
}
}
impl PropertyBuilder {
pub fn name(mut self, v: impl Into<String>) -> Self {
self.name = Some(v.into());
self
}
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn ns(mut self, v: impl Into<url::Url>) -> Self {
self.ns = Some(v.into());
self
}
pub fn value(mut self, v: impl Into<String>) -> Self {
self.value = Some(v.into());
self
}
pub fn class(mut self, v: impl Into<String>) -> Self {
self.class = Some(v.into());
self
}
pub fn group(mut self, v: impl Into<String>) -> Self {
self.group = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Property, BuildError> {
let name = self
.name
.ok_or_else(|| BuildError::MissingField("required field `name` not set"))?;
let value = self
.value
.ok_or_else(|| BuildError::MissingField("required field `value` not set"))?;
Ok(Property {
name,
uuid: self.uuid,
ns: self.ns,
value,
class: self.class,
group: self.group,
remarks: self.remarks,
})
}
}
impl Property {
pub fn builder() -> PropertyBuilder {
PropertyBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Link {
pub href: crate::primitives::UriReference,
#[serde(skip_serializing_if = "Option::is_none")]
pub rel: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_fragment: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub text: Option<crate::primitives::MarkupLine>,
}
#[must_use]
#[derive(Debug)]
pub struct LinkBuilder {
href: Option<crate::primitives::UriReference>,
rel: Option<String>,
resource_fragment: Option<String>,
text: Option<crate::primitives::MarkupLine>,
}
impl LinkBuilder {
pub fn new() -> Self {
Self {
href: None,
rel: None,
resource_fragment: None,
text: None,
}
}
}
impl Default for LinkBuilder {
fn default() -> Self {
Self::new()
}
}
impl LinkBuilder {
pub fn href(mut self, v: impl Into<crate::primitives::UriReference>) -> Self {
self.href = Some(v.into());
self
}
pub fn rel(mut self, v: impl Into<String>) -> Self {
self.rel = Some(v.into());
self
}
pub fn resource_fragment(mut self, v: impl Into<String>) -> Self {
self.resource_fragment = Some(v.into());
self
}
pub fn text(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.text = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Link, BuildError> {
let href = self
.href
.ok_or_else(|| BuildError::MissingField("required field `href` not set"))?;
Ok(Link {
href,
rel: self.rel,
resource_fragment: self.resource_fragment,
text: self.text,
})
}
}
impl Link {
pub fn builder() -> LinkBuilder {
LinkBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ResponsibleParty {
pub role_id: String,
#[serde(default)]
pub party_uuids: Vec<uuid::Uuid>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ResponsiblePartyBuilder {
role_id: Option<String>,
party_uuids: Vec<uuid::Uuid>,
props: Vec<Property>,
links: Vec<Link>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ResponsiblePartyBuilder {
pub fn new() -> Self {
Self {
role_id: None,
party_uuids: Vec::new(),
props: Vec::new(),
links: Vec::new(),
remarks: None,
}
}
}
impl Default for ResponsiblePartyBuilder {
fn default() -> Self {
Self::new()
}
}
impl ResponsiblePartyBuilder {
pub fn role_id(mut self, v: impl Into<String>) -> Self {
self.role_id = Some(v.into());
self
}
pub fn party_uuids(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.party_uuids.push(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ResponsibleParty, BuildError> {
let role_id = self
.role_id
.ok_or_else(|| BuildError::MissingField("required field `role-id` not set"))?;
Ok(ResponsibleParty {
role_id,
party_uuids: self.party_uuids,
props: self.props,
links: self.links,
remarks: self.remarks,
})
}
}
impl ResponsibleParty {
pub fn builder() -> ResponsiblePartyBuilder {
ResponsiblePartyBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Action {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub date: Option<chrono::DateTime<chrono::Utc>>,
#[serde(rename = "type")]
pub type_: String,
pub system: url::Url,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_parties: Vec<ResponsibleParty>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ActionBuilder {
uuid: Option<uuid::Uuid>,
date: Option<chrono::DateTime<chrono::Utc>>,
type_: Option<String>,
system: Option<url::Url>,
props: Vec<Property>,
links: Vec<Link>,
responsible_parties: Vec<ResponsibleParty>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ActionBuilder {
pub fn new() -> Self {
Self {
uuid: None,
date: None,
type_: None,
system: None,
props: Vec::new(),
links: Vec::new(),
responsible_parties: Vec::new(),
remarks: None,
}
}
}
impl Default for ActionBuilder {
fn default() -> Self {
Self::new()
}
}
impl ActionBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn date(mut self, v: impl Into<chrono::DateTime<chrono::Utc>>) -> Self {
self.date = Some(v.into());
self
}
pub fn type_(mut self, v: impl Into<String>) -> Self {
self.type_ = Some(v.into());
self
}
pub fn system(mut self, v: impl Into<url::Url>) -> Self {
self.system = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn responsible_parties(mut self, v: impl Into<ResponsibleParty>) -> Self {
self.responsible_parties.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Action, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let type_ = self
.type_
.ok_or_else(|| BuildError::MissingField("required field `type` not set"))?;
let system = self
.system
.ok_or_else(|| BuildError::MissingField("required field `system` not set"))?;
Ok(Action {
uuid,
date: self.date,
type_,
system,
props: self.props,
links: self.links,
responsible_parties: self.responsible_parties,
remarks: self.remarks,
})
}
}
impl Action {
pub fn builder() -> ActionBuilder {
ActionBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ResponsibleRole {
pub role_id: String,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub party_uuids: Vec<uuid::Uuid>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ResponsibleRoleBuilder {
role_id: Option<String>,
props: Vec<Property>,
links: Vec<Link>,
party_uuids: Vec<uuid::Uuid>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ResponsibleRoleBuilder {
pub fn new() -> Self {
Self {
role_id: None,
props: Vec::new(),
links: Vec::new(),
party_uuids: Vec::new(),
remarks: None,
}
}
}
impl Default for ResponsibleRoleBuilder {
fn default() -> Self {
Self::new()
}
}
impl ResponsibleRoleBuilder {
pub fn role_id(mut self, v: impl Into<String>) -> Self {
self.role_id = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn party_uuids(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.party_uuids.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ResponsibleRole, BuildError> {
let role_id = self
.role_id
.ok_or_else(|| BuildError::MissingField("required field `role-id` not set"))?;
Ok(ResponsibleRole {
role_id,
props: self.props,
links: self.links,
party_uuids: self.party_uuids,
remarks: self.remarks,
})
}
}
impl ResponsibleRole {
pub fn builder() -> ResponsibleRoleBuilder {
ResponsibleRoleBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct OscalHash {
pub algorithm: String,
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Remarks {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<crate::primitives::MarkupMultiline>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Published {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<chrono::DateTime<chrono::Utc>>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct LastModified {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<chrono::DateTime<chrono::Utc>>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Version {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct OscalVersion {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct EmailAddress {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct TelephoneNumber {
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Address {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub addr_lines: Vec<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub postal_code: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
}
#[must_use]
#[derive(Debug)]
pub struct AddressBuilder {
addr_lines: Vec<String>,
city: Option<String>,
state: Option<String>,
postal_code: Option<String>,
country: Option<String>,
}
impl AddressBuilder {
pub fn new() -> Self {
Self {
addr_lines: Vec::new(),
city: None,
state: None,
postal_code: None,
country: None,
}
}
}
impl Default for AddressBuilder {
fn default() -> Self {
Self::new()
}
}
impl AddressBuilder {
pub fn addr_lines(mut self, v: impl Into<String>) -> Self {
self.addr_lines.push(v.into());
self
}
pub fn city(mut self, v: impl Into<String>) -> Self {
self.city = Some(v.into());
self
}
pub fn state(mut self, v: impl Into<String>) -> Self {
self.state = Some(v.into());
self
}
pub fn postal_code(mut self, v: impl Into<String>) -> Self {
self.postal_code = Some(v.into());
self
}
pub fn country(mut self, v: impl Into<String>) -> Self {
self.country = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Address, BuildError> {
Ok(Address {
addr_lines: self.addr_lines,
city: self.city,
state: self.state,
postal_code: self.postal_code,
country: self.country,
})
}
}
impl Address {
pub fn builder() -> AddressBuilder {
AddressBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AddrLine {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct DocumentId {
#[serde(skip_serializing_if = "Option::is_none")]
pub scheme: Option<url::Url>,
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct SystemComponent {
pub uuid: uuid::Uuid,
pub title: crate::primitives::MarkupLine,
pub description: crate::primitives::MarkupMultiline,
#[serde(skip_serializing_if = "Option::is_none")]
pub purpose: Option<crate::primitives::MarkupLine>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
pub status: Status,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_roles: Vec<ResponsibleRole>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub protocols: Vec<Protocol>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct SystemComponentBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
purpose: Option<crate::primitives::MarkupLine>,
props: Vec<Property>,
links: Vec<Link>,
status: Option<Status>,
responsible_roles: Vec<ResponsibleRole>,
protocols: Vec<Protocol>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl SystemComponentBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
description: None,
purpose: None,
props: Vec::new(),
links: Vec::new(),
status: None,
responsible_roles: Vec::new(),
protocols: Vec::new(),
remarks: None,
}
}
}
impl Default for SystemComponentBuilder {
fn default() -> Self {
Self::new()
}
}
impl SystemComponentBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn purpose(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.purpose = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn status(mut self, v: impl Into<Status>) -> Self {
self.status = Some(v.into());
self
}
pub fn responsible_roles(mut self, v: impl Into<ResponsibleRole>) -> Self {
self.responsible_roles.push(v.into());
self
}
pub fn protocols(mut self, v: impl Into<Protocol>) -> Self {
self.protocols.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<SystemComponent, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
let status = self
.status
.ok_or_else(|| BuildError::MissingField("required field `status` not set"))?;
Ok(SystemComponent {
uuid,
title,
description,
purpose: self.purpose,
props: self.props,
links: self.links,
status,
responsible_roles: self.responsible_roles,
protocols: self.protocols,
remarks: self.remarks,
})
}
}
impl SystemComponent {
pub fn builder() -> SystemComponentBuilder {
SystemComponentBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Protocol {
#[serde(skip_serializing_if = "Option::is_none")]
pub uuid: Option<uuid::Uuid>,
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub port_ranges: Vec<PortRange>,
}
#[must_use]
#[derive(Debug)]
pub struct ProtocolBuilder {
uuid: Option<uuid::Uuid>,
name: Option<String>,
title: Option<crate::primitives::MarkupLine>,
port_ranges: Vec<PortRange>,
}
impl ProtocolBuilder {
pub fn new() -> Self {
Self {
uuid: None,
name: None,
title: None,
port_ranges: Vec::new(),
}
}
}
impl Default for ProtocolBuilder {
fn default() -> Self {
Self::new()
}
}
impl ProtocolBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn name(mut self, v: impl Into<String>) -> Self {
self.name = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn port_ranges(mut self, v: impl Into<PortRange>) -> Self {
self.port_ranges.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Protocol, BuildError> {
Ok(Protocol {
uuid: self.uuid,
name: self.name,
title: self.title,
port_ranges: self.port_ranges,
})
}
}
impl Protocol {
pub fn builder() -> ProtocolBuilder {
ProtocolBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct PortRange {
#[serde(skip_serializing_if = "Option::is_none")]
pub start: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub end: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub transport: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct PortRangeBuilder {
start: Option<u64>,
end: Option<u64>,
transport: Option<String>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl PortRangeBuilder {
pub fn new() -> Self {
Self {
start: None,
end: None,
transport: None,
remarks: None,
}
}
}
impl Default for PortRangeBuilder {
fn default() -> Self {
Self::new()
}
}
impl PortRangeBuilder {
pub fn start(mut self, v: impl Into<u64>) -> Self {
self.start = Some(v.into());
self
}
pub fn end(mut self, v: impl Into<u64>) -> Self {
self.end = Some(v.into());
self
}
pub fn transport(mut self, v: impl Into<String>) -> Self {
self.transport = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<PortRange, BuildError> {
Ok(PortRange {
start: self.start,
end: self.end,
transport: self.transport,
remarks: self.remarks,
})
}
}
impl PortRange {
pub fn builder() -> PortRangeBuilder {
PortRangeBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ImplementationStatus {
pub state: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ImplementationStatusBuilder {
state: Option<String>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ImplementationStatusBuilder {
pub fn new() -> Self {
Self {
state: None,
remarks: None,
}
}
}
impl Default for ImplementationStatusBuilder {
fn default() -> Self {
Self::new()
}
}
impl ImplementationStatusBuilder {
pub fn state(mut self, v: impl Into<String>) -> Self {
self.state = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ImplementationStatus, BuildError> {
let state = self
.state
.ok_or_else(|| BuildError::MissingField("required field `state` not set"))?;
Ok(ImplementationStatus {
state,
remarks: self.remarks,
})
}
}
impl ImplementationStatus {
pub fn builder() -> ImplementationStatusBuilder {
ImplementationStatusBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct SystemUser {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
#[serde(skip_serializing_if = "Option::is_none")]
pub short_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub role_ids: Vec<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub authorized_privileges: Vec<AuthorizedPrivilege>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct SystemUserBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
short_name: Option<String>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
role_ids: Vec<String>,
authorized_privileges: Vec<AuthorizedPrivilege>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl SystemUserBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
short_name: None,
description: None,
props: Vec::new(),
links: Vec::new(),
role_ids: Vec::new(),
authorized_privileges: Vec::new(),
remarks: None,
}
}
}
impl Default for SystemUserBuilder {
fn default() -> Self {
Self::new()
}
}
impl SystemUserBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn short_name(mut self, v: impl Into<String>) -> Self {
self.short_name = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn role_ids(mut self, v: impl Into<String>) -> Self {
self.role_ids.push(v.into());
self
}
pub fn authorized_privileges(mut self, v: impl Into<AuthorizedPrivilege>) -> Self {
self.authorized_privileges.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<SystemUser, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
Ok(SystemUser {
uuid,
title: self.title,
short_name: self.short_name,
description: self.description,
props: self.props,
links: self.links,
role_ids: self.role_ids,
authorized_privileges: self.authorized_privileges,
remarks: self.remarks,
})
}
}
impl SystemUser {
pub fn builder() -> SystemUserBuilder {
SystemUserBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AuthorizedPrivilege {
pub title: crate::primitives::MarkupLine,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default)]
pub functions_performed: Vec<String>,
}
#[must_use]
#[derive(Debug)]
pub struct AuthorizedPrivilegeBuilder {
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
functions_performed: Vec<String>,
}
impl AuthorizedPrivilegeBuilder {
pub fn new() -> Self {
Self {
title: None,
description: None,
functions_performed: Vec::new(),
}
}
}
impl Default for AuthorizedPrivilegeBuilder {
fn default() -> Self {
Self::new()
}
}
impl AuthorizedPrivilegeBuilder {
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn functions_performed(mut self, v: impl Into<String>) -> Self {
self.functions_performed.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<AuthorizedPrivilege, BuildError> {
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
Ok(AuthorizedPrivilege {
title,
description: self.description,
functions_performed: self.functions_performed,
})
}
}
impl AuthorizedPrivilege {
pub fn builder() -> AuthorizedPrivilegeBuilder {
AuthorizedPrivilegeBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct FunctionPerformed {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ImplementedComponent {
pub component_uuid: uuid::Uuid,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_parties: Vec<ResponsibleParty>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ImplementedComponentBuilder {
component_uuid: Option<uuid::Uuid>,
props: Vec<Property>,
links: Vec<Link>,
responsible_parties: Vec<ResponsibleParty>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ImplementedComponentBuilder {
pub fn new() -> Self {
Self {
component_uuid: None,
props: Vec::new(),
links: Vec::new(),
responsible_parties: Vec::new(),
remarks: None,
}
}
}
impl Default for ImplementedComponentBuilder {
fn default() -> Self {
Self::new()
}
}
impl ImplementedComponentBuilder {
pub fn component_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.component_uuid = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn responsible_parties(mut self, v: impl Into<ResponsibleParty>) -> Self {
self.responsible_parties.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ImplementedComponent, BuildError> {
let component_uuid = self
.component_uuid
.ok_or_else(|| BuildError::MissingField("required field `component-uuid` not set"))?;
Ok(ImplementedComponent {
component_uuid,
props: self.props,
links: self.links,
responsible_parties: self.responsible_parties,
remarks: self.remarks,
})
}
}
impl ImplementedComponent {
pub fn builder() -> ImplementedComponentBuilder {
ImplementedComponentBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct InventoryItem {
pub uuid: uuid::Uuid,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_parties: Vec<ResponsibleParty>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub implemented_component: Vec<ImplementedComponent>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct InventoryItemBuilder {
uuid: Option<uuid::Uuid>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
responsible_parties: Vec<ResponsibleParty>,
implemented_component: Vec<ImplementedComponent>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl InventoryItemBuilder {
pub fn new() -> Self {
Self {
uuid: None,
description: None,
props: Vec::new(),
links: Vec::new(),
responsible_parties: Vec::new(),
implemented_component: Vec::new(),
remarks: None,
}
}
}
impl Default for InventoryItemBuilder {
fn default() -> Self {
Self::new()
}
}
impl InventoryItemBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn responsible_parties(mut self, v: impl Into<ResponsibleParty>) -> Self {
self.responsible_parties.push(v.into());
self
}
pub fn implemented_component(mut self, v: impl Into<ImplementedComponent>) -> Self {
self.implemented_component.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<InventoryItem, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(InventoryItem {
uuid,
description,
props: self.props,
links: self.links,
responsible_parties: self.responsible_parties,
implemented_component: self.implemented_component,
remarks: self.remarks,
})
}
}
impl InventoryItem {
pub fn builder() -> InventoryItemBuilder {
InventoryItemBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct SetParameter {
pub param_id: String,
#[serde(default)]
pub value: Vec<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct SetParameterBuilder {
param_id: Option<String>,
value: Vec<String>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl SetParameterBuilder {
pub fn new() -> Self {
Self {
param_id: None,
value: Vec::new(),
remarks: None,
}
}
}
impl Default for SetParameterBuilder {
fn default() -> Self {
Self::new()
}
}
impl SetParameterBuilder {
pub fn param_id(mut self, v: impl Into<String>) -> Self {
self.param_id = Some(v.into());
self
}
pub fn value(mut self, v: impl Into<String>) -> Self {
self.value.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<SetParameter, BuildError> {
let param_id = self
.param_id
.ok_or_else(|| BuildError::MissingField("required field `param-id` not set"))?;
Ok(SetParameter {
param_id,
value: self.value,
remarks: self.remarks,
})
}
}
impl SetParameter {
pub fn builder() -> SetParameterBuilder {
SetParameterBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct SystemId {
#[serde(skip_serializing_if = "Option::is_none")]
pub identifier_type: Option<url::Url>,
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct LocalDefinitions {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub components: Vec<SystemComponent>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub inventory_items: Vec<InventoryItem>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub users: Vec<SystemUser>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub objectives_and_methods: Vec<LocalObjective>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub activities: Vec<Activity>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct LocalDefinitionsBuilder {
components: Vec<SystemComponent>,
inventory_items: Vec<InventoryItem>,
users: Vec<SystemUser>,
objectives_and_methods: Vec<LocalObjective>,
activities: Vec<Activity>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl LocalDefinitionsBuilder {
pub fn new() -> Self {
Self {
components: Vec::new(),
inventory_items: Vec::new(),
users: Vec::new(),
objectives_and_methods: Vec::new(),
activities: Vec::new(),
remarks: None,
}
}
}
impl Default for LocalDefinitionsBuilder {
fn default() -> Self {
Self::new()
}
}
impl LocalDefinitionsBuilder {
pub fn components(mut self, v: impl Into<SystemComponent>) -> Self {
self.components.push(v.into());
self
}
pub fn inventory_items(mut self, v: impl Into<InventoryItem>) -> Self {
self.inventory_items.push(v.into());
self
}
pub fn users(mut self, v: impl Into<SystemUser>) -> Self {
self.users.push(v.into());
self
}
pub fn objectives_and_methods(mut self, v: impl Into<LocalObjective>) -> Self {
self.objectives_and_methods.push(v.into());
self
}
pub fn activities(mut self, v: impl Into<Activity>) -> Self {
self.activities.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<LocalDefinitions, BuildError> {
Ok(LocalDefinitions {
components: self.components,
inventory_items: self.inventory_items,
users: self.users,
objectives_and_methods: self.objectives_and_methods,
activities: self.activities,
remarks: self.remarks,
})
}
}
impl LocalDefinitions {
pub fn builder() -> LocalDefinitionsBuilder {
LocalDefinitionsBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct TermsAndConditions {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub parts: Vec<AssessmentPart>,
}
#[must_use]
#[derive(Debug)]
pub struct TermsAndConditionsBuilder {
parts: Vec<AssessmentPart>,
}
impl TermsAndConditionsBuilder {
pub fn new() -> Self {
Self { parts: Vec::new() }
}
}
impl Default for TermsAndConditionsBuilder {
fn default() -> Self {
Self::new()
}
}
impl TermsAndConditionsBuilder {
pub fn parts(mut self, v: impl Into<AssessmentPart>) -> Self {
self.parts.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<TermsAndConditions, BuildError> {
Ok(TermsAndConditions { parts: self.parts })
}
}
impl TermsAndConditions {
pub fn builder() -> TermsAndConditionsBuilder {
TermsAndConditionsBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AssessmentPlan {
pub uuid: uuid::Uuid,
pub metadata: Metadata,
pub import_ssp: ImportSsp,
#[serde(skip_serializing_if = "Option::is_none")]
pub local_definitions: Option<LocalDefinitions>,
#[serde(skip_serializing_if = "Option::is_none")]
pub terms_and_conditions: Option<TermsAndConditions>,
pub reviewed_controls: ReviewedControls,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub assessment_subjects: Vec<AssessmentSubject>,
#[serde(skip_serializing_if = "Option::is_none")]
pub assessment_assets: Option<AssessmentAssets>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub tasks: Vec<Task>,
#[serde(skip_serializing_if = "Option::is_none")]
pub back_matter: Option<BackMatter>,
}
#[must_use]
#[derive(Debug)]
pub struct AssessmentPlanBuilder {
uuid: Option<uuid::Uuid>,
metadata: Option<Metadata>,
import_ssp: Option<ImportSsp>,
local_definitions: Option<LocalDefinitions>,
terms_and_conditions: Option<TermsAndConditions>,
reviewed_controls: Option<ReviewedControls>,
assessment_subjects: Vec<AssessmentSubject>,
assessment_assets: Option<AssessmentAssets>,
tasks: Vec<Task>,
back_matter: Option<BackMatter>,
}
impl AssessmentPlanBuilder {
pub fn new() -> Self {
Self {
uuid: None,
metadata: None,
import_ssp: None,
local_definitions: None,
terms_and_conditions: None,
reviewed_controls: None,
assessment_subjects: Vec::new(),
assessment_assets: None,
tasks: Vec::new(),
back_matter: None,
}
}
}
impl Default for AssessmentPlanBuilder {
fn default() -> Self {
Self::new()
}
}
impl AssessmentPlanBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn metadata(mut self, v: impl Into<Metadata>) -> Self {
self.metadata = Some(v.into());
self
}
pub fn import_ssp(mut self, v: impl Into<ImportSsp>) -> Self {
self.import_ssp = Some(v.into());
self
}
pub fn local_definitions(mut self, v: impl Into<LocalDefinitions>) -> Self {
self.local_definitions = Some(v.into());
self
}
pub fn terms_and_conditions(mut self, v: impl Into<TermsAndConditions>) -> Self {
self.terms_and_conditions = Some(v.into());
self
}
pub fn reviewed_controls(mut self, v: impl Into<ReviewedControls>) -> Self {
self.reviewed_controls = Some(v.into());
self
}
pub fn assessment_subjects(mut self, v: impl Into<AssessmentSubject>) -> Self {
self.assessment_subjects.push(v.into());
self
}
pub fn assessment_assets(mut self, v: impl Into<AssessmentAssets>) -> Self {
self.assessment_assets = Some(v.into());
self
}
pub fn tasks(mut self, v: impl Into<Task>) -> Self {
self.tasks.push(v.into());
self
}
pub fn back_matter(mut self, v: impl Into<BackMatter>) -> Self {
self.back_matter = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<AssessmentPlan, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let metadata = self
.metadata
.ok_or_else(|| BuildError::MissingField("required field `metadata` not set"))?;
let import_ssp = self
.import_ssp
.ok_or_else(|| BuildError::MissingField("required field `import-ssp` not set"))?;
let reviewed_controls = self.reviewed_controls.ok_or_else(|| {
BuildError::MissingField("required field `reviewed-controls` not set")
})?;
Ok(AssessmentPlan {
uuid,
metadata,
import_ssp,
local_definitions: self.local_definitions,
terms_and_conditions: self.terms_and_conditions,
reviewed_controls,
assessment_subjects: self.assessment_subjects,
assessment_assets: self.assessment_assets,
tasks: self.tasks,
back_matter: self.back_matter,
})
}
}
impl AssessmentPlan {
pub fn builder() -> AssessmentPlanBuilder {
AssessmentPlanBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AssessmentResults {
pub uuid: uuid::Uuid,
pub metadata: Metadata,
pub import_ap: ImportAp,
#[serde(skip_serializing_if = "Option::is_none")]
pub local_definitions: Option<LocalDefinitions>,
#[serde(default)]
pub results: Vec<OscalResult>,
#[serde(skip_serializing_if = "Option::is_none")]
pub back_matter: Option<BackMatter>,
}
#[must_use]
#[derive(Debug)]
pub struct AssessmentResultsBuilder {
uuid: Option<uuid::Uuid>,
metadata: Option<Metadata>,
import_ap: Option<ImportAp>,
local_definitions: Option<LocalDefinitions>,
results: Vec<OscalResult>,
back_matter: Option<BackMatter>,
}
impl AssessmentResultsBuilder {
pub fn new() -> Self {
Self {
uuid: None,
metadata: None,
import_ap: None,
local_definitions: None,
results: Vec::new(),
back_matter: None,
}
}
}
impl Default for AssessmentResultsBuilder {
fn default() -> Self {
Self::new()
}
}
impl AssessmentResultsBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn metadata(mut self, v: impl Into<Metadata>) -> Self {
self.metadata = Some(v.into());
self
}
pub fn import_ap(mut self, v: impl Into<ImportAp>) -> Self {
self.import_ap = Some(v.into());
self
}
pub fn local_definitions(mut self, v: impl Into<LocalDefinitions>) -> Self {
self.local_definitions = Some(v.into());
self
}
pub fn results(mut self, v: impl Into<OscalResult>) -> Self {
self.results.push(v.into());
self
}
pub fn back_matter(mut self, v: impl Into<BackMatter>) -> Self {
self.back_matter = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<AssessmentResults, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let metadata = self
.metadata
.ok_or_else(|| BuildError::MissingField("required field `metadata` not set"))?;
let import_ap = self
.import_ap
.ok_or_else(|| BuildError::MissingField("required field `import-ap` not set"))?;
Ok(AssessmentResults {
uuid,
metadata,
import_ap,
local_definitions: self.local_definitions,
results: self.results,
back_matter: self.back_matter,
})
}
}
impl AssessmentResults {
pub fn builder() -> AssessmentResultsBuilder {
AssessmentResultsBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Attestation {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_parties: Vec<ResponsibleParty>,
#[serde(default)]
pub parts: Vec<AssessmentPart>,
}
#[must_use]
#[derive(Debug)]
pub struct AttestationBuilder {
responsible_parties: Vec<ResponsibleParty>,
parts: Vec<AssessmentPart>,
}
impl AttestationBuilder {
pub fn new() -> Self {
Self {
responsible_parties: Vec::new(),
parts: Vec::new(),
}
}
}
impl Default for AttestationBuilder {
fn default() -> Self {
Self::new()
}
}
impl AttestationBuilder {
pub fn responsible_parties(mut self, v: impl Into<ResponsibleParty>) -> Self {
self.responsible_parties.push(v.into());
self
}
pub fn parts(mut self, v: impl Into<AssessmentPart>) -> Self {
self.parts.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Attestation, BuildError> {
Ok(Attestation {
responsible_parties: self.responsible_parties,
parts: self.parts,
})
}
}
impl Attestation {
pub fn builder() -> AttestationBuilder {
AttestationBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AssessmentLog {
#[serde(default)]
pub entry: Vec<Entry>,
}
#[must_use]
#[derive(Debug)]
pub struct AssessmentLogBuilder {
entry: Vec<Entry>,
}
impl AssessmentLogBuilder {
pub fn new() -> Self {
Self { entry: Vec::new() }
}
}
impl Default for AssessmentLogBuilder {
fn default() -> Self {
Self::new()
}
}
impl AssessmentLogBuilder {
pub fn entry(mut self, v: impl Into<Entry>) -> Self {
self.entry.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<AssessmentLog, BuildError> {
Ok(AssessmentLog { entry: self.entry })
}
}
impl AssessmentLog {
pub fn builder() -> AssessmentLogBuilder {
AssessmentLogBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct OscalResult {
pub uuid: uuid::Uuid,
pub title: crate::primitives::MarkupLine,
pub description: crate::primitives::MarkupMultiline,
pub start: chrono::DateTime<chrono::Utc>,
#[serde(skip_serializing_if = "Option::is_none")]
pub end: Option<chrono::DateTime<chrono::Utc>>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub local_definitions: Option<LocalDefinitions>,
pub reviewed_controls: ReviewedControls,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub attestation: Vec<Attestation>,
#[serde(skip_serializing_if = "Option::is_none")]
pub assessment_log: Option<AssessmentLog>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub observations: Vec<Observation>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub risks: Vec<Risk>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub findings: Vec<Finding>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct OscalResultBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
start: Option<chrono::DateTime<chrono::Utc>>,
end: Option<chrono::DateTime<chrono::Utc>>,
props: Vec<Property>,
links: Vec<Link>,
local_definitions: Option<LocalDefinitions>,
reviewed_controls: Option<ReviewedControls>,
attestation: Vec<Attestation>,
assessment_log: Option<AssessmentLog>,
observations: Vec<Observation>,
risks: Vec<Risk>,
findings: Vec<Finding>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl OscalResultBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
description: None,
start: None,
end: None,
props: Vec::new(),
links: Vec::new(),
local_definitions: None,
reviewed_controls: None,
attestation: Vec::new(),
assessment_log: None,
observations: Vec::new(),
risks: Vec::new(),
findings: Vec::new(),
remarks: None,
}
}
}
impl Default for OscalResultBuilder {
fn default() -> Self {
Self::new()
}
}
impl OscalResultBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn start(mut self, v: impl Into<chrono::DateTime<chrono::Utc>>) -> Self {
self.start = Some(v.into());
self
}
pub fn end(mut self, v: impl Into<chrono::DateTime<chrono::Utc>>) -> Self {
self.end = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn local_definitions(mut self, v: impl Into<LocalDefinitions>) -> Self {
self.local_definitions = Some(v.into());
self
}
pub fn reviewed_controls(mut self, v: impl Into<ReviewedControls>) -> Self {
self.reviewed_controls = Some(v.into());
self
}
pub fn attestation(mut self, v: impl Into<Attestation>) -> Self {
self.attestation.push(v.into());
self
}
pub fn assessment_log(mut self, v: impl Into<AssessmentLog>) -> Self {
self.assessment_log = Some(v.into());
self
}
pub fn observations(mut self, v: impl Into<Observation>) -> Self {
self.observations.push(v.into());
self
}
pub fn risks(mut self, v: impl Into<Risk>) -> Self {
self.risks.push(v.into());
self
}
pub fn findings(mut self, v: impl Into<Finding>) -> Self {
self.findings.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<OscalResult, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
let start = self
.start
.ok_or_else(|| BuildError::MissingField("required field `start` not set"))?;
let reviewed_controls = self.reviewed_controls.ok_or_else(|| {
BuildError::MissingField("required field `reviewed-controls` not set")
})?;
Ok(OscalResult {
uuid,
title,
description,
start,
end: self.end,
props: self.props,
links: self.links,
local_definitions: self.local_definitions,
reviewed_controls,
attestation: self.attestation,
assessment_log: self.assessment_log,
observations: self.observations,
risks: self.risks,
findings: self.findings,
remarks: self.remarks,
})
}
}
impl OscalResult {
pub fn builder() -> OscalResultBuilder {
OscalResultBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ImportAp {
pub href: crate::primitives::UriReference,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ImportApBuilder {
href: Option<crate::primitives::UriReference>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ImportApBuilder {
pub fn new() -> Self {
Self {
href: None,
remarks: None,
}
}
}
impl Default for ImportApBuilder {
fn default() -> Self {
Self::new()
}
}
impl ImportApBuilder {
pub fn href(mut self, v: impl Into<crate::primitives::UriReference>) -> Self {
self.href = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ImportAp, BuildError> {
let href = self
.href
.ok_or_else(|| BuildError::MissingField("required field `href` not set"))?;
Ok(ImportAp {
href,
remarks: self.remarks,
})
}
}
impl ImportAp {
pub fn builder() -> ImportApBuilder {
ImportApBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Catalog {
pub uuid: uuid::Uuid,
pub metadata: Metadata,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub params: Vec<Parameter>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub controls: Vec<Control>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub groups: Vec<Group>,
#[serde(skip_serializing_if = "Option::is_none")]
pub back_matter: Option<BackMatter>,
}
#[must_use]
#[derive(Debug)]
pub struct CatalogBuilder {
uuid: Option<uuid::Uuid>,
metadata: Option<Metadata>,
params: Vec<Parameter>,
controls: Vec<Control>,
groups: Vec<Group>,
back_matter: Option<BackMatter>,
}
impl CatalogBuilder {
pub fn new() -> Self {
Self {
uuid: None,
metadata: None,
params: Vec::new(),
controls: Vec::new(),
groups: Vec::new(),
back_matter: None,
}
}
}
impl Default for CatalogBuilder {
fn default() -> Self {
Self::new()
}
}
impl CatalogBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn metadata(mut self, v: impl Into<Metadata>) -> Self {
self.metadata = Some(v.into());
self
}
pub fn params(mut self, v: impl Into<Parameter>) -> Self {
self.params.push(v.into());
self
}
pub fn controls(mut self, v: impl Into<Control>) -> Self {
self.controls.push(v.into());
self
}
pub fn groups(mut self, v: impl Into<Group>) -> Self {
self.groups.push(v.into());
self
}
pub fn back_matter(mut self, v: impl Into<BackMatter>) -> Self {
self.back_matter = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Catalog, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let metadata = self
.metadata
.ok_or_else(|| BuildError::MissingField("required field `metadata` not set"))?;
Ok(Catalog {
uuid,
metadata,
params: self.params,
controls: self.controls,
groups: self.groups,
back_matter: self.back_matter,
})
}
}
impl Catalog {
pub fn builder() -> CatalogBuilder {
CatalogBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GroupChoice1 {
Group(Vec<Group>),
Control(Vec<Control>),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Group {
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub class: Option<String>,
pub title: crate::primitives::MarkupLine,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub params: Vec<Parameter>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub parts: Vec<Part>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub groups: Vec<Group>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub controls: Vec<Control>,
}
#[must_use]
#[derive(Debug)]
pub struct GroupBuilder {
id: Option<String>,
class: Option<String>,
title: Option<crate::primitives::MarkupLine>,
params: Vec<Parameter>,
props: Vec<Property>,
links: Vec<Link>,
parts: Vec<Part>,
groups: Vec<Group>,
controls: Vec<Control>,
}
impl GroupBuilder {
pub fn new() -> Self {
Self {
id: None,
class: None,
title: None,
params: Vec::new(),
props: Vec::new(),
links: Vec::new(),
parts: Vec::new(),
groups: Vec::new(),
controls: Vec::new(),
}
}
}
impl Default for GroupBuilder {
fn default() -> Self {
Self::new()
}
}
impl GroupBuilder {
pub fn id(mut self, v: impl Into<String>) -> Self {
self.id = Some(v.into());
self
}
pub fn class(mut self, v: impl Into<String>) -> Self {
self.class = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn params(mut self, v: impl Into<Parameter>) -> Self {
self.params.push(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn parts(mut self, v: impl Into<Part>) -> Self {
self.parts.push(v.into());
self
}
pub fn groups(mut self, v: impl Into<Group>) -> Self {
self.groups.push(v.into());
self
}
pub fn controls(mut self, v: impl Into<Control>) -> Self {
self.controls.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Group, BuildError> {
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
Ok(Group {
id: self.id,
class: self.class,
title,
params: self.params,
props: self.props,
links: self.links,
parts: self.parts,
groups: self.groups,
controls: self.controls,
})
}
}
impl Group {
pub fn builder() -> GroupBuilder {
GroupBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Control {
pub id: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub class: Option<String>,
pub title: crate::primitives::MarkupLine,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub params: Vec<Parameter>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub parts: Vec<Part>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub controls: Vec<Control>,
}
#[must_use]
#[derive(Debug)]
pub struct ControlBuilder {
id: Option<String>,
class: Option<String>,
title: Option<crate::primitives::MarkupLine>,
params: Vec<Parameter>,
props: Vec<Property>,
links: Vec<Link>,
parts: Vec<Part>,
controls: Vec<Control>,
}
impl ControlBuilder {
pub fn new() -> Self {
Self {
id: None,
class: None,
title: None,
params: Vec::new(),
props: Vec::new(),
links: Vec::new(),
parts: Vec::new(),
controls: Vec::new(),
}
}
}
impl Default for ControlBuilder {
fn default() -> Self {
Self::new()
}
}
impl ControlBuilder {
pub fn id(mut self, v: impl Into<String>) -> Self {
self.id = Some(v.into());
self
}
pub fn class(mut self, v: impl Into<String>) -> Self {
self.class = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn params(mut self, v: impl Into<Parameter>) -> Self {
self.params.push(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn parts(mut self, v: impl Into<Part>) -> Self {
self.parts.push(v.into());
self
}
pub fn controls(mut self, v: impl Into<Control>) -> Self {
self.controls.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Control, BuildError> {
let id = self
.id
.ok_or_else(|| BuildError::MissingField("required field `id` not set"))?;
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
Ok(Control {
id,
class: self.class,
title,
params: self.params,
props: self.props,
links: self.links,
parts: self.parts,
controls: self.controls,
})
}
}
impl Control {
pub fn builder() -> ControlBuilder {
ControlBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Profile {
pub uuid: uuid::Uuid,
pub metadata: Metadata,
#[serde(default)]
pub imports: Vec<Import>,
#[serde(skip_serializing_if = "Option::is_none")]
pub merge: Option<Merge>,
#[serde(skip_serializing_if = "Option::is_none")]
pub modify: Option<Modify>,
#[serde(skip_serializing_if = "Option::is_none")]
pub back_matter: Option<BackMatter>,
}
#[must_use]
#[derive(Debug)]
pub struct ProfileBuilder {
uuid: Option<uuid::Uuid>,
metadata: Option<Metadata>,
imports: Vec<Import>,
merge: Option<Merge>,
modify: Option<Modify>,
back_matter: Option<BackMatter>,
}
impl ProfileBuilder {
pub fn new() -> Self {
Self {
uuid: None,
metadata: None,
imports: Vec::new(),
merge: None,
modify: None,
back_matter: None,
}
}
}
impl Default for ProfileBuilder {
fn default() -> Self {
Self::new()
}
}
impl ProfileBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn metadata(mut self, v: impl Into<Metadata>) -> Self {
self.metadata = Some(v.into());
self
}
pub fn imports(mut self, v: impl Into<Import>) -> Self {
self.imports.push(v.into());
self
}
pub fn merge(mut self, v: impl Into<Merge>) -> Self {
self.merge = Some(v.into());
self
}
pub fn modify(mut self, v: impl Into<Modify>) -> Self {
self.modify = Some(v.into());
self
}
pub fn back_matter(mut self, v: impl Into<BackMatter>) -> Self {
self.back_matter = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Profile, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let metadata = self
.metadata
.ok_or_else(|| BuildError::MissingField("required field `metadata` not set"))?;
Ok(Profile {
uuid,
metadata,
imports: self.imports,
merge: self.merge,
modify: self.modify,
back_matter: self.back_matter,
})
}
}
impl Profile {
pub fn builder() -> ProfileBuilder {
ProfileBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ImportChoice1 {
IncludeAll(IncludeAll),
SelectControlById(Vec<SelectControlById>),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Import {
pub href: crate::primitives::UriReference,
#[serde(skip_serializing_if = "Option::is_none")]
pub import_choice1: Option<ImportChoice1>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub exclude_controls: Vec<SelectControlById>,
}
#[must_use]
#[derive(Debug)]
pub struct ImportBuilder {
href: Option<crate::primitives::UriReference>,
import_choice1: Option<ImportChoice1>,
exclude_controls: Vec<SelectControlById>,
}
impl ImportBuilder {
pub fn new() -> Self {
Self {
href: None,
import_choice1: None,
exclude_controls: Vec::new(),
}
}
}
impl Default for ImportBuilder {
fn default() -> Self {
Self::new()
}
}
impl ImportBuilder {
pub fn href(mut self, v: impl Into<crate::primitives::UriReference>) -> Self {
self.href = Some(v.into());
self
}
pub fn import_choice1(mut self, v: impl Into<ImportChoice1>) -> Self {
self.import_choice1 = Some(v.into());
self
}
pub fn exclude_controls(mut self, v: impl Into<SelectControlById>) -> Self {
self.exclude_controls.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Import, BuildError> {
let href = self
.href
.ok_or_else(|| BuildError::MissingField("required field `href` not set"))?;
Ok(Import {
href,
import_choice1: self.import_choice1,
exclude_controls: self.exclude_controls,
})
}
}
impl Import {
pub fn builder() -> ImportBuilder {
ImportBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Combine {
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
}
#[must_use]
#[derive(Debug)]
pub struct CombineBuilder {
method: Option<String>,
}
impl CombineBuilder {
pub fn new() -> Self {
Self { method: None }
}
}
impl Default for CombineBuilder {
fn default() -> Self {
Self::new()
}
}
impl CombineBuilder {
pub fn method(mut self, v: impl Into<String>) -> Self {
self.method = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Combine, BuildError> {
Ok(Combine {
method: self.method,
})
}
}
impl Combine {
pub fn builder() -> CombineBuilder {
CombineBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MergeChoice1 {}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Merge {
#[serde(skip_serializing_if = "Option::is_none")]
pub combine: Option<Combine>,
#[serde(skip_serializing_if = "Option::is_none")]
pub merge_choice1: Option<MergeChoice1>,
}
#[must_use]
#[derive(Debug)]
pub struct MergeBuilder {
combine: Option<Combine>,
merge_choice1: Option<MergeChoice1>,
}
impl MergeBuilder {
pub fn new() -> Self {
Self {
combine: None,
merge_choice1: None,
}
}
}
impl Default for MergeBuilder {
fn default() -> Self {
Self::new()
}
}
impl MergeBuilder {
pub fn combine(mut self, v: impl Into<Combine>) -> Self {
self.combine = Some(v.into());
self
}
pub fn merge_choice1(mut self, v: impl Into<MergeChoice1>) -> Self {
self.merge_choice1 = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Merge, BuildError> {
Ok(Merge {
combine: self.combine,
merge_choice1: self.merge_choice1,
})
}
}
impl Merge {
pub fn builder() -> MergeBuilder {
MergeBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Remove {
#[serde(skip_serializing_if = "Option::is_none")]
pub by_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub by_class: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub by_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub by_item_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub by_ns: Option<url::Url>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct RemoveBuilder {
by_name: Option<String>,
by_class: Option<String>,
by_id: Option<String>,
by_item_name: Option<String>,
by_ns: Option<url::Url>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl RemoveBuilder {
pub fn new() -> Self {
Self {
by_name: None,
by_class: None,
by_id: None,
by_item_name: None,
by_ns: None,
remarks: None,
}
}
}
impl Default for RemoveBuilder {
fn default() -> Self {
Self::new()
}
}
impl RemoveBuilder {
pub fn by_name(mut self, v: impl Into<String>) -> Self {
self.by_name = Some(v.into());
self
}
pub fn by_class(mut self, v: impl Into<String>) -> Self {
self.by_class = Some(v.into());
self
}
pub fn by_id(mut self, v: impl Into<String>) -> Self {
self.by_id = Some(v.into());
self
}
pub fn by_item_name(mut self, v: impl Into<String>) -> Self {
self.by_item_name = Some(v.into());
self
}
pub fn by_ns(mut self, v: impl Into<url::Url>) -> Self {
self.by_ns = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Remove, BuildError> {
Ok(Remove {
by_name: self.by_name,
by_class: self.by_class,
by_id: self.by_id,
by_item_name: self.by_item_name,
by_ns: self.by_ns,
remarks: self.remarks,
})
}
}
impl Remove {
pub fn builder() -> RemoveBuilder {
RemoveBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Add {
#[serde(skip_serializing_if = "Option::is_none")]
pub position: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub by_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<crate::primitives::MarkupLine>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub params: Vec<Parameter>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub parts: Vec<Part>,
}
#[must_use]
#[derive(Debug)]
pub struct AddBuilder {
position: Option<String>,
by_id: Option<String>,
title: Option<crate::primitives::MarkupLine>,
params: Vec<Parameter>,
props: Vec<Property>,
links: Vec<Link>,
parts: Vec<Part>,
}
impl AddBuilder {
pub fn new() -> Self {
Self {
position: None,
by_id: None,
title: None,
params: Vec::new(),
props: Vec::new(),
links: Vec::new(),
parts: Vec::new(),
}
}
}
impl Default for AddBuilder {
fn default() -> Self {
Self::new()
}
}
impl AddBuilder {
pub fn position(mut self, v: impl Into<String>) -> Self {
self.position = Some(v.into());
self
}
pub fn by_id(mut self, v: impl Into<String>) -> Self {
self.by_id = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn params(mut self, v: impl Into<Parameter>) -> Self {
self.params.push(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn parts(mut self, v: impl Into<Part>) -> Self {
self.parts.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Add, BuildError> {
Ok(Add {
position: self.position,
by_id: self.by_id,
title: self.title,
params: self.params,
props: self.props,
links: self.links,
parts: self.parts,
})
}
}
impl Add {
pub fn builder() -> AddBuilder {
AddBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Alter {
pub control_id: String,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub remove: Vec<Remove>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub add: Vec<Add>,
}
#[must_use]
#[derive(Debug)]
pub struct AlterBuilder {
control_id: Option<String>,
remove: Vec<Remove>,
add: Vec<Add>,
}
impl AlterBuilder {
pub fn new() -> Self {
Self {
control_id: None,
remove: Vec::new(),
add: Vec::new(),
}
}
}
impl Default for AlterBuilder {
fn default() -> Self {
Self::new()
}
}
impl AlterBuilder {
pub fn control_id(mut self, v: impl Into<String>) -> Self {
self.control_id = Some(v.into());
self
}
pub fn remove(mut self, v: impl Into<Remove>) -> Self {
self.remove.push(v.into());
self
}
pub fn add(mut self, v: impl Into<Add>) -> Self {
self.add.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Alter, BuildError> {
let control_id = self
.control_id
.ok_or_else(|| BuildError::MissingField("required field `control-id` not set"))?;
Ok(Alter {
control_id,
remove: self.remove,
add: self.add,
})
}
}
impl Alter {
pub fn builder() -> AlterBuilder {
AlterBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Modify {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub set_parameter: Vec<SetParameter>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub alter: Vec<Alter>,
}
#[must_use]
#[derive(Debug)]
pub struct ModifyBuilder {
set_parameter: Vec<SetParameter>,
alter: Vec<Alter>,
}
impl ModifyBuilder {
pub fn new() -> Self {
Self {
set_parameter: Vec::new(),
alter: Vec::new(),
}
}
}
impl Default for ModifyBuilder {
fn default() -> Self {
Self::new()
}
}
impl ModifyBuilder {
pub fn set_parameter(mut self, v: impl Into<SetParameter>) -> Self {
self.set_parameter.push(v.into());
self
}
pub fn alter(mut self, v: impl Into<Alter>) -> Self {
self.alter.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Modify, BuildError> {
Ok(Modify {
set_parameter: self.set_parameter,
alter: self.alter,
})
}
}
impl Modify {
pub fn builder() -> ModifyBuilder {
ModifyBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InsertControlsChoice1 {
IncludeAll(IncludeAll),
SelectControlById(Vec<SelectControlById>),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct InsertControls {
#[serde(skip_serializing_if = "Option::is_none")]
pub order: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub insert_controls_choice1: Option<InsertControlsChoice1>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub exclude_controls: Vec<SelectControlById>,
}
#[must_use]
#[derive(Debug)]
pub struct InsertControlsBuilder {
order: Option<String>,
insert_controls_choice1: Option<InsertControlsChoice1>,
exclude_controls: Vec<SelectControlById>,
}
impl InsertControlsBuilder {
pub fn new() -> Self {
Self {
order: None,
insert_controls_choice1: None,
exclude_controls: Vec::new(),
}
}
}
impl Default for InsertControlsBuilder {
fn default() -> Self {
Self::new()
}
}
impl InsertControlsBuilder {
pub fn order(mut self, v: impl Into<String>) -> Self {
self.order = Some(v.into());
self
}
pub fn insert_controls_choice1(mut self, v: impl Into<InsertControlsChoice1>) -> Self {
self.insert_controls_choice1 = Some(v.into());
self
}
pub fn exclude_controls(mut self, v: impl Into<SelectControlById>) -> Self {
self.exclude_controls.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<InsertControls, BuildError> {
Ok(InsertControls {
order: self.order,
insert_controls_choice1: self.insert_controls_choice1,
exclude_controls: self.exclude_controls,
})
}
}
impl InsertControls {
pub fn builder() -> InsertControlsBuilder {
InsertControlsBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ComponentDefinition {
pub uuid: uuid::Uuid,
pub metadata: Metadata,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub import_component_definitions: Vec<ImportComponentDefinition>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub components: Vec<DefinedComponent>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub capabilities: Vec<Capability>,
#[serde(skip_serializing_if = "Option::is_none")]
pub back_matter: Option<BackMatter>,
}
#[must_use]
#[derive(Debug)]
pub struct ComponentDefinitionBuilder {
uuid: Option<uuid::Uuid>,
metadata: Option<Metadata>,
import_component_definitions: Vec<ImportComponentDefinition>,
components: Vec<DefinedComponent>,
capabilities: Vec<Capability>,
back_matter: Option<BackMatter>,
}
impl ComponentDefinitionBuilder {
pub fn new() -> Self {
Self {
uuid: None,
metadata: None,
import_component_definitions: Vec::new(),
components: Vec::new(),
capabilities: Vec::new(),
back_matter: None,
}
}
}
impl Default for ComponentDefinitionBuilder {
fn default() -> Self {
Self::new()
}
}
impl ComponentDefinitionBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn metadata(mut self, v: impl Into<Metadata>) -> Self {
self.metadata = Some(v.into());
self
}
pub fn import_component_definitions(mut self, v: impl Into<ImportComponentDefinition>) -> Self {
self.import_component_definitions.push(v.into());
self
}
pub fn components(mut self, v: impl Into<DefinedComponent>) -> Self {
self.components.push(v.into());
self
}
pub fn capabilities(mut self, v: impl Into<Capability>) -> Self {
self.capabilities.push(v.into());
self
}
pub fn back_matter(mut self, v: impl Into<BackMatter>) -> Self {
self.back_matter = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ComponentDefinition, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let metadata = self
.metadata
.ok_or_else(|| BuildError::MissingField("required field `metadata` not set"))?;
Ok(ComponentDefinition {
uuid,
metadata,
import_component_definitions: self.import_component_definitions,
components: self.components,
capabilities: self.capabilities,
back_matter: self.back_matter,
})
}
}
impl ComponentDefinition {
pub fn builder() -> ComponentDefinitionBuilder {
ComponentDefinitionBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ImportComponentDefinition {
pub href: crate::primitives::UriReference,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ImportComponentDefinitionBuilder {
href: Option<crate::primitives::UriReference>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ImportComponentDefinitionBuilder {
pub fn new() -> Self {
Self {
href: None,
remarks: None,
}
}
}
impl Default for ImportComponentDefinitionBuilder {
fn default() -> Self {
Self::new()
}
}
impl ImportComponentDefinitionBuilder {
pub fn href(mut self, v: impl Into<crate::primitives::UriReference>) -> Self {
self.href = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ImportComponentDefinition, BuildError> {
let href = self
.href
.ok_or_else(|| BuildError::MissingField("required field `href` not set"))?;
Ok(ImportComponentDefinition {
href,
remarks: self.remarks,
})
}
}
impl ImportComponentDefinition {
pub fn builder() -> ImportComponentDefinitionBuilder {
ImportComponentDefinitionBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct DefinedComponent {
pub uuid: uuid::Uuid,
pub title: crate::primitives::MarkupLine,
pub description: crate::primitives::MarkupMultiline,
#[serde(skip_serializing_if = "Option::is_none")]
pub purpose: Option<crate::primitives::MarkupLine>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_roles: Vec<ResponsibleRole>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub protocols: Vec<Protocol>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub control_implementations: Vec<ControlImplementation>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct DefinedComponentBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
purpose: Option<crate::primitives::MarkupLine>,
props: Vec<Property>,
links: Vec<Link>,
responsible_roles: Vec<ResponsibleRole>,
protocols: Vec<Protocol>,
control_implementations: Vec<ControlImplementation>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl DefinedComponentBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
description: None,
purpose: None,
props: Vec::new(),
links: Vec::new(),
responsible_roles: Vec::new(),
protocols: Vec::new(),
control_implementations: Vec::new(),
remarks: None,
}
}
}
impl Default for DefinedComponentBuilder {
fn default() -> Self {
Self::new()
}
}
impl DefinedComponentBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn purpose(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.purpose = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn responsible_roles(mut self, v: impl Into<ResponsibleRole>) -> Self {
self.responsible_roles.push(v.into());
self
}
pub fn protocols(mut self, v: impl Into<Protocol>) -> Self {
self.protocols.push(v.into());
self
}
pub fn control_implementations(mut self, v: impl Into<ControlImplementation>) -> Self {
self.control_implementations.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<DefinedComponent, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(DefinedComponent {
uuid,
title,
description,
purpose: self.purpose,
props: self.props,
links: self.links,
responsible_roles: self.responsible_roles,
protocols: self.protocols,
control_implementations: self.control_implementations,
remarks: self.remarks,
})
}
}
impl DefinedComponent {
pub fn builder() -> DefinedComponentBuilder {
DefinedComponentBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Capability {
pub uuid: uuid::Uuid,
pub name: String,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub incorporates_components: Vec<IncorporatesComponent>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub control_implementations: Vec<ControlImplementation>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct CapabilityBuilder {
uuid: Option<uuid::Uuid>,
name: Option<String>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
incorporates_components: Vec<IncorporatesComponent>,
control_implementations: Vec<ControlImplementation>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl CapabilityBuilder {
pub fn new() -> Self {
Self {
uuid: None,
name: None,
description: None,
props: Vec::new(),
links: Vec::new(),
incorporates_components: Vec::new(),
control_implementations: Vec::new(),
remarks: None,
}
}
}
impl Default for CapabilityBuilder {
fn default() -> Self {
Self::new()
}
}
impl CapabilityBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn name(mut self, v: impl Into<String>) -> Self {
self.name = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn incorporates_components(mut self, v: impl Into<IncorporatesComponent>) -> Self {
self.incorporates_components.push(v.into());
self
}
pub fn control_implementations(mut self, v: impl Into<ControlImplementation>) -> Self {
self.control_implementations.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Capability, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let name = self
.name
.ok_or_else(|| BuildError::MissingField("required field `name` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(Capability {
uuid,
name,
description,
props: self.props,
links: self.links,
incorporates_components: self.incorporates_components,
control_implementations: self.control_implementations,
remarks: self.remarks,
})
}
}
impl Capability {
pub fn builder() -> CapabilityBuilder {
CapabilityBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct IncorporatesComponent {
pub component_uuid: uuid::Uuid,
pub description: crate::primitives::MarkupMultiline,
}
#[must_use]
#[derive(Debug)]
pub struct IncorporatesComponentBuilder {
component_uuid: Option<uuid::Uuid>,
description: Option<crate::primitives::MarkupMultiline>,
}
impl IncorporatesComponentBuilder {
pub fn new() -> Self {
Self {
component_uuid: None,
description: None,
}
}
}
impl Default for IncorporatesComponentBuilder {
fn default() -> Self {
Self::new()
}
}
impl IncorporatesComponentBuilder {
pub fn component_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.component_uuid = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<IncorporatesComponent, BuildError> {
let component_uuid = self
.component_uuid
.ok_or_else(|| BuildError::MissingField("required field `component-uuid` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(IncorporatesComponent {
component_uuid,
description,
})
}
}
impl IncorporatesComponent {
pub fn builder() -> IncorporatesComponentBuilder {
IncorporatesComponentBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ControlImplementation {
pub uuid: uuid::Uuid,
pub source: crate::primitives::UriReference,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub set_parameters: Vec<SetParameter>,
#[serde(default)]
pub implemented_requirements: Vec<ImplementedRequirement>,
}
#[must_use]
#[derive(Debug)]
pub struct ControlImplementationBuilder {
uuid: Option<uuid::Uuid>,
source: Option<crate::primitives::UriReference>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
set_parameters: Vec<SetParameter>,
implemented_requirements: Vec<ImplementedRequirement>,
}
impl ControlImplementationBuilder {
pub fn new() -> Self {
Self {
uuid: None,
source: None,
description: None,
props: Vec::new(),
links: Vec::new(),
set_parameters: Vec::new(),
implemented_requirements: Vec::new(),
}
}
}
impl Default for ControlImplementationBuilder {
fn default() -> Self {
Self::new()
}
}
impl ControlImplementationBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn source(mut self, v: impl Into<crate::primitives::UriReference>) -> Self {
self.source = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn set_parameters(mut self, v: impl Into<SetParameter>) -> Self {
self.set_parameters.push(v.into());
self
}
pub fn implemented_requirements(mut self, v: impl Into<ImplementedRequirement>) -> Self {
self.implemented_requirements.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ControlImplementation, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let source = self
.source
.ok_or_else(|| BuildError::MissingField("required field `source` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(ControlImplementation {
uuid,
source,
description,
props: self.props,
links: self.links,
set_parameters: self.set_parameters,
implemented_requirements: self.implemented_requirements,
})
}
}
impl ControlImplementation {
pub fn builder() -> ControlImplementationBuilder {
ControlImplementationBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ImplementedRequirement {
pub uuid: uuid::Uuid,
pub control_id: String,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub set_parameters: Vec<SetParameter>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_roles: Vec<ResponsibleRole>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub statements: Vec<Statement>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ImplementedRequirementBuilder {
uuid: Option<uuid::Uuid>,
control_id: Option<String>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
set_parameters: Vec<SetParameter>,
responsible_roles: Vec<ResponsibleRole>,
statements: Vec<Statement>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ImplementedRequirementBuilder {
pub fn new() -> Self {
Self {
uuid: None,
control_id: None,
description: None,
props: Vec::new(),
links: Vec::new(),
set_parameters: Vec::new(),
responsible_roles: Vec::new(),
statements: Vec::new(),
remarks: None,
}
}
}
impl Default for ImplementedRequirementBuilder {
fn default() -> Self {
Self::new()
}
}
impl ImplementedRequirementBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn control_id(mut self, v: impl Into<String>) -> Self {
self.control_id = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn set_parameters(mut self, v: impl Into<SetParameter>) -> Self {
self.set_parameters.push(v.into());
self
}
pub fn responsible_roles(mut self, v: impl Into<ResponsibleRole>) -> Self {
self.responsible_roles.push(v.into());
self
}
pub fn statements(mut self, v: impl Into<Statement>) -> Self {
self.statements.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ImplementedRequirement, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let control_id = self
.control_id
.ok_or_else(|| BuildError::MissingField("required field `control-id` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(ImplementedRequirement {
uuid,
control_id,
description,
props: self.props,
links: self.links,
set_parameters: self.set_parameters,
responsible_roles: self.responsible_roles,
statements: self.statements,
remarks: self.remarks,
})
}
}
impl ImplementedRequirement {
pub fn builder() -> ImplementedRequirementBuilder {
ImplementedRequirementBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Statement {
pub uuid: uuid::Uuid,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_roles: Vec<ResponsibleRole>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct StatementBuilder {
uuid: Option<uuid::Uuid>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
responsible_roles: Vec<ResponsibleRole>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl StatementBuilder {
pub fn new() -> Self {
Self {
uuid: None,
description: None,
props: Vec::new(),
links: Vec::new(),
responsible_roles: Vec::new(),
remarks: None,
}
}
}
impl Default for StatementBuilder {
fn default() -> Self {
Self::new()
}
}
impl StatementBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn responsible_roles(mut self, v: impl Into<ResponsibleRole>) -> Self {
self.responsible_roles.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Statement, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(Statement {
uuid,
description,
props: self.props,
links: self.links,
responsible_roles: self.responsible_roles,
remarks: self.remarks,
})
}
}
impl Statement {
pub fn builder() -> StatementBuilder {
StatementBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct SystemSecurityPlan {
pub uuid: uuid::Uuid,
pub metadata: Metadata,
pub import_profile: ImportProfile,
pub system_characteristics: SystemCharacteristics,
pub system_implementation: SystemImplementation,
pub control_implementation: ControlImplementation,
#[serde(skip_serializing_if = "Option::is_none")]
pub back_matter: Option<BackMatter>,
}
#[must_use]
#[derive(Debug)]
pub struct SystemSecurityPlanBuilder {
uuid: Option<uuid::Uuid>,
metadata: Option<Metadata>,
import_profile: Option<ImportProfile>,
system_characteristics: Option<SystemCharacteristics>,
system_implementation: Option<SystemImplementation>,
control_implementation: Option<ControlImplementation>,
back_matter: Option<BackMatter>,
}
impl SystemSecurityPlanBuilder {
pub fn new() -> Self {
Self {
uuid: None,
metadata: None,
import_profile: None,
system_characteristics: None,
system_implementation: None,
control_implementation: None,
back_matter: None,
}
}
}
impl Default for SystemSecurityPlanBuilder {
fn default() -> Self {
Self::new()
}
}
impl SystemSecurityPlanBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn metadata(mut self, v: impl Into<Metadata>) -> Self {
self.metadata = Some(v.into());
self
}
pub fn import_profile(mut self, v: impl Into<ImportProfile>) -> Self {
self.import_profile = Some(v.into());
self
}
pub fn system_characteristics(mut self, v: impl Into<SystemCharacteristics>) -> Self {
self.system_characteristics = Some(v.into());
self
}
pub fn system_implementation(mut self, v: impl Into<SystemImplementation>) -> Self {
self.system_implementation = Some(v.into());
self
}
pub fn control_implementation(mut self, v: impl Into<ControlImplementation>) -> Self {
self.control_implementation = Some(v.into());
self
}
pub fn back_matter(mut self, v: impl Into<BackMatter>) -> Self {
self.back_matter = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<SystemSecurityPlan, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let metadata = self
.metadata
.ok_or_else(|| BuildError::MissingField("required field `metadata` not set"))?;
let import_profile = self
.import_profile
.ok_or_else(|| BuildError::MissingField("required field `import-profile` not set"))?;
let system_characteristics = self.system_characteristics.ok_or_else(|| {
BuildError::MissingField("required field `system-characteristics` not set")
})?;
let system_implementation = self.system_implementation.ok_or_else(|| {
BuildError::MissingField("required field `system-implementation` not set")
})?;
let control_implementation = self.control_implementation.ok_or_else(|| {
BuildError::MissingField("required field `control-implementation` not set")
})?;
Ok(SystemSecurityPlan {
uuid,
metadata,
import_profile,
system_characteristics,
system_implementation,
control_implementation,
back_matter: self.back_matter,
})
}
}
impl SystemSecurityPlan {
pub fn builder() -> SystemSecurityPlanBuilder {
SystemSecurityPlanBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ImportProfile {
pub href: crate::primitives::UriReference,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ImportProfileBuilder {
href: Option<crate::primitives::UriReference>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ImportProfileBuilder {
pub fn new() -> Self {
Self {
href: None,
remarks: None,
}
}
}
impl Default for ImportProfileBuilder {
fn default() -> Self {
Self::new()
}
}
impl ImportProfileBuilder {
pub fn href(mut self, v: impl Into<crate::primitives::UriReference>) -> Self {
self.href = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ImportProfile, BuildError> {
let href = self
.href
.ok_or_else(|| BuildError::MissingField("required field `href` not set"))?;
Ok(ImportProfile {
href,
remarks: self.remarks,
})
}
}
impl ImportProfile {
pub fn builder() -> ImportProfileBuilder {
ImportProfileBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct SystemCharacteristics {
#[serde(default)]
pub system_ids: Vec<SystemId>,
pub system_name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub system_name_short: Option<String>,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub date_authorized: Option<chrono::NaiveDate>,
#[serde(skip_serializing_if = "Option::is_none")]
pub security_sensitivity_level: Option<String>,
pub system_information: SystemInformation,
#[serde(skip_serializing_if = "Option::is_none")]
pub security_impact_level: Option<SecurityImpactLevel>,
pub status: Status,
pub authorization_boundary: AuthorizationBoundary,
#[serde(skip_serializing_if = "Option::is_none")]
pub network_architecture: Option<NetworkArchitecture>,
#[serde(skip_serializing_if = "Option::is_none")]
pub data_flow: Option<DataFlow>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_parties: Vec<ResponsibleParty>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct SystemCharacteristicsBuilder {
system_ids: Vec<SystemId>,
system_name: Option<String>,
system_name_short: Option<String>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
date_authorized: Option<chrono::NaiveDate>,
security_sensitivity_level: Option<String>,
system_information: Option<SystemInformation>,
security_impact_level: Option<SecurityImpactLevel>,
status: Option<Status>,
authorization_boundary: Option<AuthorizationBoundary>,
network_architecture: Option<NetworkArchitecture>,
data_flow: Option<DataFlow>,
responsible_parties: Vec<ResponsibleParty>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl SystemCharacteristicsBuilder {
pub fn new() -> Self {
Self {
system_ids: Vec::new(),
system_name: None,
system_name_short: None,
description: None,
props: Vec::new(),
links: Vec::new(),
date_authorized: None,
security_sensitivity_level: None,
system_information: None,
security_impact_level: None,
status: None,
authorization_boundary: None,
network_architecture: None,
data_flow: None,
responsible_parties: Vec::new(),
remarks: None,
}
}
}
impl Default for SystemCharacteristicsBuilder {
fn default() -> Self {
Self::new()
}
}
impl SystemCharacteristicsBuilder {
pub fn system_ids(mut self, v: impl Into<SystemId>) -> Self {
self.system_ids.push(v.into());
self
}
pub fn system_name(mut self, v: impl Into<String>) -> Self {
self.system_name = Some(v.into());
self
}
pub fn system_name_short(mut self, v: impl Into<String>) -> Self {
self.system_name_short = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn date_authorized(mut self, v: impl Into<chrono::NaiveDate>) -> Self {
self.date_authorized = Some(v.into());
self
}
pub fn security_sensitivity_level(mut self, v: impl Into<String>) -> Self {
self.security_sensitivity_level = Some(v.into());
self
}
pub fn system_information(mut self, v: impl Into<SystemInformation>) -> Self {
self.system_information = Some(v.into());
self
}
pub fn security_impact_level(mut self, v: impl Into<SecurityImpactLevel>) -> Self {
self.security_impact_level = Some(v.into());
self
}
pub fn status(mut self, v: impl Into<Status>) -> Self {
self.status = Some(v.into());
self
}
pub fn authorization_boundary(mut self, v: impl Into<AuthorizationBoundary>) -> Self {
self.authorization_boundary = Some(v.into());
self
}
pub fn network_architecture(mut self, v: impl Into<NetworkArchitecture>) -> Self {
self.network_architecture = Some(v.into());
self
}
pub fn data_flow(mut self, v: impl Into<DataFlow>) -> Self {
self.data_flow = Some(v.into());
self
}
pub fn responsible_parties(mut self, v: impl Into<ResponsibleParty>) -> Self {
self.responsible_parties.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<SystemCharacteristics, BuildError> {
let system_name = self
.system_name
.ok_or_else(|| BuildError::MissingField("required field `system-name` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
let system_information = self.system_information.ok_or_else(|| {
BuildError::MissingField("required field `system-information` not set")
})?;
let status = self
.status
.ok_or_else(|| BuildError::MissingField("required field `status` not set"))?;
let authorization_boundary = self.authorization_boundary.ok_or_else(|| {
BuildError::MissingField("required field `authorization-boundary` not set")
})?;
Ok(SystemCharacteristics {
system_ids: self.system_ids,
system_name,
system_name_short: self.system_name_short,
description,
props: self.props,
links: self.links,
date_authorized: self.date_authorized,
security_sensitivity_level: self.security_sensitivity_level,
system_information,
security_impact_level: self.security_impact_level,
status,
authorization_boundary,
network_architecture: self.network_architecture,
data_flow: self.data_flow,
responsible_parties: self.responsible_parties,
remarks: self.remarks,
})
}
}
impl SystemCharacteristics {
pub fn builder() -> SystemCharacteristicsBuilder {
SystemCharacteristicsBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Categorization {
pub system: url::Url,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub information_type_id: Vec<String>,
}
#[must_use]
#[derive(Debug)]
pub struct CategorizationBuilder {
system: Option<url::Url>,
information_type_id: Vec<String>,
}
impl CategorizationBuilder {
pub fn new() -> Self {
Self {
system: None,
information_type_id: Vec::new(),
}
}
}
impl Default for CategorizationBuilder {
fn default() -> Self {
Self::new()
}
}
impl CategorizationBuilder {
pub fn system(mut self, v: impl Into<url::Url>) -> Self {
self.system = Some(v.into());
self
}
pub fn information_type_id(mut self, v: impl Into<String>) -> Self {
self.information_type_id.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Categorization, BuildError> {
let system = self
.system
.ok_or_else(|| BuildError::MissingField("required field `system` not set"))?;
Ok(Categorization {
system,
information_type_id: self.information_type_id,
})
}
}
impl Categorization {
pub fn builder() -> CategorizationBuilder {
CategorizationBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct InformationType {
#[serde(skip_serializing_if = "Option::is_none")]
pub uuid: Option<uuid::Uuid>,
pub title: crate::primitives::MarkupLine,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub categorization: Vec<Categorization>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub confidentiality_impact: Option<Impact>,
#[serde(skip_serializing_if = "Option::is_none")]
pub integrity_impact: Option<Impact>,
#[serde(skip_serializing_if = "Option::is_none")]
pub availability_impact: Option<Impact>,
}
#[must_use]
#[derive(Debug)]
pub struct InformationTypeBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
categorization: Vec<Categorization>,
props: Vec<Property>,
links: Vec<Link>,
confidentiality_impact: Option<Impact>,
integrity_impact: Option<Impact>,
availability_impact: Option<Impact>,
}
impl InformationTypeBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
description: None,
categorization: Vec::new(),
props: Vec::new(),
links: Vec::new(),
confidentiality_impact: None,
integrity_impact: None,
availability_impact: None,
}
}
}
impl Default for InformationTypeBuilder {
fn default() -> Self {
Self::new()
}
}
impl InformationTypeBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn categorization(mut self, v: impl Into<Categorization>) -> Self {
self.categorization.push(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn confidentiality_impact(mut self, v: impl Into<Impact>) -> Self {
self.confidentiality_impact = Some(v.into());
self
}
pub fn integrity_impact(mut self, v: impl Into<Impact>) -> Self {
self.integrity_impact = Some(v.into());
self
}
pub fn availability_impact(mut self, v: impl Into<Impact>) -> Self {
self.availability_impact = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<InformationType, BuildError> {
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(InformationType {
uuid: self.uuid,
title,
description,
categorization: self.categorization,
props: self.props,
links: self.links,
confidentiality_impact: self.confidentiality_impact,
integrity_impact: self.integrity_impact,
availability_impact: self.availability_impact,
})
}
}
impl InformationType {
pub fn builder() -> InformationTypeBuilder {
InformationTypeBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct SystemInformation {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default)]
pub information_type: Vec<InformationType>,
}
#[must_use]
#[derive(Debug)]
pub struct SystemInformationBuilder {
props: Vec<Property>,
links: Vec<Link>,
information_type: Vec<InformationType>,
}
impl SystemInformationBuilder {
pub fn new() -> Self {
Self {
props: Vec::new(),
links: Vec::new(),
information_type: Vec::new(),
}
}
}
impl Default for SystemInformationBuilder {
fn default() -> Self {
Self::new()
}
}
impl SystemInformationBuilder {
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn information_type(mut self, v: impl Into<InformationType>) -> Self {
self.information_type.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<SystemInformation, BuildError> {
Ok(SystemInformation {
props: self.props,
links: self.links,
information_type: self.information_type,
})
}
}
impl SystemInformation {
pub fn builder() -> SystemInformationBuilder {
SystemInformationBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Impact {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
pub base: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub selected: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub adjustment_justification: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ImpactBuilder {
props: Vec<Property>,
links: Vec<Link>,
base: Option<String>,
selected: Option<String>,
adjustment_justification: Option<crate::primitives::MarkupMultiline>,
}
impl ImpactBuilder {
pub fn new() -> Self {
Self {
props: Vec::new(),
links: Vec::new(),
base: None,
selected: None,
adjustment_justification: None,
}
}
}
impl Default for ImpactBuilder {
fn default() -> Self {
Self::new()
}
}
impl ImpactBuilder {
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn base(mut self, v: impl Into<String>) -> Self {
self.base = Some(v.into());
self
}
pub fn selected(mut self, v: impl Into<String>) -> Self {
self.selected = Some(v.into());
self
}
pub fn adjustment_justification(
mut self,
v: impl Into<crate::primitives::MarkupMultiline>,
) -> Self {
self.adjustment_justification = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Impact, BuildError> {
let base = self
.base
.ok_or_else(|| BuildError::MissingField("required field `base` not set"))?;
Ok(Impact {
props: self.props,
links: self.links,
base,
selected: self.selected,
adjustment_justification: self.adjustment_justification,
})
}
}
impl Impact {
pub fn builder() -> ImpactBuilder {
ImpactBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Base {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Selected {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AdjustmentJustification {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<crate::primitives::MarkupMultiline>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct SecurityImpactLevel {
pub security_objective_confidentiality: String,
pub security_objective_integrity: String,
pub security_objective_availability: String,
}
#[must_use]
#[derive(Debug)]
pub struct SecurityImpactLevelBuilder {
security_objective_confidentiality: Option<String>,
security_objective_integrity: Option<String>,
security_objective_availability: Option<String>,
}
impl SecurityImpactLevelBuilder {
pub fn new() -> Self {
Self {
security_objective_confidentiality: None,
security_objective_integrity: None,
security_objective_availability: None,
}
}
}
impl Default for SecurityImpactLevelBuilder {
fn default() -> Self {
Self::new()
}
}
impl SecurityImpactLevelBuilder {
pub fn security_objective_confidentiality(mut self, v: impl Into<String>) -> Self {
self.security_objective_confidentiality = Some(v.into());
self
}
pub fn security_objective_integrity(mut self, v: impl Into<String>) -> Self {
self.security_objective_integrity = Some(v.into());
self
}
pub fn security_objective_availability(mut self, v: impl Into<String>) -> Self {
self.security_objective_availability = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<SecurityImpactLevel, BuildError> {
let security_objective_confidentiality =
self.security_objective_confidentiality.ok_or_else(|| {
BuildError::MissingField(
"required field `security-objective-confidentiality` not set",
)
})?;
let security_objective_integrity = self.security_objective_integrity.ok_or_else(|| {
BuildError::MissingField("required field `security-objective-integrity` not set")
})?;
let security_objective_availability =
self.security_objective_availability.ok_or_else(|| {
BuildError::MissingField("required field `security-objective-availability` not set")
})?;
Ok(SecurityImpactLevel {
security_objective_confidentiality,
security_objective_integrity,
security_objective_availability,
})
}
}
impl SecurityImpactLevel {
pub fn builder() -> SecurityImpactLevelBuilder {
SecurityImpactLevelBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct DateAuthorized {
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
pub value: Option<chrono::NaiveDate>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AuthorizationBoundary {
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub diagrams: Vec<Diagram>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct AuthorizationBoundaryBuilder {
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
diagrams: Vec<Diagram>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl AuthorizationBoundaryBuilder {
pub fn new() -> Self {
Self {
description: None,
props: Vec::new(),
links: Vec::new(),
diagrams: Vec::new(),
remarks: None,
}
}
}
impl Default for AuthorizationBoundaryBuilder {
fn default() -> Self {
Self::new()
}
}
impl AuthorizationBoundaryBuilder {
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn diagrams(mut self, v: impl Into<Diagram>) -> Self {
self.diagrams.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<AuthorizationBoundary, BuildError> {
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(AuthorizationBoundary {
description,
props: self.props,
links: self.links,
diagrams: self.diagrams,
remarks: self.remarks,
})
}
}
impl AuthorizationBoundary {
pub fn builder() -> AuthorizationBoundaryBuilder {
AuthorizationBoundaryBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Diagram {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(skip_serializing_if = "Option::is_none")]
pub caption: Option<crate::primitives::MarkupLine>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct DiagramBuilder {
uuid: Option<uuid::Uuid>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
caption: Option<crate::primitives::MarkupLine>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl DiagramBuilder {
pub fn new() -> Self {
Self {
uuid: None,
description: None,
props: Vec::new(),
links: Vec::new(),
caption: None,
remarks: None,
}
}
}
impl Default for DiagramBuilder {
fn default() -> Self {
Self::new()
}
}
impl DiagramBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn caption(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.caption = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Diagram, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
Ok(Diagram {
uuid,
description: self.description,
props: self.props,
links: self.links,
caption: self.caption,
remarks: self.remarks,
})
}
}
impl Diagram {
pub fn builder() -> DiagramBuilder {
DiagramBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct NetworkArchitecture {
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub diagrams: Vec<Diagram>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct NetworkArchitectureBuilder {
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
diagrams: Vec<Diagram>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl NetworkArchitectureBuilder {
pub fn new() -> Self {
Self {
description: None,
props: Vec::new(),
links: Vec::new(),
diagrams: Vec::new(),
remarks: None,
}
}
}
impl Default for NetworkArchitectureBuilder {
fn default() -> Self {
Self::new()
}
}
impl NetworkArchitectureBuilder {
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn diagrams(mut self, v: impl Into<Diagram>) -> Self {
self.diagrams.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<NetworkArchitecture, BuildError> {
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(NetworkArchitecture {
description,
props: self.props,
links: self.links,
diagrams: self.diagrams,
remarks: self.remarks,
})
}
}
impl NetworkArchitecture {
pub fn builder() -> NetworkArchitectureBuilder {
NetworkArchitectureBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct DataFlow {
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub diagrams: Vec<Diagram>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct DataFlowBuilder {
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
diagrams: Vec<Diagram>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl DataFlowBuilder {
pub fn new() -> Self {
Self {
description: None,
props: Vec::new(),
links: Vec::new(),
diagrams: Vec::new(),
remarks: None,
}
}
}
impl Default for DataFlowBuilder {
fn default() -> Self {
Self::new()
}
}
impl DataFlowBuilder {
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn diagrams(mut self, v: impl Into<Diagram>) -> Self {
self.diagrams.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<DataFlow, BuildError> {
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(DataFlow {
description,
props: self.props,
links: self.links,
diagrams: self.diagrams,
remarks: self.remarks,
})
}
}
impl DataFlow {
pub fn builder() -> DataFlowBuilder {
DataFlowBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct LeveragedAuthorization {
pub uuid: uuid::Uuid,
pub title: crate::primitives::MarkupLine,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
pub party_uuid: uuid::Uuid,
pub date_authorized: chrono::NaiveDate,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct LeveragedAuthorizationBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
props: Vec<Property>,
links: Vec<Link>,
party_uuid: Option<uuid::Uuid>,
date_authorized: Option<chrono::NaiveDate>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl LeveragedAuthorizationBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
props: Vec::new(),
links: Vec::new(),
party_uuid: None,
date_authorized: None,
remarks: None,
}
}
}
impl Default for LeveragedAuthorizationBuilder {
fn default() -> Self {
Self::new()
}
}
impl LeveragedAuthorizationBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn party_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.party_uuid = Some(v.into());
self
}
pub fn date_authorized(mut self, v: impl Into<chrono::NaiveDate>) -> Self {
self.date_authorized = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<LeveragedAuthorization, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
let party_uuid = self
.party_uuid
.ok_or_else(|| BuildError::MissingField("required field `party-uuid` not set"))?;
let date_authorized = self
.date_authorized
.ok_or_else(|| BuildError::MissingField("required field `date-authorized` not set"))?;
Ok(LeveragedAuthorization {
uuid,
title,
props: self.props,
links: self.links,
party_uuid,
date_authorized,
remarks: self.remarks,
})
}
}
impl LeveragedAuthorization {
pub fn builder() -> LeveragedAuthorizationBuilder {
LeveragedAuthorizationBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct SystemImplementation {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub leveraged_authorization: Vec<LeveragedAuthorization>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub users: Vec<SystemUser>,
#[serde(default)]
pub components: Vec<SystemComponent>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub inventory_items: Vec<InventoryItem>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct SystemImplementationBuilder {
props: Vec<Property>,
links: Vec<Link>,
leveraged_authorization: Vec<LeveragedAuthorization>,
users: Vec<SystemUser>,
components: Vec<SystemComponent>,
inventory_items: Vec<InventoryItem>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl SystemImplementationBuilder {
pub fn new() -> Self {
Self {
props: Vec::new(),
links: Vec::new(),
leveraged_authorization: Vec::new(),
users: Vec::new(),
components: Vec::new(),
inventory_items: Vec::new(),
remarks: None,
}
}
}
impl Default for SystemImplementationBuilder {
fn default() -> Self {
Self::new()
}
}
impl SystemImplementationBuilder {
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn leveraged_authorization(mut self, v: impl Into<LeveragedAuthorization>) -> Self {
self.leveraged_authorization.push(v.into());
self
}
pub fn users(mut self, v: impl Into<SystemUser>) -> Self {
self.users.push(v.into());
self
}
pub fn components(mut self, v: impl Into<SystemComponent>) -> Self {
self.components.push(v.into());
self
}
pub fn inventory_items(mut self, v: impl Into<InventoryItem>) -> Self {
self.inventory_items.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<SystemImplementation, BuildError> {
Ok(SystemImplementation {
props: self.props,
links: self.links,
leveraged_authorization: self.leveraged_authorization,
users: self.users,
components: self.components,
inventory_items: self.inventory_items,
remarks: self.remarks,
})
}
}
impl SystemImplementation {
pub fn builder() -> SystemImplementationBuilder {
SystemImplementationBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Provided {
pub uuid: uuid::Uuid,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_roles: Vec<ResponsibleRole>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ProvidedBuilder {
uuid: Option<uuid::Uuid>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
responsible_roles: Vec<ResponsibleRole>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ProvidedBuilder {
pub fn new() -> Self {
Self {
uuid: None,
description: None,
props: Vec::new(),
links: Vec::new(),
responsible_roles: Vec::new(),
remarks: None,
}
}
}
impl Default for ProvidedBuilder {
fn default() -> Self {
Self::new()
}
}
impl ProvidedBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn responsible_roles(mut self, v: impl Into<ResponsibleRole>) -> Self {
self.responsible_roles.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Provided, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(Provided {
uuid,
description,
props: self.props,
links: self.links,
responsible_roles: self.responsible_roles,
remarks: self.remarks,
})
}
}
impl Provided {
pub fn builder() -> ProvidedBuilder {
ProvidedBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Responsibility {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub provided_uuid: Option<String>,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_roles: Vec<ResponsibleRole>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ResponsibilityBuilder {
uuid: Option<uuid::Uuid>,
provided_uuid: Option<String>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
responsible_roles: Vec<ResponsibleRole>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ResponsibilityBuilder {
pub fn new() -> Self {
Self {
uuid: None,
provided_uuid: None,
description: None,
props: Vec::new(),
links: Vec::new(),
responsible_roles: Vec::new(),
remarks: None,
}
}
}
impl Default for ResponsibilityBuilder {
fn default() -> Self {
Self::new()
}
}
impl ResponsibilityBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn provided_uuid(mut self, v: impl Into<String>) -> Self {
self.provided_uuid = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn responsible_roles(mut self, v: impl Into<ResponsibleRole>) -> Self {
self.responsible_roles.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Responsibility, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(Responsibility {
uuid,
provided_uuid: self.provided_uuid,
description,
props: self.props,
links: self.links,
responsible_roles: self.responsible_roles,
remarks: self.remarks,
})
}
}
impl Responsibility {
pub fn builder() -> ResponsibilityBuilder {
ResponsibilityBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Export {
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<crate::primitives::MarkupMultiline>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub provided: Vec<Provided>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsibility: Vec<Responsibility>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ExportBuilder {
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
provided: Vec<Provided>,
responsibility: Vec<Responsibility>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ExportBuilder {
pub fn new() -> Self {
Self {
description: None,
props: Vec::new(),
links: Vec::new(),
provided: Vec::new(),
responsibility: Vec::new(),
remarks: None,
}
}
}
impl Default for ExportBuilder {
fn default() -> Self {
Self::new()
}
}
impl ExportBuilder {
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn provided(mut self, v: impl Into<Provided>) -> Self {
self.provided.push(v.into());
self
}
pub fn responsibility(mut self, v: impl Into<Responsibility>) -> Self {
self.responsibility.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Export, BuildError> {
Ok(Export {
description: self.description,
props: self.props,
links: self.links,
provided: self.provided,
responsibility: self.responsibility,
remarks: self.remarks,
})
}
}
impl Export {
pub fn builder() -> ExportBuilder {
ExportBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Inherited {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub provided_uuid: Option<String>,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_roles: Vec<ResponsibleRole>,
}
#[must_use]
#[derive(Debug)]
pub struct InheritedBuilder {
uuid: Option<uuid::Uuid>,
provided_uuid: Option<String>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
responsible_roles: Vec<ResponsibleRole>,
}
impl InheritedBuilder {
pub fn new() -> Self {
Self {
uuid: None,
provided_uuid: None,
description: None,
props: Vec::new(),
links: Vec::new(),
responsible_roles: Vec::new(),
}
}
}
impl Default for InheritedBuilder {
fn default() -> Self {
Self::new()
}
}
impl InheritedBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn provided_uuid(mut self, v: impl Into<String>) -> Self {
self.provided_uuid = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn responsible_roles(mut self, v: impl Into<ResponsibleRole>) -> Self {
self.responsible_roles.push(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Inherited, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(Inherited {
uuid,
provided_uuid: self.provided_uuid,
description,
props: self.props,
links: self.links,
responsible_roles: self.responsible_roles,
})
}
}
impl Inherited {
pub fn builder() -> InheritedBuilder {
InheritedBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Satisfied {
pub uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub responsibility_uuid: Option<String>,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_roles: Vec<ResponsibleRole>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct SatisfiedBuilder {
uuid: Option<uuid::Uuid>,
responsibility_uuid: Option<String>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
responsible_roles: Vec<ResponsibleRole>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl SatisfiedBuilder {
pub fn new() -> Self {
Self {
uuid: None,
responsibility_uuid: None,
description: None,
props: Vec::new(),
links: Vec::new(),
responsible_roles: Vec::new(),
remarks: None,
}
}
}
impl Default for SatisfiedBuilder {
fn default() -> Self {
Self::new()
}
}
impl SatisfiedBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn responsibility_uuid(mut self, v: impl Into<String>) -> Self {
self.responsibility_uuid = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn responsible_roles(mut self, v: impl Into<ResponsibleRole>) -> Self {
self.responsible_roles.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<Satisfied, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(Satisfied {
uuid,
responsibility_uuid: self.responsibility_uuid,
description,
props: self.props,
links: self.links,
responsible_roles: self.responsible_roles,
remarks: self.remarks,
})
}
}
impl Satisfied {
pub fn builder() -> SatisfiedBuilder {
SatisfiedBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ByComponent {
pub component_uuid: uuid::Uuid,
pub uuid: uuid::Uuid,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub set_parameters: Vec<SetParameter>,
#[serde(skip_serializing_if = "Option::is_none")]
pub implementation_status: Option<ImplementationStatus>,
#[serde(skip_serializing_if = "Option::is_none")]
pub export: Option<Export>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub inherited: Vec<Inherited>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub satisfied: Vec<Satisfied>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub responsible_roles: Vec<ResponsibleRole>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct ByComponentBuilder {
component_uuid: Option<uuid::Uuid>,
uuid: Option<uuid::Uuid>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
set_parameters: Vec<SetParameter>,
implementation_status: Option<ImplementationStatus>,
export: Option<Export>,
inherited: Vec<Inherited>,
satisfied: Vec<Satisfied>,
responsible_roles: Vec<ResponsibleRole>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl ByComponentBuilder {
pub fn new() -> Self {
Self {
component_uuid: None,
uuid: None,
description: None,
props: Vec::new(),
links: Vec::new(),
set_parameters: Vec::new(),
implementation_status: None,
export: None,
inherited: Vec::new(),
satisfied: Vec::new(),
responsible_roles: Vec::new(),
remarks: None,
}
}
}
impl Default for ByComponentBuilder {
fn default() -> Self {
Self::new()
}
}
impl ByComponentBuilder {
pub fn component_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.component_uuid = Some(v.into());
self
}
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn set_parameters(mut self, v: impl Into<SetParameter>) -> Self {
self.set_parameters.push(v.into());
self
}
pub fn implementation_status(mut self, v: impl Into<ImplementationStatus>) -> Self {
self.implementation_status = Some(v.into());
self
}
pub fn export(mut self, v: impl Into<Export>) -> Self {
self.export = Some(v.into());
self
}
pub fn inherited(mut self, v: impl Into<Inherited>) -> Self {
self.inherited.push(v.into());
self
}
pub fn satisfied(mut self, v: impl Into<Satisfied>) -> Self {
self.satisfied.push(v.into());
self
}
pub fn responsible_roles(mut self, v: impl Into<ResponsibleRole>) -> Self {
self.responsible_roles.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<ByComponent, BuildError> {
let component_uuid = self
.component_uuid
.ok_or_else(|| BuildError::MissingField("required field `component-uuid` not set"))?;
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(ByComponent {
component_uuid,
uuid,
description,
props: self.props,
links: self.links,
set_parameters: self.set_parameters,
implementation_status: self.implementation_status,
export: self.export,
inherited: self.inherited,
satisfied: self.satisfied,
responsible_roles: self.responsible_roles,
remarks: self.remarks,
})
}
}
impl ByComponent {
pub fn builder() -> ByComponentBuilder {
ByComponentBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct PlanOfActionAndMilestones {
pub uuid: uuid::Uuid,
pub metadata: Metadata,
#[serde(skip_serializing_if = "Option::is_none")]
pub import_ssp: Option<ImportSsp>,
#[serde(skip_serializing_if = "Option::is_none")]
pub system_id: Option<SystemId>,
#[serde(skip_serializing_if = "Option::is_none")]
pub local_definitions: Option<LocalDefinitions>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub observations: Vec<Observation>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub risks: Vec<Risk>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub findings: Vec<Finding>,
#[serde(default)]
pub poam_items: Vec<PoamItem>,
#[serde(skip_serializing_if = "Option::is_none")]
pub back_matter: Option<BackMatter>,
}
#[must_use]
#[derive(Debug)]
pub struct PlanOfActionAndMilestonesBuilder {
uuid: Option<uuid::Uuid>,
metadata: Option<Metadata>,
import_ssp: Option<ImportSsp>,
system_id: Option<SystemId>,
local_definitions: Option<LocalDefinitions>,
observations: Vec<Observation>,
risks: Vec<Risk>,
findings: Vec<Finding>,
poam_items: Vec<PoamItem>,
back_matter: Option<BackMatter>,
}
impl PlanOfActionAndMilestonesBuilder {
pub fn new() -> Self {
Self {
uuid: None,
metadata: None,
import_ssp: None,
system_id: None,
local_definitions: None,
observations: Vec::new(),
risks: Vec::new(),
findings: Vec::new(),
poam_items: Vec::new(),
back_matter: None,
}
}
}
impl Default for PlanOfActionAndMilestonesBuilder {
fn default() -> Self {
Self::new()
}
}
impl PlanOfActionAndMilestonesBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn metadata(mut self, v: impl Into<Metadata>) -> Self {
self.metadata = Some(v.into());
self
}
pub fn import_ssp(mut self, v: impl Into<ImportSsp>) -> Self {
self.import_ssp = Some(v.into());
self
}
pub fn system_id(mut self, v: impl Into<SystemId>) -> Self {
self.system_id = Some(v.into());
self
}
pub fn local_definitions(mut self, v: impl Into<LocalDefinitions>) -> Self {
self.local_definitions = Some(v.into());
self
}
pub fn observations(mut self, v: impl Into<Observation>) -> Self {
self.observations.push(v.into());
self
}
pub fn risks(mut self, v: impl Into<Risk>) -> Self {
self.risks.push(v.into());
self
}
pub fn findings(mut self, v: impl Into<Finding>) -> Self {
self.findings.push(v.into());
self
}
pub fn poam_items(mut self, v: impl Into<PoamItem>) -> Self {
self.poam_items.push(v.into());
self
}
pub fn back_matter(mut self, v: impl Into<BackMatter>) -> Self {
self.back_matter = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<PlanOfActionAndMilestones, BuildError> {
let uuid = self
.uuid
.ok_or_else(|| BuildError::MissingField("required field `uuid` not set"))?;
let metadata = self
.metadata
.ok_or_else(|| BuildError::MissingField("required field `metadata` not set"))?;
Ok(PlanOfActionAndMilestones {
uuid,
metadata,
import_ssp: self.import_ssp,
system_id: self.system_id,
local_definitions: self.local_definitions,
observations: self.observations,
risks: self.risks,
findings: self.findings,
poam_items: self.poam_items,
back_matter: self.back_matter,
})
}
}
impl PlanOfActionAndMilestones {
pub fn builder() -> PlanOfActionAndMilestonesBuilder {
PlanOfActionAndMilestonesBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct RelatedFinding {
pub finding_uuid: uuid::Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct RelatedFindingBuilder {
finding_uuid: Option<uuid::Uuid>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl RelatedFindingBuilder {
pub fn new() -> Self {
Self {
finding_uuid: None,
remarks: None,
}
}
}
impl Default for RelatedFindingBuilder {
fn default() -> Self {
Self::new()
}
}
impl RelatedFindingBuilder {
pub fn finding_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.finding_uuid = Some(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<RelatedFinding, BuildError> {
let finding_uuid = self
.finding_uuid
.ok_or_else(|| BuildError::MissingField("required field `finding-uuid` not set"))?;
Ok(RelatedFinding {
finding_uuid,
remarks: self.remarks,
})
}
}
impl RelatedFinding {
pub fn builder() -> RelatedFindingBuilder {
RelatedFindingBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct PoamItem {
#[serde(skip_serializing_if = "Option::is_none")]
pub uuid: Option<uuid::Uuid>,
pub title: crate::primitives::MarkupLine,
pub description: crate::primitives::MarkupMultiline,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub props: Vec<Property>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub links: Vec<Link>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub origin: Vec<Origin>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub related_finding: Vec<RelatedFinding>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub related_observations: Vec<RelatedObservation>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub related_risks: Vec<AssociatedRisk>,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct PoamItemBuilder {
uuid: Option<uuid::Uuid>,
title: Option<crate::primitives::MarkupLine>,
description: Option<crate::primitives::MarkupMultiline>,
props: Vec<Property>,
links: Vec<Link>,
origin: Vec<Origin>,
related_finding: Vec<RelatedFinding>,
related_observations: Vec<RelatedObservation>,
related_risks: Vec<AssociatedRisk>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl PoamItemBuilder {
pub fn new() -> Self {
Self {
uuid: None,
title: None,
description: None,
props: Vec::new(),
links: Vec::new(),
origin: Vec::new(),
related_finding: Vec::new(),
related_observations: Vec::new(),
related_risks: Vec::new(),
remarks: None,
}
}
}
impl Default for PoamItemBuilder {
fn default() -> Self {
Self::new()
}
}
impl PoamItemBuilder {
pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
self.uuid = Some(v.into());
self
}
pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
self.title = Some(v.into());
self
}
pub fn description(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.description = Some(v.into());
self
}
pub fn props(mut self, v: impl Into<Property>) -> Self {
self.props.push(v.into());
self
}
pub fn links(mut self, v: impl Into<Link>) -> Self {
self.links.push(v.into());
self
}
pub fn origin(mut self, v: impl Into<Origin>) -> Self {
self.origin.push(v.into());
self
}
pub fn related_finding(mut self, v: impl Into<RelatedFinding>) -> Self {
self.related_finding.push(v.into());
self
}
pub fn related_observations(mut self, v: impl Into<RelatedObservation>) -> Self {
self.related_observations.push(v.into());
self
}
pub fn related_risks(mut self, v: impl Into<AssociatedRisk>) -> Self {
self.related_risks.push(v.into());
self
}
pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
self.remarks = Some(v.into());
self
}
pub fn build(self) -> ::core::result::Result<PoamItem, BuildError> {
let title = self
.title
.ok_or_else(|| BuildError::MissingField("required field `title` not set"))?;
let description = self
.description
.ok_or_else(|| BuildError::MissingField("required field `description` not set"))?;
Ok(PoamItem {
uuid: self.uuid,
title,
description,
props: self.props,
links: self.links,
origin: self.origin,
related_finding: self.related_finding,
related_observations: self.related_observations,
related_risks: self.related_risks,
remarks: self.remarks,
})
}
}
impl PoamItem {
pub fn builder() -> PoamItemBuilder {
PoamItemBuilder::new()
}
}