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