Skip to main content

nominal_api_conjure/conjure/objects/scout/catalog/
dataset_file.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 DatasetFile {
13    #[serde(rename = "id")]
14    id: super::super::super::datasource::DatasetFileId,
15    #[serde(rename = "datasetRid")]
16    dataset_rid: conjure_object::ResourceIdentifier,
17    #[builder(into)]
18    #[serde(rename = "name")]
19    name: String,
20    #[builder(custom(type = super::Handle, convert = Box::new))]
21    #[serde(rename = "handle")]
22    handle: Box<super::Handle>,
23    #[builder(default, into)]
24    #[serde(rename = "fileSizeBytes", skip_serializing_if = "Option::is_none", default)]
25    file_size_bytes: Option<conjure_object::SafeLong>,
26    #[builder(
27        default,
28        custom(
29            type = impl
30            Into<Option<super::Bounds>>,
31            convert = |v|v.into().map(Box::new)
32        )
33    )]
34    #[serde(rename = "bounds", skip_serializing_if = "Option::is_none", default)]
35    bounds: Option<Box<super::Bounds>>,
36    #[serde(rename = "uploadedAt")]
37    uploaded_at: conjure_object::DateTime<conjure_object::Utc>,
38    #[builder(default, into)]
39    #[serde(rename = "ingestedAt", skip_serializing_if = "Option::is_none", default)]
40    ingested_at: Option<conjure_object::DateTime<conjure_object::Utc>>,
41    #[builder(
42        custom(type = super::super::super::api::IngestStatusV2, convert = Box::new)
43    )]
44    #[serde(rename = "ingestStatus")]
45    ingest_status: Box<super::super::super::api::IngestStatusV2>,
46    #[builder(
47        default,
48        custom(
49            type = impl
50            Into<Option<super::TimestampMetadata>>,
51            convert = |v|v.into().map(Box::new)
52        )
53    )]
54    #[serde(
55        rename = "timestampMetadata",
56        skip_serializing_if = "Option::is_none",
57        default
58    )]
59    timestamp_metadata: Option<Box<super::TimestampMetadata>>,
60    #[builder(
61        default,
62        custom(
63            type = impl
64            Into<Option<super::IngestTagMetadata>>,
65            convert = |v|v.into().map(Box::new)
66        )
67    )]
68    #[serde(
69        rename = "ingestTagMetadata",
70        skip_serializing_if = "Option::is_none",
71        default
72    )]
73    ingest_tag_metadata: Option<Box<super::IngestTagMetadata>>,
74    #[builder(default, into)]
75    #[serde(
76        rename = "originFilePaths",
77        skip_serializing_if = "Option::is_none",
78        default
79    )]
80    origin_file_paths: Option<Vec<String>>,
81    #[builder(default, into)]
82    #[serde(rename = "ingestJobRid", skip_serializing_if = "Option::is_none", default)]
83    ingest_job_rid: Option<conjure_object::ResourceIdentifier>,
84    #[builder(default, into)]
85    #[serde(rename = "deletedAt", skip_serializing_if = "Option::is_none", default)]
86    deleted_at: Option<conjure_object::DateTime<conjure_object::Utc>>,
87    #[builder(
88        default,
89        custom(
90            type = impl
91            Into<Option<super::DatasetFileMetadata>>,
92            convert = |v|v.into().map(Box::new)
93        )
94    )]
95    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none", default)]
96    metadata: Option<Box<super::DatasetFileMetadata>>,
97}
98impl DatasetFile {
99    #[inline]
100    pub fn id(&self) -> super::super::super::datasource::DatasetFileId {
101        self.id
102    }
103    #[inline]
104    pub fn dataset_rid(&self) -> &conjure_object::ResourceIdentifier {
105        &self.dataset_rid
106    }
107    #[inline]
108    pub fn name(&self) -> &str {
109        &*self.name
110    }
111    #[inline]
112    pub fn handle(&self) -> &super::Handle {
113        &*self.handle
114    }
115    /// Size in bytes of the stored dataset file; for transforming ingests this is the produced output, not the original upload.
116    #[inline]
117    pub fn file_size_bytes(&self) -> Option<conjure_object::SafeLong> {
118        self.file_size_bytes.as_ref().map(|o| *o)
119    }
120    #[inline]
121    pub fn bounds(&self) -> Option<&super::Bounds> {
122        self.bounds.as_ref().map(|o| &**o)
123    }
124    /// Timestamp that the file was received and stored, but not processed or made available to consumers.
125    #[inline]
126    pub fn uploaded_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
127        self.uploaded_at
128    }
129    /// Timestamp that the file is ingested at and made available for processing. If the file has failed to be
130    /// ingested for any reason or is still being processed, then this value will be empty.
131    #[inline]
132    pub fn ingested_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
133        self.ingested_at.as_ref().map(|o| *o)
134    }
135    #[inline]
136    pub fn ingest_status(&self) -> &super::super::super::api::IngestStatusV2 {
137        &*self.ingest_status
138    }
139    #[inline]
140    pub fn timestamp_metadata(&self) -> Option<&super::TimestampMetadata> {
141        self.timestamp_metadata.as_ref().map(|o| &**o)
142    }
143    #[inline]
144    pub fn ingest_tag_metadata(&self) -> Option<&super::IngestTagMetadata> {
145        self.ingest_tag_metadata.as_ref().map(|o| &**o)
146    }
147    #[inline]
148    pub fn origin_file_paths(&self) -> Option<&[String]> {
149        self.origin_file_paths.as_ref().map(|o| &**o)
150    }
151    #[inline]
152    pub fn ingest_job_rid(&self) -> Option<&conjure_object::ResourceIdentifier> {
153        self.ingest_job_rid.as_ref().map(|o| &*o)
154    }
155    /// Timestamp that the file is deleted at, only present if the file has been deleted.
156    #[inline]
157    pub fn deleted_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
158        self.deleted_at.as_ref().map(|o| *o)
159    }
160    /// File-type-specific metadata. For video files, contains timestamp manifest and segment metadata.
161    #[inline]
162    pub fn metadata(&self) -> Option<&super::DatasetFileMetadata> {
163        self.metadata.as_ref().map(|o| &**o)
164    }
165}