Skip to main content

nominal_api/conjure/objects/scout/spatial/api/
create_spatial_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 CreateSpatialRequest {
13    #[builder(into)]
14    #[serde(rename = "title")]
15    title: String,
16    #[serde(rename = "daggerUuid")]
17    dagger_uuid: conjure_object::Uuid,
18    #[builder(custom(type = super::SpatialTypeMetadata, convert = Box::new))]
19    #[serde(rename = "typeMetadata")]
20    type_metadata: Box<super::SpatialTypeMetadata>,
21    #[builder(default, set(item(type = super::super::super::super::api::Label)))]
22    #[serde(
23        rename = "labels",
24        skip_serializing_if = "std::collections::BTreeSet::is_empty",
25        default
26    )]
27    labels: std::collections::BTreeSet<super::super::super::super::api::Label>,
28    #[builder(
29        default,
30        map(
31            key(type = super::super::super::super::api::PropertyName),
32            value(type = super::super::super::super::api::PropertyValue)
33        )
34    )]
35    #[serde(
36        rename = "properties",
37        skip_serializing_if = "std::collections::BTreeMap::is_empty",
38        default
39    )]
40    properties: std::collections::BTreeMap<
41        super::super::super::super::api::PropertyName,
42        super::super::super::super::api::PropertyValue,
43    >,
44    #[builder(default, set(item(type = super::super::super::rids::api::MarkingRid)))]
45    #[serde(
46        rename = "markingRids",
47        skip_serializing_if = "std::collections::BTreeSet::is_empty",
48        default
49    )]
50    marking_rids: std::collections::BTreeSet<super::super::super::rids::api::MarkingRid>,
51    #[builder(default, into)]
52    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
53    description: Option<String>,
54    #[builder(
55        default,
56        custom(
57            type = impl
58            Into<Option<super::super::super::super::api::Timestamp>>,
59            convert = |v|v.into().map(Box::new)
60        )
61    )]
62    #[serde(rename = "startTimestamp", skip_serializing_if = "Option::is_none", default)]
63    start_timestamp: Option<Box<super::super::super::super::api::Timestamp>>,
64    #[builder(
65        default,
66        custom(
67            type = impl
68            Into<Option<super::super::super::super::api::Timestamp>>,
69            convert = |v|v.into().map(Box::new)
70        )
71    )]
72    #[serde(rename = "endTimestamp", skip_serializing_if = "Option::is_none", default)]
73    end_timestamp: Option<Box<super::super::super::super::api::Timestamp>>,
74    #[builder(
75        default,
76        custom(
77            type = impl
78            Into<Option<super::super::super::super::api::Handle>>,
79            convert = |v|v.into().map(Box::new)
80        )
81    )]
82    #[serde(rename = "sourceHandle", skip_serializing_if = "Option::is_none", default)]
83    source_handle: Option<Box<super::super::super::super::api::Handle>>,
84    #[builder(default, into)]
85    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
86    workspace: Option<super::super::super::super::api::rids::WorkspaceRid>,
87}
88impl CreateSpatialRequest {
89    /// Constructs a new instance of the type.
90    #[inline]
91    pub fn new(
92        title: impl Into<String>,
93        dagger_uuid: conjure_object::Uuid,
94        type_metadata: super::SpatialTypeMetadata,
95    ) -> Self {
96        Self::builder()
97            .title(title)
98            .dagger_uuid(dagger_uuid)
99            .type_metadata(type_metadata)
100            .build()
101    }
102    #[inline]
103    pub fn title(&self) -> &str {
104        &*self.title
105    }
106    /// UUID of the Dagger model that backs this spatial asset. Callers must create the
107    /// model in Dagger before calling create.
108    #[inline]
109    pub fn dagger_uuid(&self) -> conjure_object::Uuid {
110        self.dagger_uuid
111    }
112    #[inline]
113    pub fn type_metadata(&self) -> &super::SpatialTypeMetadata {
114        &*self.type_metadata
115    }
116    #[inline]
117    pub fn labels(
118        &self,
119    ) -> &std::collections::BTreeSet<super::super::super::super::api::Label> {
120        &self.labels
121    }
122    #[inline]
123    pub fn properties(
124        &self,
125    ) -> &std::collections::BTreeMap<
126        super::super::super::super::api::PropertyName,
127        super::super::super::super::api::PropertyValue,
128    > {
129        &self.properties
130    }
131    /// The markings to apply to the created spatial asset.
132    /// If not provided, the asset will be visible to all users in the same workspace.
133    #[inline]
134    pub fn marking_rids(
135        &self,
136    ) -> &std::collections::BTreeSet<super::super::super::rids::api::MarkingRid> {
137        &self.marking_rids
138    }
139    #[inline]
140    pub fn description(&self) -> Option<&str> {
141        self.description.as_ref().map(|o| &**o)
142    }
143    /// Start of the time range covered by this spatial asset.
144    #[inline]
145    pub fn start_timestamp(
146        &self,
147    ) -> Option<&super::super::super::super::api::Timestamp> {
148        self.start_timestamp.as_ref().map(|o| &**o)
149    }
150    /// End of the time range covered by this spatial asset.
151    #[inline]
152    pub fn end_timestamp(&self) -> Option<&super::super::super::super::api::Timestamp> {
153        self.end_timestamp.as_ref().map(|o| &**o)
154    }
155    /// Optional reference to the original source data (e.g., S3 path) for provenance tracking.
156    #[inline]
157    pub fn source_handle(&self) -> Option<&super::super::super::super::api::Handle> {
158        self.source_handle.as_ref().map(|o| &**o)
159    }
160    /// The workspace in which to create the spatial asset. If not provided, the asset will be created in
161    /// the default workspace for the user's organization, if the default workspace is configured.
162    #[inline]
163    pub fn workspace(
164        &self,
165    ) -> Option<&super::super::super::super::api::rids::WorkspaceRid> {
166        self.workspace.as_ref().map(|o| &*o)
167    }
168}