drogue_client/registry/v1/data/app/
kafka.rs

1use crate::{core, dialect, Section};
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4
5#[derive(Clone, Debug, Default, Serialize, Deserialize)]
6#[serde(rename_all = "camelCase")]
7pub struct KafkaAppStatus {
8    pub observed_generation: u64,
9    pub conditions: core::v1::Conditions,
10    /// An explicit Kafka downstream status.
11    ///
12    /// This may be provided by the system to direct the downstream events (device-to-cloud) to an
13    /// alternate Kafka target. If provided, this must contain both the server as well as the topic.
14    /// Most likely, access credentials have to be provided too.
15    #[serde(default, skip_serializing_if = "Option::is_none")]
16    pub downstream: Option<KafkaDownstreamStatus>,
17    #[serde(default, skip_serializing_if = "Option::is_none")]
18    pub user: Option<KafkaUserStatus>,
19}
20
21#[derive(Clone, Debug, Default, Serialize, Deserialize)]
22#[serde(rename_all = "camelCase")]
23pub struct KafkaDownstreamStatus {
24    #[serde(default, skip_serializing_if = "String::is_empty")]
25    pub topic: String,
26    #[serde(default, skip_serializing_if = "String::is_empty")]
27    pub bootstrap_servers: String,
28    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
29    pub properties: HashMap<String, String>,
30}
31
32#[derive(Clone, Debug, Default, Serialize, Deserialize)]
33#[serde(rename_all = "camelCase")]
34pub struct KafkaUserStatus {
35    pub username: String,
36    pub password: String,
37    pub mechanism: String,
38}
39
40dialect!(KafkaAppStatus[Section::Status => "kafka"]);