nominal_api_conjure/conjure/objects/ingest/api/
journal_json_opts.rs1#[derive(
2 Debug,
3 Clone,
4 conjure_object::serde::Serialize,
5 conjure_object::serde::Deserialize,
6 PartialEq,
7 Eq,
8 PartialOrd,
9 Ord,
10 Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct JournalJsonOpts {
16 #[builder(custom(type = super::IngestSource, convert = Box::new))]
17 #[serde(rename = "source")]
18 source: Box<super::IngestSource>,
19 #[builder(custom(type = super::DatasetIngestTarget, convert = Box::new))]
20 #[serde(rename = "target")]
21 target: Box<super::DatasetIngestTarget>,
22 #[builder(default, into)]
23 #[serde(rename = "channel", skip_serializing_if = "Option::is_none", default)]
24 channel: Option<String>,
25 #[builder(
26 default,
27 custom(
28 type = impl
29 Into<Option<super::JournalTimestampMetadata>>,
30 convert = |v|v.into().map(Box::new)
31 )
32 )]
33 #[serde(
34 rename = "timestampMetadata",
35 skip_serializing_if = "Option::is_none",
36 default
37 )]
38 timestamp_metadata: Option<Box<super::JournalTimestampMetadata>>,
39}
40impl JournalJsonOpts {
41 #[inline]
43 pub fn new(source: super::IngestSource, target: super::DatasetIngestTarget) -> Self {
44 Self::builder().source(source).target(target).build()
45 }
46 #[inline]
47 pub fn source(&self) -> &super::IngestSource {
48 &*self.source
49 }
50 #[inline]
51 pub fn target(&self) -> &super::DatasetIngestTarget {
52 &*self.target
53 }
54 #[inline]
57 pub fn channel(&self) -> Option<&str> {
58 self.channel.as_ref().map(|o| &**o)
59 }
60 #[inline]
65 pub fn timestamp_metadata(&self) -> Option<&super::JournalTimestampMetadata> {
66 self.timestamp_metadata.as_ref().map(|o| &**o)
67 }
68}