#[derive(
Debug,
Clone,
conjure_object::serde::Serialize,
conjure_object::serde::Deserialize,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct Influx1ConnectionDetails {
#[builder(into)]
#[serde(rename = "host")]
host: String,
#[serde(rename = "port")]
port: i32,
#[builder(default, map(key(type = String, into), value(type = super::HeaderValue)))]
#[serde(
rename = "headers",
skip_serializing_if = "std::collections::BTreeMap::is_empty",
default
)]
headers: std::collections::BTreeMap<String, super::HeaderValue>,
#[builder(
default,
custom(
type = impl
Into<Option<super::PasswordCredentials>>,
convert = |v|v.into().map(Box::new)
)
)]
#[serde(rename = "credentials", skip_serializing_if = "Option::is_none", default)]
credentials: Option<Box<super::PasswordCredentials>>,
}
impl Influx1ConnectionDetails {
#[inline]
pub fn new(host: impl Into<String>, port: i32) -> Self {
Self::builder().host(host).port(port).build()
}
#[inline]
pub fn host(&self) -> &str {
&*self.host
}
#[inline]
pub fn port(&self) -> i32 {
self.port
}
#[inline]
pub fn headers(&self) -> &std::collections::BTreeMap<String, super::HeaderValue> {
&self.headers
}
#[inline]
pub fn credentials(&self) -> Option<&super::PasswordCredentials> {
self.credentials.as_ref().map(|o| &**o)
}
}