nominal_api/conjure/objects/scout/datasource/connection/api/
influx1_connection_details.rs1#[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 Influx1ConnectionDetails {
16 #[builder(into)]
17 #[serde(rename = "host")]
18 host: String,
19 #[serde(rename = "port")]
20 port: i32,
21 #[builder(default, map(key(type = String, into), value(type = super::HeaderValue)))]
22 #[serde(
23 rename = "headers",
24 skip_serializing_if = "std::collections::BTreeMap::is_empty",
25 default
26 )]
27 headers: std::collections::BTreeMap<String, super::HeaderValue>,
28 #[builder(
29 default,
30 custom(
31 type = impl
32 Into<Option<super::PasswordCredentials>>,
33 convert = |v|v.into().map(Box::new)
34 )
35 )]
36 #[serde(rename = "credentials", skip_serializing_if = "Option::is_none", default)]
37 credentials: Option<Box<super::PasswordCredentials>>,
38}
39impl Influx1ConnectionDetails {
40 #[inline]
42 pub fn new(host: impl Into<String>, port: i32) -> Self {
43 Self::builder().host(host).port(port).build()
44 }
45 #[inline]
46 pub fn host(&self) -> &str {
47 &*self.host
48 }
49 #[inline]
50 pub fn port(&self) -> i32 {
51 self.port
52 }
53 #[inline]
55 pub fn headers(&self) -> &std::collections::BTreeMap<String, super::HeaderValue> {
56 &self.headers
57 }
58 #[inline]
59 pub fn credentials(&self) -> Option<&super::PasswordCredentials> {
60 self.credentials.as_ref().map(|o| &**o)
61 }
62}