Skip to main content

nominal_api_conjure/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    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 UpdateRunRequest {
13    #[builder(default, into)]
14    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
15    title: Option<String>,
16    #[builder(default, into)]
17    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
18    description: Option<String>,
19    #[builder(
20        default,
21        custom(
22            type = impl
23            Into<Option<super::UtcTimestamp>>,
24            convert = |v|v.into().map(Box::new)
25        )
26    )]
27    #[serde(rename = "startTime", skip_serializing_if = "Option::is_none", default)]
28    start_time: Option<Box<super::UtcTimestamp>>,
29    #[builder(
30        default,
31        custom(
32            type = impl
33            Into<Option<super::UtcTimestamp>>,
34            convert = |v|v.into().map(Box::new)
35        )
36    )]
37    #[serde(rename = "endTime", skip_serializing_if = "Option::is_none", default)]
38    end_time: Option<Box<super::UtcTimestamp>>,
39    #[builder(default, into)]
40    #[serde(rename = "properties", skip_serializing_if = "Option::is_none", default)]
41    properties: Option<
42        std::collections::BTreeMap<
43            super::super::super::super::api::PropertyName,
44            super::super::super::super::api::PropertyValue,
45        >,
46    >,
47    #[builder(default, into)]
48    #[serde(
49        rename = "typedProperties",
50        skip_serializing_if = "Option::is_none",
51        default
52    )]
53    typed_properties: Option<
54        std::collections::BTreeMap<
55            super::super::super::super::api::PropertyName,
56            super::super::super::super::api::TypedPropertyValue,
57        >,
58    >,
59    #[builder(default, into)]
60    #[serde(rename = "labels", skip_serializing_if = "Option::is_none", default)]
61    labels: Option<std::collections::BTreeSet<super::super::super::super::api::Label>>,
62    #[builder(default, into)]
63    #[serde(rename = "links", skip_serializing_if = "Option::is_none", default)]
64    links: Option<Vec<super::Link>>,
65    #[builder(default, into)]
66    #[serde(rename = "runPrefix", skip_serializing_if = "Option::is_none", default)]
67    run_prefix: Option<String>,
68    #[builder(default, into)]
69    #[serde(rename = "dataSources", skip_serializing_if = "Option::is_none", default)]
70    data_sources: Option<
71        std::collections::BTreeMap<
72            super::super::super::api::DataSourceRefName,
73            super::CreateRunDataSource,
74        >,
75    >,
76    #[builder(default, into)]
77    #[serde(rename = "attachments", skip_serializing_if = "Option::is_none", default)]
78    attachments: Option<
79        std::collections::BTreeSet<super::super::super::super::api::rids::AttachmentRid>,
80    >,
81    #[builder(default, into)]
82    #[serde(rename = "asset", skip_serializing_if = "Option::is_none", default)]
83    asset: Option<super::super::super::rids::api::AssetRid>,
84    #[builder(default, list(item(type = super::super::super::rids::api::AssetRid)))]
85    #[serde(rename = "assets", skip_serializing_if = "Vec::is_empty", default)]
86    assets: Vec<super::super::super::rids::api::AssetRid>,
87    #[builder(default, into)]
88    #[serde(
89        rename = "strictOverwrite",
90        skip_serializing_if = "Option::is_none",
91        default
92    )]
93    strict_overwrite: Option<bool>,
94}
95impl UpdateRunRequest {
96    /// Constructs a new instance of the type.
97    #[inline]
98    pub fn new() -> Self {
99        Self::builder().build()
100    }
101    #[inline]
102    pub fn title(&self) -> Option<&str> {
103        self.title.as_ref().map(|o| &**o)
104    }
105    #[inline]
106    pub fn description(&self) -> Option<&str> {
107        self.description.as_ref().map(|o| &**o)
108    }
109    /// If strictOverwrite is false, will only update the startTime if it is before the existing startTime.
110    #[inline]
111    pub fn start_time(&self) -> Option<&super::UtcTimestamp> {
112        self.start_time.as_ref().map(|o| &**o)
113    }
114    /// If strictOverwrite is false, will only update the endTime if it is after the existing endTime.
115    #[inline]
116    pub fn end_time(&self) -> Option<&super::UtcTimestamp> {
117        self.end_time.as_ref().map(|o| &**o)
118    }
119    #[deprecated(note = "use typedProperties")]
120    #[inline]
121    pub fn properties(
122        &self,
123    ) -> Option<
124        &std::collections::BTreeMap<
125            super::super::super::super::api::PropertyName,
126            super::super::super::super::api::PropertyValue,
127        >,
128    > {
129        self.properties.as_ref().map(|o| &*o)
130    }
131    #[inline]
132    pub fn typed_properties(
133        &self,
134    ) -> Option<
135        &std::collections::BTreeMap<
136            super::super::super::super::api::PropertyName,
137            super::super::super::super::api::TypedPropertyValue,
138        >,
139    > {
140        self.typed_properties.as_ref().map(|o| &*o)
141    }
142    #[inline]
143    pub fn labels(
144        &self,
145    ) -> Option<&std::collections::BTreeSet<super::super::super::super::api::Label>> {
146        self.labels.as_ref().map(|o| &*o)
147    }
148    #[inline]
149    pub fn links(&self) -> Option<&[super::Link]> {
150        self.links.as_ref().map(|o| &**o)
151    }
152    /// Pass in an empty string to remove the run prefix.
153    #[inline]
154    pub fn run_prefix(&self) -> Option<&str> {
155        self.run_prefix.as_ref().map(|o| &**o)
156    }
157    #[inline]
158    pub fn data_sources(
159        &self,
160    ) -> Option<
161        &std::collections::BTreeMap<
162            super::super::super::api::DataSourceRefName,
163            super::CreateRunDataSource,
164        >,
165    > {
166        self.data_sources.as_ref().map(|o| &*o)
167    }
168    #[inline]
169    pub fn attachments(
170        &self,
171    ) -> Option<
172        &std::collections::BTreeSet<super::super::super::super::api::rids::AttachmentRid>,
173    > {
174        self.attachments.as_ref().map(|o| &*o)
175    }
176    #[deprecated(note = "Use assets")]
177    #[inline]
178    pub fn asset(&self) -> Option<&super::super::super::rids::api::AssetRid> {
179        self.asset.as_ref().map(|o| &*o)
180    }
181    #[inline]
182    pub fn assets(&self) -> &[super::super::super::rids::api::AssetRid] {
183        &*self.assets
184    }
185    /// If true, will blindly overwrite the existing fields with the new values in the request.
186    /// If false, will only update the fields if application constraints are maintained.
187    /// See individual field docs for more details.
188    /// Defaults to true for backwards compatibility.
189    #[inline]
190    pub fn strict_overwrite(&self) -> Option<bool> {
191        self.strict_overwrite.as_ref().map(|o| *o)
192    }
193}