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(default, map(key(type = String, into), value(type = String, into)))]
39    #[serde(
40        rename = "properties",
41        skip_serializing_if = "std::collections::BTreeMap::is_empty",
42        default
43    )]
44    properties: std::collections::BTreeMap<String, String>,
45    #[builder(default, set(item(type = String, into)))]
46    #[serde(
47        rename = "labels",
48        skip_serializing_if = "std::collections::BTreeSet::is_empty",
49        default
50    )]
51    labels: std::collections::BTreeSet<String>,
52    #[builder(default, into)]
53    #[serde(rename = "runPrefix", skip_serializing_if = "Option::is_none", default)]
54    run_prefix: Option<String>,
55    #[builder(
56        default,
57        map(
58            key(type = super::DataSourceRefName),
59            value(type = super::IngestRunDataSource)
60        )
61    )]
62    #[serde(
63        rename = "dataSources",
64        skip_serializing_if = "std::collections::BTreeMap::is_empty",
65        default
66    )]
67    data_sources: std::collections::BTreeMap<
68        super::DataSourceRefName,
69        super::IngestRunDataSource,
70    >,
71    #[builder(default, into)]
72    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
73    workspace: Option<conjure_object::ResourceIdentifier>,
74}
75impl IngestRunRequest {
76    /// Constructs a new instance of the type.
77    #[inline]
78    pub fn new(
79        title: impl Into<String>,
80        description: impl Into<String>,
81        start_time: super::UtcTimestamp,
82    ) -> Self {
83        Self::builder()
84            .title(title)
85            .description(description)
86            .start_time(start_time)
87            .build()
88    }
89    /// If a run with the same rid already exists, the run will be updated.
90    #[inline]
91    pub fn rid(&self) -> Option<&conjure_object::ResourceIdentifier> {
92        self.rid.as_ref().map(|o| &*o)
93    }
94    #[inline]
95    pub fn title(&self) -> &str {
96        &*self.title
97    }
98    #[inline]
99    pub fn description(&self) -> &str {
100        &*self.description
101    }
102    #[inline]
103    pub fn start_time(&self) -> &super::UtcTimestamp {
104        &*self.start_time
105    }
106    #[inline]
107    pub fn end_time(&self) -> Option<&super::UtcTimestamp> {
108        self.end_time.as_ref().map(|o| &**o)
109    }
110    #[inline]
111    pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
112        &self.properties
113    }
114    #[inline]
115    pub fn labels(&self) -> &std::collections::BTreeSet<String> {
116        &self.labels
117    }
118    /// for example, SIM, HTL, FLT
119    #[inline]
120    pub fn run_prefix(&self) -> Option<&str> {
121        self.run_prefix.as_ref().map(|o| &**o)
122    }
123    #[inline]
124    pub fn data_sources(
125        &self,
126    ) -> &std::collections::BTreeMap<
127        super::DataSourceRefName,
128        super::IngestRunDataSource,
129    > {
130        &self.data_sources
131    }
132    /// The workspace in which to create the dataset. If not provided, the dataset will be created in the default workspace for
133    /// the user's organization, if the default workspace for the organization is configured.
134    #[inline]
135    pub fn workspace(&self) -> Option<&conjure_object::ResourceIdentifier> {
136        self.workspace.as_ref().map(|o| &*o)
137    }
138}