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