Skip to main content

nominal_api/conjure/objects/scout/run/api/
update_run_request.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct UpdateRunRequest {
16    #[builder(default, into)]
17    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
18    title: Option<String>,
19    #[builder(default, into)]
20    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
21    description: Option<String>,
22    #[builder(
23        default,
24        custom(
25            type = impl
26            Into<Option<super::UtcTimestamp>>,
27            convert = |v|v.into().map(Box::new)
28        )
29    )]
30    #[serde(rename = "startTime", skip_serializing_if = "Option::is_none", default)]
31    start_time: Option<Box<super::UtcTimestamp>>,
32    #[builder(
33        default,
34        custom(
35            type = impl
36            Into<Option<super::UtcTimestamp>>,
37            convert = |v|v.into().map(Box::new)
38        )
39    )]
40    #[serde(rename = "endTime", skip_serializing_if = "Option::is_none", default)]
41    end_time: Option<Box<super::UtcTimestamp>>,
42    #[builder(default, into)]
43    #[serde(rename = "properties", skip_serializing_if = "Option::is_none", default)]
44    properties: Option<std::collections::BTreeMap<String, String>>,
45    #[builder(default, into)]
46    #[serde(rename = "labels", skip_serializing_if = "Option::is_none", default)]
47    labels: Option<std::collections::BTreeSet<String>>,
48    #[builder(default, into)]
49    #[serde(rename = "links", skip_serializing_if = "Option::is_none", default)]
50    links: Option<Vec<super::Link>>,
51    #[builder(default, into)]
52    #[serde(rename = "runPrefix", skip_serializing_if = "Option::is_none", default)]
53    run_prefix: Option<String>,
54    #[builder(default, into)]
55    #[serde(rename = "dataSources", skip_serializing_if = "Option::is_none", default)]
56    data_sources: Option<
57        std::collections::BTreeMap<
58            super::super::super::api::DataSourceRefName,
59            super::CreateRunDataSource,
60        >,
61    >,
62    #[builder(default, into)]
63    #[serde(rename = "attachments", skip_serializing_if = "Option::is_none", default)]
64    attachments: Option<std::collections::BTreeSet<conjure_object::ResourceIdentifier>>,
65    #[builder(default, into)]
66    #[serde(rename = "asset", skip_serializing_if = "Option::is_none", default)]
67    asset: Option<super::super::super::rids::api::AssetRid>,
68    #[builder(default, list(item(type = super::super::super::rids::api::AssetRid)))]
69    #[serde(rename = "assets", skip_serializing_if = "Vec::is_empty", default)]
70    assets: Vec<super::super::super::rids::api::AssetRid>,
71    #[builder(default, into)]
72    #[serde(
73        rename = "strictOverwrite",
74        skip_serializing_if = "Option::is_none",
75        default
76    )]
77    strict_overwrite: Option<bool>,
78}
79impl UpdateRunRequest {
80    /// Constructs a new instance of the type.
81    #[inline]
82    pub fn new() -> Self {
83        Self::builder().build()
84    }
85    #[inline]
86    pub fn title(&self) -> Option<&str> {
87        self.title.as_ref().map(|o| &**o)
88    }
89    #[inline]
90    pub fn description(&self) -> Option<&str> {
91        self.description.as_ref().map(|o| &**o)
92    }
93    /// If strictOverwrite is false, will only update the startTime if it is before the existing startTime.
94    #[inline]
95    pub fn start_time(&self) -> Option<&super::UtcTimestamp> {
96        self.start_time.as_ref().map(|o| &**o)
97    }
98    /// If strictOverwrite is false, will only update the endTime if it is after the existing endTime.
99    #[inline]
100    pub fn end_time(&self) -> Option<&super::UtcTimestamp> {
101        self.end_time.as_ref().map(|o| &**o)
102    }
103    #[inline]
104    pub fn properties(&self) -> Option<&std::collections::BTreeMap<String, String>> {
105        self.properties.as_ref().map(|o| &*o)
106    }
107    #[inline]
108    pub fn labels(&self) -> Option<&std::collections::BTreeSet<String>> {
109        self.labels.as_ref().map(|o| &*o)
110    }
111    #[inline]
112    pub fn links(&self) -> Option<&[super::Link]> {
113        self.links.as_ref().map(|o| &**o)
114    }
115    /// Pass in an empty string to remove the run prefix.
116    #[inline]
117    pub fn run_prefix(&self) -> Option<&str> {
118        self.run_prefix.as_ref().map(|o| &**o)
119    }
120    #[inline]
121    pub fn data_sources(
122        &self,
123    ) -> Option<
124        &std::collections::BTreeMap<
125            super::super::super::api::DataSourceRefName,
126            super::CreateRunDataSource,
127        >,
128    > {
129        self.data_sources.as_ref().map(|o| &*o)
130    }
131    #[inline]
132    pub fn attachments(
133        &self,
134    ) -> Option<&std::collections::BTreeSet<conjure_object::ResourceIdentifier>> {
135        self.attachments.as_ref().map(|o| &*o)
136    }
137    #[deprecated(note = "Use assets")]
138    #[inline]
139    pub fn asset(&self) -> Option<&super::super::super::rids::api::AssetRid> {
140        self.asset.as_ref().map(|o| &*o)
141    }
142    #[inline]
143    pub fn assets(&self) -> &[super::super::super::rids::api::AssetRid] {
144        &*self.assets
145    }
146    /// If true, will blindly overwrite the existing fields with the new values in the request.
147    /// If false, will only update the fields if application constraints are maintained.
148    /// See individual field docs for more details.
149    /// Defaults to true for backwards compatibility.
150    #[inline]
151    pub fn strict_overwrite(&self) -> Option<bool> {
152        self.strict_overwrite.as_ref().map(|o| *o)
153    }
154}