#![allow(clippy::doc_markdown)]
use serde::{Deserialize, Serialize};
use super::common::*;
#[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 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, Default)]
#[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, Default)]
#[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, Default)]
#[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 Status {
pub state: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub remarks: Option<crate::primitives::MarkupMultiline>,
}
#[must_use]
#[derive(Debug)]
pub struct StatusBuilder {
state: Option<String>,
remarks: Option<crate::primitives::MarkupMultiline>,
}
impl StatusBuilder {
pub fn new() -> Self {
Self { state: 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 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,
remarks: self.remarks,
})
}
}
impl Status {
pub fn builder() -> StatusBuilder {
StatusBuilder::new()
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
#[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()
}
}