1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/// Options for ingesting Avro data with the following schema. This is a "stream-like" file format to support
/// use cases where a columnar/tabular format does not make sense. This closely matches Nominal's streaming
/// API, making it useful for use cases where network connection drops during streaming and a backup file needs
/// to be created.
///
/// If this schema is not used, will result in a failed ingestion.
/// {
/// "type": "record",
/// "name": "AvroStream",
/// "namespace": "io.nominal.ingest",
/// "fields": [
/// {
/// "name": "channel",
/// "type": "string",
/// "doc": "Channel/series name (e.g., 'vehicle_id', 'col_1', 'temperature')",
/// },
/// {
/// "name": "timestamps",
/// "type": {"type": "array", "items": "long"},
/// "doc": "Array of numeric timestamps; see timestampType for interpretation",
/// },
/// {
/// "name": "values",
/// "type": {"type": "array", "items": ["double", "string"]},
/// "doc": "Array of values. Can either be doubles or strings",
/// },
/// {
/// "name": "tags",
/// "type": {"type": "map", "values": "string"},
/// "default": {},
/// "doc": "Key-value metadata tags",
/// },
/// ],
/// }
#[derive(
Debug,
Clone,
conjure_object::serde::Serialize,
conjure_object::serde::Deserialize,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct AvroStreamOpts {
#[builder(custom(type = super::IngestSource, convert = Box::new))]
#[serde(rename = "source")]
source: Box<super::IngestSource>,
#[builder(custom(type = super::DatasetIngestTarget, convert = Box::new))]
#[serde(rename = "target")]
target: Box<super::DatasetIngestTarget>,
#[builder(default, into)]
#[serde(
rename = "additionalFileTags",
skip_serializing_if = "Option::is_none",
default
)]
additional_file_tags: Option<
std::collections::BTreeMap<
super::super::super::api::TagName,
super::super::super::api::TagValue,
>,
>,
#[builder(
default,
custom(
type = impl
Into<Option<super::AvroNumericTimestampType>>,
convert = |v|v.into().map(Box::new)
)
)]
#[serde(rename = "timestampType", skip_serializing_if = "Option::is_none", default)]
timestamp_type: Option<Box<super::AvroNumericTimestampType>>,
}
impl AvroStreamOpts {
/// Constructs a new instance of the type.
#[inline]
pub fn new(source: super::IngestSource, target: super::DatasetIngestTarget) -> Self {
Self::builder().source(source).target(target).build()
}
#[inline]
pub fn source(&self) -> &super::IngestSource {
&*self.source
}
#[inline]
pub fn target(&self) -> &super::DatasetIngestTarget {
&*self.target
}
/// Specifies a tag set to apply to all data in the file.
#[inline]
pub fn additional_file_tags(
&self,
) -> Option<
&std::collections::BTreeMap<
super::super::super::api::TagName,
super::super::super::api::TagValue,
>,
> {
self.additional_file_tags.as_ref().map(|o| &*o)
}
/// How to interpret the numeric values in the `timestamps` array. Defaults to epoch-nanoseconds
/// when omitted, matching the original contract of this API.
#[inline]
pub fn timestamp_type(&self) -> Option<&super::AvroNumericTimestampType> {
self.timestamp_type.as_ref().map(|o| &**o)
}
}