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