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