Skip to main content

nominal_api/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(default, map(key(type = String, into), value(type = String, into)))]
45    #[serde(
46        rename = "properties",
47        skip_serializing_if = "std::collections::BTreeMap::is_empty",
48        default
49    )]
50    properties: std::collections::BTreeMap<String, String>,
51    #[builder(default, set(item(type = String, into)))]
52    #[serde(
53        rename = "labels",
54        skip_serializing_if = "std::collections::BTreeSet::is_empty",
55        default
56    )]
57    labels: std::collections::BTreeSet<String>,
58    #[serde(rename = "timestampType")]
59    timestamp_type: super::WeakTimestampType,
60    #[serde(rename = "allowStreaming")]
61    allow_streaming: bool,
62    #[serde(rename = "granularity")]
63    granularity: super::super::super::api::Granularity,
64    #[serde(rename = "isArchived")]
65    is_archived: bool,
66    #[builder(default, into)]
67    #[serde(rename = "datasetType", skip_serializing_if = "Option::is_none", default)]
68    dataset_type: Option<super::DatasetBackingType>,
69    #[builder(
70        default,
71        custom(
72            type = impl
73            Into<Option<super::DerivedDefinition>>,
74            convert = |v|v.into().map(Box::new)
75        )
76    )]
77    #[serde(
78        rename = "derivedDefinition",
79        skip_serializing_if = "Option::is_none",
80        default
81    )]
82    derived_definition: Option<Box<super::DerivedDefinition>>,
83}
84impl Dataset {
85    #[inline]
86    pub fn rid(&self) -> &conjure_object::ResourceIdentifier {
87        &self.rid
88    }
89    #[inline]
90    pub fn name(&self) -> &str {
91        &*self.name
92    }
93    #[deprecated(note = "Deprecated. Use DatasetFile#handle")]
94    #[inline]
95    pub fn handle(&self) -> Option<&super::Handle> {
96        self.handle.as_ref().map(|o| &**o)
97    }
98    #[inline]
99    pub fn description(&self) -> Option<&str> {
100        self.description.as_ref().map(|o| &**o)
101    }
102    #[inline]
103    pub fn origin_metadata(&self) -> &super::DatasetOriginMetadata {
104        &*self.origin_metadata
105    }
106    #[inline]
107    pub fn bounds(&self) -> Option<&super::Bounds> {
108        self.bounds.as_ref().map(|o| &**o)
109    }
110    #[inline]
111    pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
112        &self.properties
113    }
114    #[inline]
115    pub fn labels(&self) -> &std::collections::BTreeSet<String> {
116        &self.labels
117    }
118    #[inline]
119    pub fn timestamp_type(&self) -> &super::WeakTimestampType {
120        &self.timestamp_type
121    }
122    #[inline]
123    pub fn allow_streaming(&self) -> bool {
124        self.allow_streaming
125    }
126    #[inline]
127    pub fn granularity(&self) -> &super::super::super::api::Granularity {
128        &self.granularity
129    }
130    #[inline]
131    pub fn is_archived(&self) -> bool {
132        self.is_archived
133    }
134    #[inline]
135    pub fn dataset_type(&self) -> Option<&super::DatasetBackingType> {
136        self.dataset_type.as_ref().map(|o| &*o)
137    }
138    /// Definition for a derived dataset. When present, this dataset is virtual and backed by the referenced
139    /// DataFrame instead of persisted dataset files.
140    #[inline]
141    pub fn derived_definition(&self) -> Option<&super::DerivedDefinition> {
142        self.derived_definition.as_ref().map(|o| &**o)
143    }
144}