Skip to main content

nominal_api/conjure/objects/ingest/api/
journal_json_opts.rs

1#[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<super::super::super::api::Channel>,
25}
26impl JournalJsonOpts {
27    /// Constructs a new instance of the type.
28    #[inline]
29    pub fn new(source: super::IngestSource, target: super::DatasetIngestTarget) -> Self {
30        Self::builder().source(source).target(target).build()
31    }
32    #[inline]
33    pub fn source(&self) -> &super::IngestSource {
34        &*self.source
35    }
36    #[inline]
37    pub fn target(&self) -> &super::DatasetIngestTarget {
38        &*self.target
39    }
40    /// If provided, ingests logs to the given channel.
41    /// By default, log data will be ingested to a channel named 'logs'.
42    #[inline]
43    pub fn channel(&self) -> Option<&super::super::super::api::Channel> {
44        self.channel.as_ref().map(|o| &*o)
45    }
46}