nominal_api_conjure/conjure/objects/scout/catalog/
create_dataset.rs1#[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 CreateDataset {
13 #[builder(into)]
14 #[serde(rename = "name")]
15 name: String,
16 #[builder(
17 default,
18 custom(
19 type = impl
20 Into<Option<super::Handle>>,
21 convert = |v|v.into().map(Box::new)
22 )
23 )]
24 #[serde(rename = "handle", skip_serializing_if = "Option::is_none", default)]
25 handle: Option<Box<super::Handle>>,
26 #[builder(default, map(key(type = String, into), value(type = String, into)))]
27 #[serde(
28 rename = "metadata",
29 skip_serializing_if = "std::collections::BTreeMap::is_empty",
30 default
31 )]
32 metadata: std::collections::BTreeMap<String, String>,
33 #[builder(custom(type = super::DatasetOriginMetadata, convert = Box::new))]
34 #[serde(rename = "originMetadata")]
35 origin_metadata: Box<super::DatasetOriginMetadata>,
36 #[builder(default, set(item(type = super::super::super::api::Label)))]
37 #[serde(
38 rename = "labels",
39 skip_serializing_if = "std::collections::BTreeSet::is_empty",
40 default
41 )]
42 labels: std::collections::BTreeSet<super::super::super::api::Label>,
43 #[builder(
44 default,
45 map(
46 key(type = super::super::super::api::PropertyName),
47 value(type = super::super::super::api::PropertyValue)
48 )
49 )]
50 #[serde(
51 rename = "properties",
52 skip_serializing_if = "std::collections::BTreeMap::is_empty",
53 default
54 )]
55 properties: std::collections::BTreeMap<
56 super::super::super::api::PropertyName,
57 super::super::super::api::PropertyValue,
58 >,
59 #[builder(
60 default,
61 map(
62 key(type = super::super::super::api::PropertyName),
63 value(type = super::super::super::api::TypedPropertyValue)
64 )
65 )]
66 #[serde(
67 rename = "typedProperties",
68 skip_serializing_if = "std::collections::BTreeMap::is_empty",
69 default
70 )]
71 typed_properties: std::collections::BTreeMap<
72 super::super::super::api::PropertyName,
73 super::super::super::api::TypedPropertyValue,
74 >,
75 #[builder(default, into)]
76 #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
77 description: Option<String>,
78 #[builder(default, into)]
79 #[serde(rename = "granularity", skip_serializing_if = "Option::is_none", default)]
80 granularity: Option<super::super::super::api::Granularity>,
81 #[builder(default, into)]
82 #[serde(rename = "isV2Dataset", skip_serializing_if = "Option::is_none", default)]
83 is_v2_dataset: Option<bool>,
84 #[builder(default, into)]
85 #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
86 workspace: Option<super::super::super::api::rids::WorkspaceRid>,
87 #[builder(default, set(item(type = super::super::rids::api::MarkingRid)))]
88 #[serde(
89 rename = "markingRids",
90 skip_serializing_if = "std::collections::BTreeSet::is_empty",
91 default
92 )]
93 marking_rids: std::collections::BTreeSet<super::super::rids::api::MarkingRid>,
94 #[builder(default, into)]
95 #[serde(rename = "datasetType", skip_serializing_if = "Option::is_none", default)]
96 dataset_type: Option<super::DatasetBackingType>,
97 #[builder(
98 default,
99 custom(
100 type = impl
101 Into<Option<super::CreateDerivedDefinition>>,
102 convert = |v|v.into().map(Box::new)
103 )
104 )]
105 #[serde(
106 rename = "derivedDefinition",
107 skip_serializing_if = "Option::is_none",
108 default
109 )]
110 derived_definition: Option<Box<super::CreateDerivedDefinition>>,
111}
112impl CreateDataset {
113 #[inline]
115 pub fn new(
116 name: impl Into<String>,
117 origin_metadata: super::DatasetOriginMetadata,
118 ) -> Self {
119 Self::builder().name(name).origin_metadata(origin_metadata).build()
120 }
121 #[inline]
122 pub fn name(&self) -> &str {
123 &*self.name
124 }
125 #[deprecated(
126 note = "Handles should only be specified when adding files to datasets"
127 )]
128 #[inline]
129 pub fn handle(&self) -> Option<&super::Handle> {
130 self.handle.as_ref().map(|o| &**o)
131 }
132 #[deprecated(note = "Deprecated in favor of properties")]
133 #[inline]
134 pub fn metadata(&self) -> &std::collections::BTreeMap<String, String> {
135 &self.metadata
136 }
137 #[inline]
138 pub fn origin_metadata(&self) -> &super::DatasetOriginMetadata {
139 &*self.origin_metadata
140 }
141 #[inline]
142 pub fn labels(
143 &self,
144 ) -> &std::collections::BTreeSet<super::super::super::api::Label> {
145 &self.labels
146 }
147 #[deprecated(note = "use typedProperties")]
149 #[inline]
150 pub fn properties(
151 &self,
152 ) -> &std::collections::BTreeMap<
153 super::super::super::api::PropertyName,
154 super::super::super::api::PropertyValue,
155 > {
156 &self.properties
157 }
158 #[inline]
159 pub fn typed_properties(
160 &self,
161 ) -> &std::collections::BTreeMap<
162 super::super::super::api::PropertyName,
163 super::super::super::api::TypedPropertyValue,
164 > {
165 &self.typed_properties
166 }
167 #[inline]
168 pub fn description(&self) -> Option<&str> {
169 self.description.as_ref().map(|o| &**o)
170 }
171 #[inline]
173 pub fn granularity(&self) -> Option<&super::super::super::api::Granularity> {
174 self.granularity.as_ref().map(|o| &*o)
175 }
176 #[deprecated(
178 note = "Regardless of what value is specified, this flag is treated as true by the service."
179 )]
180 #[inline]
181 pub fn is_v2_dataset(&self) -> Option<bool> {
182 self.is_v2_dataset.as_ref().map(|o| *o)
183 }
184 #[inline]
187 pub fn workspace(&self) -> Option<&super::super::super::api::rids::WorkspaceRid> {
188 self.workspace.as_ref().map(|o| &*o)
189 }
190 #[inline]
193 pub fn marking_rids(
194 &self,
195 ) -> &std::collections::BTreeSet<super::super::rids::api::MarkingRid> {
196 &self.marking_rids
197 }
198 #[inline]
200 pub fn dataset_type(&self) -> Option<&super::DatasetBackingType> {
201 self.dataset_type.as_ref().map(|o| &*o)
202 }
203 #[inline]
206 pub fn derived_definition(&self) -> Option<&super::CreateDerivedDefinition> {
207 self.derived_definition.as_ref().map(|o| &**o)
208 }
209}