nominal-api 0.1240.0

API bindings for the Nominal platform
Documentation
#[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 CreateConnection {
    #[builder(into)]
    #[serde(rename = "name")]
    name: String,
    #[builder(default, into)]
    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
    description: Option<String>,
    #[builder(custom(type = super::ConnectionDetails, convert = Box::new))]
    #[serde(rename = "connectionDetails")]
    connection_details: Box<super::ConnectionDetails>,
    #[builder(default, map(key(type = String, into), value(type = String, into)))]
    #[serde(
        rename = "metadata",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    metadata: std::collections::BTreeMap<String, String>,
    #[builder(
        default,
        set(item(type = super::super::super::super::super::api::TagName))
    )]
    #[serde(
        rename = "requiredTagNames",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    required_tag_names: std::collections::BTreeSet<
        super::super::super::super::super::api::TagName,
    >,
    #[builder(default, into)]
    #[serde(
        rename = "availableTagValues",
        skip_serializing_if = "Option::is_none",
        default
    )]
    available_tag_values: Option<
        std::collections::BTreeMap<
            super::super::super::super::super::api::TagName,
            std::collections::BTreeSet<super::super::super::super::super::api::TagValue>,
        >,
    >,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::ScrapingConfig>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "scraping", skip_serializing_if = "Option::is_none", default)]
    scraping: Option<Box<super::ScrapingConfig>>,
    #[serde(rename = "shouldScrape")]
    should_scrape: bool,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::LimitsConfig>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "limits", skip_serializing_if = "Option::is_none", default)]
    limits: Option<Box<super::LimitsConfig>>,
    #[builder(default, into)]
    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
    workspace: Option<super::super::super::super::super::api::rids::WorkspaceRid>,
    #[builder(
        default,
        set(item(type = super::super::super::super::rids::api::MarkingRid))
    )]
    #[serde(
        rename = "markingRids",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    marking_rids: std::collections::BTreeSet<
        super::super::super::super::rids::api::MarkingRid,
    >,
}
impl CreateConnection {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        name: impl Into<String>,
        connection_details: super::ConnectionDetails,
        should_scrape: bool,
    ) -> Self {
        Self::builder()
            .name(name)
            .connection_details(connection_details)
            .should_scrape(should_scrape)
            .build()
    }
    #[inline]
    pub fn name(&self) -> &str {
        &*self.name
    }
    #[inline]
    pub fn description(&self) -> Option<&str> {
        self.description.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn connection_details(&self) -> &super::ConnectionDetails {
        &*self.connection_details
    }
    /// Metadata information about the connection which is not relevant to the DB connection itself.
    #[inline]
    pub fn metadata(&self) -> &std::collections::BTreeMap<String, String> {
        &self.metadata
    }
    /// Additional tag name that are required to construct a fully qualified series.
    #[inline]
    pub fn required_tag_names(
        &self,
    ) -> &std::collections::BTreeSet<super::super::super::super::super::api::TagName> {
        &self.required_tag_names
    }
    /// In most cases, this does not to be set by the user. Throws if populated for Nominal connections, which
    /// have their tags automatically indexed in the underlying database. Tags for external connections are
    /// periodically scraped. Tags should only be updated  manually for Visual crossing connections.
    #[inline]
    pub fn available_tag_values(
        &self,
    ) -> Option<
        &std::collections::BTreeMap<
            super::super::super::super::super::api::TagName,
            std::collections::BTreeSet<super::super::super::super::super::api::TagValue>,
        >,
    > {
        self.available_tag_values.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn scraping(&self) -> Option<&super::ScrapingConfig> {
        self.scraping.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn should_scrape(&self) -> bool {
        self.should_scrape
    }
    #[inline]
    pub fn limits(&self) -> Option<&super::LimitsConfig> {
        self.limits.as_ref().map(|o| &**o)
    }
    /// The workspace in which to create the connection. If not provided, the connection will be created in the default workspace for
    /// the user's organization, if the default workspace for the organization is configured.
    #[inline]
    pub fn workspace(
        &self,
    ) -> Option<&super::super::super::super::super::api::rids::WorkspaceRid> {
        self.workspace.as_ref().map(|o| &*o)
    }
    /// The markings to apply to the created connection.
    /// If not provided, the connection will be visible to all users in the same workspace.
    #[inline]
    pub fn marking_rids(
        &self,
    ) -> &std::collections::BTreeSet<super::super::super::super::rids::api::MarkingRid> {
        &self.marking_rids
    }
}