oscal 0.1.0

Serde types for the OSCAL (Open Security Controls Assessment Language) data models. Generated from the official NIST Metaschema, covering all seven OSCAL document types. Ships embedded community catalogs for AI governance and security frameworks.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
// @generated — do not edit by hand.
// Run `cargo run -p oscal-metaschema-gen` to regenerate.

//!Generated OSCAL types for the `poam` model.
#![allow(clippy::doc_markdown)]
use serde::{Deserialize, Serialize};
use super::common::*;
/// Error returned when a required field was not set before calling `build()`.
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
pub enum BuildError {
    #[error("missing required field: {0}")]
    MissingField(&'static str),
}
///A plan of action and milestones which identifies initial and residual risks, deviations, and disposition, such as those required by FedRAMP.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct PlanOfActionAndMilestones {
    ///Amachine-oriented,globally uniqueidentifier withinstancescope that can be used to reference this POA&M instance inthis OSCAL instance. This UUID should be assignedper-subject, which means it should be consistently used to identify the same subject across revisions of the document.
    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>,
}
/// Builder for [`#struct_name`].
///
/// Construct via [`#struct_name::builder()`], chain setters, then call
/// [`#builder_name::build()`].
#[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 {
    /// Create an empty builder with all fields unset.
    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 {
    ///Set the `uuid` field.
    pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
        self.uuid = Some(v.into());
        self
    }
    ///Set the `metadata` field.
    pub fn metadata(mut self, v: impl Into<Metadata>) -> Self {
        self.metadata = Some(v.into());
        self
    }
    ///Set the `import-ssp` field.
    pub fn import_ssp(mut self, v: impl Into<ImportSsp>) -> Self {
        self.import_ssp = Some(v.into());
        self
    }
    ///Set the `system-id` field.
    pub fn system_id(mut self, v: impl Into<SystemId>) -> Self {
        self.system_id = Some(v.into());
        self
    }
    ///Set the `local-definitions` field.
    pub fn local_definitions(mut self, v: impl Into<LocalDefinitions>) -> Self {
        self.local_definitions = Some(v.into());
        self
    }
    ///Set the `observations` field.
    pub fn observations(mut self, v: impl Into<Observation>) -> Self {
        self.observations.push(v.into());
        self
    }
    ///Set the `risks` field.
    pub fn risks(mut self, v: impl Into<Risk>) -> Self {
        self.risks.push(v.into());
        self
    }
    ///Set the `findings` field.
    pub fn findings(mut self, v: impl Into<Finding>) -> Self {
        self.findings.push(v.into());
        self
    }
    ///Set the `poam-items` field.
    pub fn poam_items(mut self, v: impl Into<PoamItem>) -> Self {
        self.poam_items.push(v.into());
        self
    }
    ///Set the `back-matter` field.
    pub fn back_matter(mut self, v: impl Into<BackMatter>) -> Self {
        self.back_matter = Some(v.into());
        self
    }
    /// Consume the builder and return a fully constructed [`#struct_name`].
    ///
    /// # Errors
    ///
    /// Returns [`BuildError::MissingField`] if any required field was not set.
    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 {
    /// Return a new builder for this type.
    pub fn builder() -> PlanOfActionAndMilestonesBuilder {
        PlanOfActionAndMilestonesBuilder::new()
    }
}
///Allows components, and inventory-items to be defined within the POA&M for circumstances where no OSCAL-based SSP exists, or is not delivered with the POA&M.
#[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(skip_serializing_if = "Option::is_none")]
    pub assessment_assets: Option<AssessmentAssets>,
    ///
    #[serde(skip_serializing_if = "Option::is_none")]
    pub remarks: Option<crate::primitives::MarkupMultiline>,
}
/// Builder for [`#struct_name`].
///
/// Construct via [`#struct_name::builder()`], chain setters, then call
/// [`#builder_name::build()`].
#[must_use]
#[derive(Debug)]
pub struct LocalDefinitionsBuilder {
    components: Vec<SystemComponent>,
    inventory_items: Vec<InventoryItem>,
    assessment_assets: Option<AssessmentAssets>,
    remarks: Option<crate::primitives::MarkupMultiline>,
}
impl LocalDefinitionsBuilder {
    /// Create an empty builder with all fields unset.
    pub fn new() -> Self {
        Self {
            components: Vec::new(),
            inventory_items: Vec::new(),
            assessment_assets: None,
            remarks: None,
        }
    }
}
impl Default for LocalDefinitionsBuilder {
    fn default() -> Self {
        Self::new()
    }
}
impl LocalDefinitionsBuilder {
    ///Set the `components` field.
    pub fn components(mut self, v: impl Into<SystemComponent>) -> Self {
        self.components.push(v.into());
        self
    }
    ///Set the `inventory-items` field.
    pub fn inventory_items(mut self, v: impl Into<InventoryItem>) -> Self {
        self.inventory_items.push(v.into());
        self
    }
    ///Set the `assessment-assets` field.
    pub fn assessment_assets(mut self, v: impl Into<AssessmentAssets>) -> Self {
        self.assessment_assets = Some(v.into());
        self
    }
    ///Set the `remarks` field.
    pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
        self.remarks = Some(v.into());
        self
    }
    /// Consume the builder and return a fully constructed [`#struct_name`].
    ///
    /// # Errors
    ///
    /// Returns [`BuildError::MissingField`] if any required field was not set.
    pub fn build(self) -> ::core::result::Result<LocalDefinitions, BuildError> {
        Ok(LocalDefinitions {
            components: self.components,
            inventory_items: self.inventory_items,
            assessment_assets: self.assessment_assets,
            remarks: self.remarks,
        })
    }
}
impl LocalDefinitions {
    /// Return a new builder for this type.
    pub fn builder() -> LocalDefinitionsBuilder {
        LocalDefinitionsBuilder::new()
    }
}
///Identifies the source of the finding, such as a tool or person.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Origin {
    ///
    #[serde(default)]
    pub actors: Vec<OriginActor>,
}
/// Builder for [`#struct_name`].
///
/// Construct via [`#struct_name::builder()`], chain setters, then call
/// [`#builder_name::build()`].
#[must_use]
#[derive(Debug)]
pub struct OriginBuilder {
    actors: Vec<OriginActor>,
}
impl OriginBuilder {
    /// Create an empty builder with all fields unset.
    pub fn new() -> Self {
        Self { actors: Vec::new() }
    }
}
impl Default for OriginBuilder {
    fn default() -> Self {
        Self::new()
    }
}
impl OriginBuilder {
    ///Set the `actors` field.
    pub fn actors(mut self, v: impl Into<OriginActor>) -> Self {
        self.actors.push(v.into());
        self
    }
    /// Consume the builder and return a fully constructed [`#struct_name`].
    ///
    /// # Errors
    ///
    /// Returns [`BuildError::MissingField`] if any required field was not set.
    pub fn build(self) -> ::core::result::Result<Origin, BuildError> {
        Ok(Origin { actors: self.actors })
    }
}
impl Origin {
    /// Return a new builder for this type.
    pub fn builder() -> OriginBuilder {
        OriginBuilder::new()
    }
}
///Relates the poam-item to referenced finding(s).
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct RelatedFinding {
    ///Amachine-orientedidentifier reference to a finding defined in the list of findings.
    pub finding_uuid: uuid::Uuid,
    ///
    #[serde(skip_serializing_if = "Option::is_none")]
    pub remarks: Option<crate::primitives::MarkupMultiline>,
}
/// Builder for [`#struct_name`].
///
/// Construct via [`#struct_name::builder()`], chain setters, then call
/// [`#builder_name::build()`].
#[must_use]
#[derive(Debug)]
pub struct RelatedFindingBuilder {
    finding_uuid: Option<uuid::Uuid>,
    remarks: Option<crate::primitives::MarkupMultiline>,
}
impl RelatedFindingBuilder {
    /// Create an empty builder with all fields unset.
    pub fn new() -> Self {
        Self {
            finding_uuid: None,
            remarks: None,
        }
    }
}
impl Default for RelatedFindingBuilder {
    fn default() -> Self {
        Self::new()
    }
}
impl RelatedFindingBuilder {
    ///Set the `finding-uuid` field.
    pub fn finding_uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
        self.finding_uuid = Some(v.into());
        self
    }
    ///Set the `remarks` field.
    pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
        self.remarks = Some(v.into());
        self
    }
    /// Consume the builder and return a fully constructed [`#struct_name`].
    ///
    /// # Errors
    ///
    /// Returns [`BuildError::MissingField`] if any required field was not set.
    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 {
    /// Return a new builder for this type.
    pub fn builder() -> RelatedFindingBuilder {
        RelatedFindingBuilder::new()
    }
}
///Describes an individual POA&M item.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct PoamItem {
    ///Amachine-oriented,globally uniqueidentifier withinstancescope that can be used to reference this POA&M item entry inthis OSCAL instance. This UUID should be assignedper-subject, which means it should be consistently used to identify the same subject across revisions of the document.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub uuid: Option<uuid::Uuid>,
    ///The title or name for this POA&M item .
    pub title: crate::primitives::MarkupLine,
    ///A human-readable description of POA&M item.
    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>,
    ///Identifies the source of the finding, such as a tool or person.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub origin: Vec<Origin>,
    ///Relates the poam-item to referenced finding(s).
    #[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>,
}
/// Builder for [`#struct_name`].
///
/// Construct via [`#struct_name::builder()`], chain setters, then call
/// [`#builder_name::build()`].
#[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 {
    /// Create an empty builder with all fields unset.
    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 {
    ///Set the `uuid` field.
    pub fn uuid(mut self, v: impl Into<uuid::Uuid>) -> Self {
        self.uuid = Some(v.into());
        self
    }
    ///Set the `title` field.
    pub fn title(mut self, v: impl Into<crate::primitives::MarkupLine>) -> Self {
        self.title = Some(v.into());
        self
    }
    ///Set the `description` field.
    pub fn description(
        mut self,
        v: impl Into<crate::primitives::MarkupMultiline>,
    ) -> Self {
        self.description = Some(v.into());
        self
    }
    ///Set the `props` field.
    pub fn props(mut self, v: impl Into<Property>) -> Self {
        self.props.push(v.into());
        self
    }
    ///Set the `links` field.
    pub fn links(mut self, v: impl Into<Link>) -> Self {
        self.links.push(v.into());
        self
    }
    ///Set the `origin` field.
    pub fn origin(mut self, v: impl Into<Origin>) -> Self {
        self.origin.push(v.into());
        self
    }
    ///Set the `related-finding` field.
    pub fn related_finding(mut self, v: impl Into<RelatedFinding>) -> Self {
        self.related_finding.push(v.into());
        self
    }
    ///Set the `related-observations` field.
    pub fn related_observations(mut self, v: impl Into<RelatedObservation>) -> Self {
        self.related_observations.push(v.into());
        self
    }
    ///Set the `related-risks` field.
    pub fn related_risks(mut self, v: impl Into<AssociatedRisk>) -> Self {
        self.related_risks.push(v.into());
        self
    }
    ///Set the `remarks` field.
    pub fn remarks(mut self, v: impl Into<crate::primitives::MarkupMultiline>) -> Self {
        self.remarks = Some(v.into());
        self
    }
    /// Consume the builder and return a fully constructed [`#struct_name`].
    ///
    /// # Errors
    ///
    /// Returns [`BuildError::MissingField`] if any required field was not set.
    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 {
    /// Return a new builder for this type.
    pub fn builder() -> PoamItemBuilder {
        PoamItemBuilder::new()
    }
}