#[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 CreateDataset {
#[builder(into)]
#[serde(rename = "name")]
name: String,
#[builder(
default,
custom(
type = impl
Into<Option<super::Handle>>,
convert = |v|v.into().map(Box::new)
)
)]
#[serde(rename = "handle", skip_serializing_if = "Option::is_none", default)]
handle: Option<Box<super::Handle>>,
#[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(custom(type = super::DatasetOriginMetadata, convert = Box::new))]
#[serde(rename = "originMetadata")]
origin_metadata: Box<super::DatasetOriginMetadata>,
#[builder(default, set(item(type = super::super::super::api::Label)))]
#[serde(
rename = "labels",
skip_serializing_if = "std::collections::BTreeSet::is_empty",
default
)]
labels: std::collections::BTreeSet<super::super::super::api::Label>,
#[builder(
default,
map(
key(type = super::super::super::api::PropertyName),
value(type = super::super::super::api::PropertyValue)
)
)]
#[serde(
rename = "properties",
skip_serializing_if = "std::collections::BTreeMap::is_empty",
default
)]
properties: std::collections::BTreeMap<
super::super::super::api::PropertyName,
super::super::super::api::PropertyValue,
>,
#[builder(default, into)]
#[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
description: Option<String>,
#[builder(default, into)]
#[serde(rename = "granularity", skip_serializing_if = "Option::is_none", default)]
granularity: Option<super::super::super::api::Granularity>,
#[builder(default, into)]
#[serde(rename = "isV2Dataset", skip_serializing_if = "Option::is_none", default)]
is_v2_dataset: Option<bool>,
#[builder(default, into)]
#[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
workspace: Option<super::super::super::api::rids::WorkspaceRid>,
#[builder(default, set(item(type = super::super::rids::api::MarkingRid)))]
#[serde(
rename = "markingRids",
skip_serializing_if = "std::collections::BTreeSet::is_empty",
default
)]
marking_rids: std::collections::BTreeSet<super::super::rids::api::MarkingRid>,
#[builder(default, into)]
#[serde(rename = "datasetType", skip_serializing_if = "Option::is_none", default)]
dataset_type: Option<super::DatasetBackingType>,
}
impl CreateDataset {
#[inline]
pub fn new(
name: impl Into<String>,
origin_metadata: super::DatasetOriginMetadata,
) -> Self {
Self::builder().name(name).origin_metadata(origin_metadata).build()
}
#[inline]
pub fn name(&self) -> &str {
&*self.name
}
#[deprecated(
note = "Handles should only be specified when adding files to datasets"
)]
#[inline]
pub fn handle(&self) -> Option<&super::Handle> {
self.handle.as_ref().map(|o| &**o)
}
#[deprecated(note = "Deprecated in favor of properties")]
#[inline]
pub fn metadata(&self) -> &std::collections::BTreeMap<String, String> {
&self.metadata
}
#[inline]
pub fn origin_metadata(&self) -> &super::DatasetOriginMetadata {
&*self.origin_metadata
}
#[inline]
pub fn labels(
&self,
) -> &std::collections::BTreeSet<super::super::super::api::Label> {
&self.labels
}
#[inline]
pub fn properties(
&self,
) -> &std::collections::BTreeMap<
super::super::super::api::PropertyName,
super::super::super::api::PropertyValue,
> {
&self.properties
}
#[inline]
pub fn description(&self) -> Option<&str> {
self.description.as_ref().map(|o| &**o)
}
#[inline]
pub fn granularity(&self) -> Option<&super::super::super::api::Granularity> {
self.granularity.as_ref().map(|o| &*o)
}
#[deprecated(
note = "Regardless of what value is specified, this flag is treated as true by the service."
)]
#[inline]
pub fn is_v2_dataset(&self) -> Option<bool> {
self.is_v2_dataset.as_ref().map(|o| *o)
}
#[inline]
pub fn workspace(&self) -> Option<&super::super::super::api::rids::WorkspaceRid> {
self.workspace.as_ref().map(|o| &*o)
}
#[inline]
pub fn marking_rids(
&self,
) -> &std::collections::BTreeSet<super::super::rids::api::MarkingRid> {
&self.marking_rids
}
#[inline]
pub fn dataset_type(&self) -> Option<&super::DatasetBackingType> {
self.dataset_type.as_ref().map(|o| &*o)
}
}