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(
86        rename = "ingestTransformRid",
87        skip_serializing_if = "Option::is_none",
88        default
89    )]
90    ingest_transform_rid: Option<conjure_object::ResourceIdentifier>,
91    #[builder(default, into)]
92    #[serde(rename = "deletedAt", skip_serializing_if = "Option::is_none", default)]
93    deleted_at: Option<conjure_object::DateTime<conjure_object::Utc>>,
94    #[builder(
95        default,
96        custom(
97            type = impl
98            Into<Option<super::DatasetFileMetadata>>,
99            convert = |v|v.into().map(Box::new)
100        )
101    )]
102    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none", default)]
103    metadata: Option<Box<super::DatasetFileMetadata>>,
104}
105impl DatasetFile {
106    #[inline]
107    pub fn id(&self) -> super::super::super::datasource::DatasetFileId {
108        self.id
109    }
110    #[inline]
111    pub fn dataset_rid(&self) -> &conjure_object::ResourceIdentifier {
112        &self.dataset_rid
113    }
114    #[inline]
115    pub fn name(&self) -> &str {
116        &*self.name
117    }
118    #[inline]
119    pub fn handle(&self) -> &super::Handle {
120        &*self.handle
121    }
122    /// Size in bytes of the stored dataset file; for transforming ingests this is the produced output, not the original upload.
123    #[inline]
124    pub fn file_size_bytes(&self) -> Option<conjure_object::SafeLong> {
125        self.file_size_bytes.as_ref().map(|o| *o)
126    }
127    #[inline]
128    pub fn bounds(&self) -> Option<&super::Bounds> {
129        self.bounds.as_ref().map(|o| &**o)
130    }
131    /// Timestamp that the file was received and stored, but not processed or made available to consumers.
132    #[inline]
133    pub fn uploaded_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
134        self.uploaded_at
135    }
136    /// Timestamp that the file is ingested at and made available for processing. If the file has failed to be
137    /// ingested for any reason or is still being processed, then this value will be empty.
138    #[inline]
139    pub fn ingested_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
140        self.ingested_at.as_ref().map(|o| *o)
141    }
142    /// Ingest status. The in-progress sub-phases (queued, parsing, ingesting) are surfaced as inProgress with
143    /// the phase carried in InProgressResult.inProgressDetails, so consumers see a stable top-level lifecycle.
144    #[inline]
145    pub fn ingest_status(&self) -> &super::super::super::api::IngestStatusV2 {
146        &*self.ingest_status
147    }
148    #[inline]
149    pub fn timestamp_metadata(&self) -> Option<&super::TimestampMetadata> {
150        self.timestamp_metadata.as_ref().map(|o| &**o)
151    }
152    #[inline]
153    pub fn ingest_tag_metadata(&self) -> Option<&super::IngestTagMetadata> {
154        self.ingest_tag_metadata.as_ref().map(|o| &**o)
155    }
156    #[inline]
157    pub fn origin_file_paths(&self) -> Option<&[String]> {
158        self.origin_file_paths.as_ref().map(|o| &**o)
159    }
160    #[inline]
161    pub fn ingest_job_rid(&self) -> Option<&conjure_object::ResourceIdentifier> {
162        self.ingest_job_rid.as_ref().map(|o| &*o)
163    }
164    /// The ingest transform within ingestJobRid that produced this file. An ingest job may fan out
165    /// to many transforms, so this pins the file to the specific unit of work (and extractor) that
166    /// created it — resolvable via IngestJobService#getIngestTransform. Extractor logs are tagged
167    /// with this transform's UUID (the RID locator), so this also links a file to the logs of the
168    /// transform that produced it. Absent for directly uploaded files and for files ingested before
169    /// this link was recorded.
170    #[inline]
171    pub fn ingest_transform_rid(&self) -> Option<&conjure_object::ResourceIdentifier> {
172        self.ingest_transform_rid.as_ref().map(|o| &*o)
173    }
174    /// Timestamp that the file is deleted at, only present if the file has been deleted.
175    #[inline]
176    pub fn deleted_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
177        self.deleted_at.as_ref().map(|o| *o)
178    }
179    /// File-type-specific metadata. For video files, contains timestamp manifest and segment metadata.
180    #[inline]
181    pub fn metadata(&self) -> Option<&super::DatasetFileMetadata> {
182        self.metadata.as_ref().map(|o| &**o)
183    }
184}