Skip to main content

nominal_api/conjure/objects/ingest/api/
ingest_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 IngestRunRequest {
16    #[builder(default, into)]
17    #[serde(rename = "rid", skip_serializing_if = "Option::is_none", default)]
18    rid: Option<conjure_object::ResourceIdentifier>,
19    #[builder(into)]
20    #[serde(rename = "title")]
21    title: String,
22    #[builder(into)]
23    #[serde(rename = "description")]
24    description: String,
25    #[builder(custom(type = super::UtcTimestamp, convert = Box::new))]
26    #[serde(rename = "startTime")]
27    start_time: Box<super::UtcTimestamp>,
28    #[builder(
29        default,
30        custom(
31            type = impl
32            Into<Option<super::UtcTimestamp>>,
33            convert = |v|v.into().map(Box::new)
34        )
35    )]
36    #[serde(rename = "endTime", skip_serializing_if = "Option::is_none", default)]
37    end_time: Option<Box<super::UtcTimestamp>>,
38    #[builder(
39        default,
40        map(
41            key(type = super::super::super::api::PropertyName),
42            value(type = super::super::super::api::PropertyValue)
43        )
44    )]
45    #[serde(
46        rename = "properties",
47        skip_serializing_if = "std::collections::BTreeMap::is_empty",
48        default
49    )]
50    properties: std::collections::BTreeMap<
51        super::super::super::api::PropertyName,
52        super::super::super::api::PropertyValue,
53    >,
54    #[builder(default, set(item(type = super::super::super::api::Label)))]
55    #[serde(
56        rename = "labels",
57        skip_serializing_if = "std::collections::BTreeSet::is_empty",
58        default
59    )]
60    labels: std::collections::BTreeSet<super::super::super::api::Label>,
61    #[builder(default, into)]
62    #[serde(rename = "runPrefix", skip_serializing_if = "Option::is_none", default)]
63    run_prefix: Option<String>,
64    #[builder(
65        default,
66        map(
67            key(type = super::DataSourceRefName),
68            value(type = super::IngestRunDataSource)
69        )
70    )]
71    #[serde(
72        rename = "dataSources",
73        skip_serializing_if = "std::collections::BTreeMap::is_empty",
74        default
75    )]
76    data_sources: std::collections::BTreeMap<
77        super::DataSourceRefName,
78        super::IngestRunDataSource,
79    >,
80    #[builder(default, into)]
81    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
82    workspace: Option<super::super::super::api::rids::WorkspaceRid>,
83}
84impl IngestRunRequest {
85    /// Constructs a new instance of the type.
86    #[inline]
87    pub fn new(
88        title: impl Into<String>,
89        description: impl Into<String>,
90        start_time: super::UtcTimestamp,
91    ) -> Self {
92        Self::builder()
93            .title(title)
94            .description(description)
95            .start_time(start_time)
96            .build()
97    }
98    /// If a run with the same rid already exists, the run will be updated.
99    #[inline]
100    pub fn rid(&self) -> Option<&conjure_object::ResourceIdentifier> {
101        self.rid.as_ref().map(|o| &*o)
102    }
103    #[inline]
104    pub fn title(&self) -> &str {
105        &*self.title
106    }
107    #[inline]
108    pub fn description(&self) -> &str {
109        &*self.description
110    }
111    #[inline]
112    pub fn start_time(&self) -> &super::UtcTimestamp {
113        &*self.start_time
114    }
115    #[inline]
116    pub fn end_time(&self) -> Option<&super::UtcTimestamp> {
117        self.end_time.as_ref().map(|o| &**o)
118    }
119    #[inline]
120    pub fn properties(
121        &self,
122    ) -> &std::collections::BTreeMap<
123        super::super::super::api::PropertyName,
124        super::super::super::api::PropertyValue,
125    > {
126        &self.properties
127    }
128    #[inline]
129    pub fn labels(
130        &self,
131    ) -> &std::collections::BTreeSet<super::super::super::api::Label> {
132        &self.labels
133    }
134    /// for example, SIM, HTL, FLT
135    #[inline]
136    pub fn run_prefix(&self) -> Option<&str> {
137        self.run_prefix.as_ref().map(|o| &**o)
138    }
139    #[inline]
140    pub fn data_sources(
141        &self,
142    ) -> &std::collections::BTreeMap<
143        super::DataSourceRefName,
144        super::IngestRunDataSource,
145    > {
146        &self.data_sources
147    }
148    /// The workspace in which to create the dataset. If not provided, the dataset will be created in the default workspace for
149    /// the user's organization, if the default workspace for the organization is configured.
150    #[inline]
151    pub fn workspace(&self) -> Option<&super::super::super::api::rids::WorkspaceRid> {
152        self.workspace.as_ref().map(|o| &*o)
153    }
154}