nominal-api 0.1239.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 CreateAssetRequest {
    #[builder(into)]
    #[serde(rename = "title")]
    title: String,
    #[builder(default, into)]
    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
    description: Option<String>,
    #[builder(
        default,
        map(
            key(type = super::super::super::super::api::PropertyName),
            value(type = super::super::super::super::api::PropertyValue)
        )
    )]
    #[serde(
        rename = "properties",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    properties: std::collections::BTreeMap<
        super::super::super::super::api::PropertyName,
        super::super::super::super::api::PropertyValue,
    >,
    #[builder(default, set(item(type = super::super::super::super::api::Label)))]
    #[serde(
        rename = "labels",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    labels: std::collections::BTreeSet<super::super::super::super::api::Label>,
    #[builder(default, list(item(type = super::super::super::run::api::Link)))]
    #[serde(rename = "links", skip_serializing_if = "Vec::is_empty", default)]
    links: Vec<super::super::super::run::api::Link>,
    #[builder(default, set(item(type = super::CreateAssetDataScope)))]
    #[serde(
        rename = "dataScopes",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    data_scopes: std::collections::BTreeSet<super::CreateAssetDataScope>,
    #[builder(
        default,
        set(item(type = super::super::super::super::api::rids::AttachmentRid))
    )]
    #[serde(
        rename = "attachments",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    attachments: std::collections::BTreeSet<
        super::super::super::super::api::rids::AttachmentRid,
    >,
    #[builder(default, into)]
    #[serde(rename = "type", skip_serializing_if = "Option::is_none", default)]
    type_: Option<super::super::super::rids::api::TypeRid>,
    #[builder(default, into)]
    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
    workspace: Option<super::super::super::super::api::rids::WorkspaceRid>,
}
impl CreateAssetRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(title: impl Into<String>) -> Self {
        Self::builder().title(title).build()
    }
    #[inline]
    pub fn title(&self) -> &str {
        &*self.title
    }
    #[inline]
    pub fn description(&self) -> Option<&str> {
        self.description.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn properties(
        &self,
    ) -> &std::collections::BTreeMap<
        super::super::super::super::api::PropertyName,
        super::super::super::super::api::PropertyValue,
    > {
        &self.properties
    }
    #[inline]
    pub fn labels(
        &self,
    ) -> &std::collections::BTreeSet<super::super::super::super::api::Label> {
        &self.labels
    }
    #[inline]
    pub fn links(&self) -> &[super::super::super::run::api::Link] {
        &*self.links
    }
    /// The data scopes associated with the asset.
    #[inline]
    pub fn data_scopes(
        &self,
    ) -> &std::collections::BTreeSet<super::CreateAssetDataScope> {
        &self.data_scopes
    }
    #[inline]
    pub fn attachments(
        &self,
    ) -> &std::collections::BTreeSet<
        super::super::super::super::api::rids::AttachmentRid,
    > {
        &self.attachments
    }
    #[inline]
    pub fn type_(&self) -> Option<&super::super::super::rids::api::TypeRid> {
        self.type_.as_ref().map(|o| &*o)
    }
    /// The workspace in which to create the asset. If not provided, the asset will be created in
    /// the default workspace for the user's organization, if the default workspace for the
    /// organization is configured.
    /// All data scopes, attachments, and the optional asset type must be in the same workspace.
    #[inline]
    pub fn workspace(
        &self,
    ) -> Option<&super::super::super::super::api::rids::WorkspaceRid> {
        self.workspace.as_ref().map(|o| &*o)
    }
}