Skip to main content

nominal_api/conjure/objects/scout/checks/api/
versioned_checklist.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct VersionedChecklist {
13    #[serde(rename = "rid")]
14    rid: super::super::super::rids::api::ChecklistRid,
15    #[builder(custom(type = super::ChecklistMetadata, convert = Box::new))]
16    #[serde(rename = "metadata")]
17    metadata: Box<super::ChecklistMetadata>,
18    #[builder(
19        custom(type = super::super::super::versioning::api::Commit, convert = Box::new)
20    )]
21    #[serde(rename = "commit")]
22    commit: Box<super::super::super::versioning::api::Commit>,
23    #[builder(default, into)]
24    #[serde(rename = "functions", skip_serializing_if = "Option::is_none", default)]
25    functions: Option<Vec<super::Function>>,
26    #[builder(default, list(item(type = super::ChecklistEntry)))]
27    #[serde(rename = "checks", skip_serializing_if = "Vec::is_empty", default)]
28    checks: Vec<super::ChecklistEntry>,
29    #[builder(default, list(item(type = super::ChecklistVariable)))]
30    #[serde(
31        rename = "checklistVariables",
32        skip_serializing_if = "Vec::is_empty",
33        default
34    )]
35    checklist_variables: Vec<super::ChecklistVariable>,
36}
37impl VersionedChecklist {
38    /// Constructs a new instance of the type.
39    #[inline]
40    pub fn new(
41        rid: super::super::super::rids::api::ChecklistRid,
42        metadata: super::ChecklistMetadata,
43        commit: super::super::super::versioning::api::Commit,
44    ) -> Self {
45        Self::builder().rid(rid).metadata(metadata).commit(commit).build()
46    }
47    #[inline]
48    pub fn rid(&self) -> &super::super::super::rids::api::ChecklistRid {
49        &self.rid
50    }
51    #[inline]
52    pub fn metadata(&self) -> &super::ChecklistMetadata {
53        &*self.metadata
54    }
55    #[inline]
56    pub fn commit(&self) -> &super::super::super::versioning::api::Commit {
57        &*self.commit
58    }
59    #[deprecated(
60        note = "The functions field is deprecated and will be removed in a future version.\n"
61    )]
62    #[inline]
63    pub fn functions(&self) -> Option<&[super::Function]> {
64        self.functions.as_ref().map(|o| &**o)
65    }
66    #[inline]
67    pub fn checks(&self) -> &[super::ChecklistEntry] {
68        &*self.checks
69    }
70    /// Variables that can be used in checks. Variables are resolved in order of declaration.
71    /// If variable `a` depends on variable `b`, then `b` must be defined before `a` in the list.
72    #[inline]
73    pub fn checklist_variables(&self) -> &[super::ChecklistVariable] {
74        &*self.checklist_variables
75    }
76}