Skip to main content

nominal_api_conjure/conjure/objects/scout/catalog/
dataset.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 Dataset {
13    #[serde(rename = "rid")]
14    rid: conjure_object::ResourceIdentifier,
15    #[builder(into)]
16    #[serde(rename = "name")]
17    name: String,
18    #[builder(
19        default,
20        custom(
21            type = impl
22            Into<Option<super::Handle>>,
23            convert = |v|v.into().map(Box::new)
24        )
25    )]
26    #[serde(rename = "handle", skip_serializing_if = "Option::is_none", default)]
27    handle: Option<Box<super::Handle>>,
28    #[builder(default, into)]
29    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
30    description: Option<String>,
31    #[builder(custom(type = super::DatasetOriginMetadata, convert = Box::new))]
32    #[serde(rename = "originMetadata")]
33    origin_metadata: Box<super::DatasetOriginMetadata>,
34    #[builder(
35        default,
36        custom(
37            type = impl
38            Into<Option<super::Bounds>>,
39            convert = |v|v.into().map(Box::new)
40        )
41    )]
42    #[serde(rename = "bounds", skip_serializing_if = "Option::is_none", default)]
43    bounds: Option<Box<super::Bounds>>,
44    #[builder(
45        default,
46        map(
47            key(type = super::super::super::api::PropertyName),
48            value(type = super::super::super::api::PropertyValue)
49        )
50    )]
51    #[serde(
52        rename = "properties",
53        skip_serializing_if = "std::collections::BTreeMap::is_empty",
54        default
55    )]
56    properties: std::collections::BTreeMap<
57        super::super::super::api::PropertyName,
58        super::super::super::api::PropertyValue,
59    >,
60    #[builder(
61        default,
62        map(
63            key(type = super::super::super::api::PropertyName),
64            value(type = super::super::super::api::TypedPropertyValue)
65        )
66    )]
67    #[serde(
68        rename = "typedProperties",
69        skip_serializing_if = "std::collections::BTreeMap::is_empty",
70        default
71    )]
72    typed_properties: std::collections::BTreeMap<
73        super::super::super::api::PropertyName,
74        super::super::super::api::TypedPropertyValue,
75    >,
76    #[builder(default, set(item(type = super::super::super::api::Label)))]
77    #[serde(
78        rename = "labels",
79        skip_serializing_if = "std::collections::BTreeSet::is_empty",
80        default
81    )]
82    labels: std::collections::BTreeSet<super::super::super::api::Label>,
83    #[serde(rename = "timestampType")]
84    timestamp_type: super::WeakTimestampType,
85    #[serde(rename = "allowStreaming")]
86    allow_streaming: bool,
87    #[serde(rename = "granularity")]
88    granularity: super::super::super::api::Granularity,
89    #[serde(rename = "isArchived")]
90    is_archived: bool,
91    #[builder(default, into)]
92    #[serde(rename = "datasetType", skip_serializing_if = "Option::is_none", default)]
93    dataset_type: Option<super::DatasetBackingType>,
94    #[builder(
95        default,
96        custom(
97            type = impl
98            Into<Option<super::DerivedDefinition>>,
99            convert = |v|v.into().map(Box::new)
100        )
101    )]
102    #[serde(
103        rename = "derivedDefinition",
104        skip_serializing_if = "Option::is_none",
105        default
106    )]
107    derived_definition: Option<Box<super::DerivedDefinition>>,
108}
109impl Dataset {
110    #[inline]
111    pub fn rid(&self) -> &conjure_object::ResourceIdentifier {
112        &self.rid
113    }
114    #[inline]
115    pub fn name(&self) -> &str {
116        &*self.name
117    }
118    #[deprecated(note = "Deprecated. Use DatasetFile#handle")]
119    #[inline]
120    pub fn handle(&self) -> Option<&super::Handle> {
121        self.handle.as_ref().map(|o| &**o)
122    }
123    #[inline]
124    pub fn description(&self) -> Option<&str> {
125        self.description.as_ref().map(|o| &**o)
126    }
127    #[inline]
128    pub fn origin_metadata(&self) -> &super::DatasetOriginMetadata {
129        &*self.origin_metadata
130    }
131    #[inline]
132    pub fn bounds(&self) -> Option<&super::Bounds> {
133        self.bounds.as_ref().map(|o| &**o)
134    }
135    #[deprecated(note = "use typedProperties")]
136    #[inline]
137    pub fn properties(
138        &self,
139    ) -> &std::collections::BTreeMap<
140        super::super::super::api::PropertyName,
141        super::super::super::api::PropertyValue,
142    > {
143        &self.properties
144    }
145    #[inline]
146    pub fn typed_properties(
147        &self,
148    ) -> &std::collections::BTreeMap<
149        super::super::super::api::PropertyName,
150        super::super::super::api::TypedPropertyValue,
151    > {
152        &self.typed_properties
153    }
154    #[inline]
155    pub fn labels(
156        &self,
157    ) -> &std::collections::BTreeSet<super::super::super::api::Label> {
158        &self.labels
159    }
160    #[inline]
161    pub fn timestamp_type(&self) -> &super::WeakTimestampType {
162        &self.timestamp_type
163    }
164    #[inline]
165    pub fn allow_streaming(&self) -> bool {
166        self.allow_streaming
167    }
168    #[inline]
169    pub fn granularity(&self) -> &super::super::super::api::Granularity {
170        &self.granularity
171    }
172    #[inline]
173    pub fn is_archived(&self) -> bool {
174        self.is_archived
175    }
176    #[inline]
177    pub fn dataset_type(&self) -> Option<&super::DatasetBackingType> {
178        self.dataset_type.as_ref().map(|o| &*o)
179    }
180    /// Definition for a derived dataset. When present, this dataset is virtual and backed by the referenced
181    /// provided Dataset definition instead of persisted dataset files.
182    #[inline]
183    pub fn derived_definition(&self) -> Option<&super::DerivedDefinition> {
184        self.derived_definition.as_ref().map(|o| &**o)
185    }
186}