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<std::collections::BTreeSet<String>>,
47    #[builder(default, into)]
48    #[serde(
49        rename = "availableTagValues",
50        skip_serializing_if = "Option::is_none",
51        default
52    )]
53    available_tag_values: Option<
54        std::collections::BTreeMap<String, std::collections::BTreeSet<String>>,
55    >,
56    #[builder(
57        default,
58        custom(
59            type = impl
60            Into<Option<super::ScrapingConfig>>,
61            convert = |v|v.into().map(Box::new)
62        )
63    )]
64    #[serde(rename = "scraping", skip_serializing_if = "Option::is_none", default)]
65    scraping: Option<Box<super::ScrapingConfig>>,
66    #[builder(default, into)]
67    #[serde(rename = "shouldScrape", skip_serializing_if = "Option::is_none", default)]
68    should_scrape: Option<bool>,
69    #[builder(
70        default,
71        custom(
72            type = impl
73            Into<Option<super::LimitsConfig>>,
74            convert = |v|v.into().map(Box::new)
75        )
76    )]
77    #[serde(rename = "limits", skip_serializing_if = "Option::is_none", default)]
78    limits: Option<Box<super::LimitsConfig>>,
79}
80impl UpdateConnectionRequest {
81    /// Constructs a new instance of the type.
82    #[inline]
83    pub fn new() -> Self {
84        Self::builder().build()
85    }
86    #[inline]
87    pub fn name(&self) -> Option<&str> {
88        self.name.as_ref().map(|o| &**o)
89    }
90    #[inline]
91    pub fn description(&self) -> Option<&str> {
92        self.description.as_ref().map(|o| &**o)
93    }
94    #[inline]
95    pub fn metadata(&self) -> Option<&std::collections::BTreeMap<String, String>> {
96        self.metadata.as_ref().map(|o| &*o)
97    }
98    #[inline]
99    pub fn connection_details(&self) -> Option<&super::ConnectionDetails> {
100        self.connection_details.as_ref().map(|o| &**o)
101    }
102    #[inline]
103    pub fn required_tag_names(&self) -> Option<&std::collections::BTreeSet<String>> {
104        self.required_tag_names.as_ref().map(|o| &*o)
105    }
106    /// In most cases, this does not to be set by the user. Throws if populated for Nominal connections, which
107    /// have their tags automatically indexed in the underlying database. Tags for external connections are
108    /// periodically scraped. Tags should only be updated manually for Visual crossing connections.
109    #[inline]
110    pub fn available_tag_values(
111        &self,
112    ) -> Option<
113        &std::collections::BTreeMap<String, std::collections::BTreeSet<String>>,
114    > {
115        self.available_tag_values.as_ref().map(|o| &*o)
116    }
117    #[inline]
118    pub fn scraping(&self) -> Option<&super::ScrapingConfig> {
119        self.scraping.as_ref().map(|o| &**o)
120    }
121    #[inline]
122    pub fn should_scrape(&self) -> Option<bool> {
123        self.should_scrape.as_ref().map(|o| *o)
124    }
125    #[inline]
126    pub fn limits(&self) -> Option<&super::LimitsConfig> {
127        self.limits.as_ref().map(|o| &**o)
128    }
129}