Skip to main content

nominal_api/conjure/objects/scout/datasource/connection/api/
connection.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 Connection {
16    #[serde(rename = "rid")]
17    rid: super::ConnectionRid,
18    #[builder(into)]
19    #[serde(rename = "displayName")]
20    display_name: String,
21    #[builder(default, into)]
22    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
23    description: Option<String>,
24    #[builder(custom(type = super::ConnectionDetails, convert = Box::new))]
25    #[serde(rename = "connectionDetails")]
26    connection_details: Box<super::ConnectionDetails>,
27    #[builder(default, set(item(type = String, into)))]
28    #[serde(
29        rename = "requiredTagNames",
30        skip_serializing_if = "std::collections::BTreeSet::is_empty",
31        default
32    )]
33    required_tag_names: std::collections::BTreeSet<String>,
34    #[builder(default, map(key(type = String, into), value(type = String, into)))]
35    #[serde(
36        rename = "metadata",
37        skip_serializing_if = "std::collections::BTreeMap::is_empty",
38        default
39    )]
40    metadata: std::collections::BTreeMap<String, String>,
41    #[builder(
42        default,
43        custom(
44            type = impl
45            Into<Option<super::ScrapingConfig>>,
46            convert = |v|v.into().map(Box::new)
47        )
48    )]
49    #[serde(rename = "scraping", skip_serializing_if = "Option::is_none", default)]
50    scraping: Option<Box<super::ScrapingConfig>>,
51    #[serde(rename = "shouldScrape")]
52    should_scrape: bool,
53    #[builder(
54        default,
55        custom(
56            type = impl
57            Into<Option<super::LimitsConfig>>,
58            convert = |v|v.into().map(Box::new)
59        )
60    )]
61    #[serde(rename = "limits", skip_serializing_if = "Option::is_none", default)]
62    limits: Option<Box<super::LimitsConfig>>,
63    #[builder(custom(type = super::ConnectionStatus, convert = Box::new))]
64    #[serde(rename = "connectionStatus")]
65    connection_status: Box<super::ConnectionStatus>,
66    #[serde(rename = "isArchived")]
67    is_archived: bool,
68}
69impl Connection {
70    #[inline]
71    pub fn rid(&self) -> &super::ConnectionRid {
72        &self.rid
73    }
74    /// The display name of the connection. For example: "Nominal production TimescaleDB"
75    #[inline]
76    pub fn display_name(&self) -> &str {
77        &*self.display_name
78    }
79    #[inline]
80    pub fn description(&self) -> Option<&str> {
81        self.description.as_ref().map(|o| &**o)
82    }
83    #[inline]
84    pub fn connection_details(&self) -> &super::ConnectionDetails {
85        &*self.connection_details
86    }
87    /// Additional tag names that should be supplied to construct a fully qualified series. These are suggested,
88    /// rather than strictly required.
89    #[inline]
90    pub fn required_tag_names(&self) -> &std::collections::BTreeSet<String> {
91        &self.required_tag_names
92    }
93    #[inline]
94    pub fn metadata(&self) -> &std::collections::BTreeMap<String, String> {
95        &self.metadata
96    }
97    #[inline]
98    pub fn scraping(&self) -> Option<&super::ScrapingConfig> {
99        self.scraping.as_ref().map(|o| &**o)
100    }
101    /// The connection will be scraped iff this flag is set and scrapingConfig is present.
102    #[inline]
103    pub fn should_scrape(&self) -> bool {
104        self.should_scrape
105    }
106    #[inline]
107    pub fn limits(&self) -> Option<&super::LimitsConfig> {
108        self.limits.as_ref().map(|o| &**o)
109    }
110    #[inline]
111    pub fn connection_status(&self) -> &super::ConnectionStatus {
112        &*self.connection_status
113    }
114    #[inline]
115    pub fn is_archived(&self) -> bool {
116        self.is_archived
117    }
118}