Skip to main content

nominal_api/conjure/objects/scout/datasource/connection/api/
update_connection_request.rs

1/// Fields that are empty will be treated as a no-op update.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    PartialEq,
8    Eq,
9    PartialOrd,
10    Ord,
11    Hash
12)]
13#[serde(crate = "conjure_object::serde")]
14#[conjure_object::private::staged_builder::staged_builder]
15#[builder(crate = conjure_object::private::staged_builder, update, inline)]
16pub struct UpdateConnectionRequest {
17    #[builder(default, into)]
18    #[serde(rename = "name", skip_serializing_if = "Option::is_none", default)]
19    name: Option<String>,
20    #[builder(default, into)]
21    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
22    description: Option<String>,
23    #[builder(default, into)]
24    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none", default)]
25    metadata: Option<std::collections::BTreeMap<String, String>>,
26    #[builder(
27        default,
28        custom(
29            type = impl
30            Into<Option<super::ConnectionDetails>>,
31            convert = |v|v.into().map(Box::new)
32        )
33    )]
34    #[serde(
35        rename = "connectionDetails",
36        skip_serializing_if = "Option::is_none",
37        default
38    )]
39    connection_details: Option<Box<super::ConnectionDetails>>,
40    #[builder(default, into)]
41    #[serde(
42        rename = "requiredTagNames",
43        skip_serializing_if = "Option::is_none",
44        default
45    )]
46    required_tag_names: Option<
47        std::collections::BTreeSet<super::super::super::super::super::api::TagName>,
48    >,
49    #[builder(default, into)]
50    #[serde(
51        rename = "availableTagValues",
52        skip_serializing_if = "Option::is_none",
53        default
54    )]
55    available_tag_values: Option<
56        std::collections::BTreeMap<
57            super::super::super::super::super::api::TagName,
58            std::collections::BTreeSet<super::super::super::super::super::api::TagValue>,
59        >,
60    >,
61    #[builder(
62        default,
63        custom(
64            type = impl
65            Into<Option<super::ScrapingConfig>>,
66            convert = |v|v.into().map(Box::new)
67        )
68    )]
69    #[serde(rename = "scraping", skip_serializing_if = "Option::is_none", default)]
70    scraping: Option<Box<super::ScrapingConfig>>,
71    #[builder(default, into)]
72    #[serde(rename = "shouldScrape", skip_serializing_if = "Option::is_none", default)]
73    should_scrape: Option<bool>,
74    #[builder(
75        default,
76        custom(
77            type = impl
78            Into<Option<super::LimitsConfig>>,
79            convert = |v|v.into().map(Box::new)
80        )
81    )]
82    #[serde(rename = "limits", skip_serializing_if = "Option::is_none", default)]
83    limits: Option<Box<super::LimitsConfig>>,
84}
85impl UpdateConnectionRequest {
86    /// Constructs a new instance of the type.
87    #[inline]
88    pub fn new() -> Self {
89        Self::builder().build()
90    }
91    #[inline]
92    pub fn name(&self) -> Option<&str> {
93        self.name.as_ref().map(|o| &**o)
94    }
95    #[inline]
96    pub fn description(&self) -> Option<&str> {
97        self.description.as_ref().map(|o| &**o)
98    }
99    #[inline]
100    pub fn metadata(&self) -> Option<&std::collections::BTreeMap<String, String>> {
101        self.metadata.as_ref().map(|o| &*o)
102    }
103    #[inline]
104    pub fn connection_details(&self) -> Option<&super::ConnectionDetails> {
105        self.connection_details.as_ref().map(|o| &**o)
106    }
107    #[inline]
108    pub fn required_tag_names(
109        &self,
110    ) -> Option<
111        &std::collections::BTreeSet<super::super::super::super::super::api::TagName>,
112    > {
113        self.required_tag_names.as_ref().map(|o| &*o)
114    }
115    /// In most cases, this does not to be set by the user. Throws if populated for Nominal connections, which
116    /// have their tags automatically indexed in the underlying database. Tags for external connections are
117    /// periodically scraped. Tags should only be updated manually for Visual crossing connections.
118    #[inline]
119    pub fn available_tag_values(
120        &self,
121    ) -> Option<
122        &std::collections::BTreeMap<
123            super::super::super::super::super::api::TagName,
124            std::collections::BTreeSet<super::super::super::super::super::api::TagValue>,
125        >,
126    > {
127        self.available_tag_values.as_ref().map(|o| &*o)
128    }
129    #[inline]
130    pub fn scraping(&self) -> Option<&super::ScrapingConfig> {
131        self.scraping.as_ref().map(|o| &**o)
132    }
133    #[inline]
134    pub fn should_scrape(&self) -> Option<bool> {
135        self.should_scrape.as_ref().map(|o| *o)
136    }
137    #[inline]
138    pub fn limits(&self) -> Option<&super::LimitsConfig> {
139        self.limits.as_ref().map(|o| &**o)
140    }
141}