Skip to main content

nominal_api/conjure/objects/scout/asset/api/
asset.rs

1#[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 Asset {
16    #[serde(rename = "rid")]
17    rid: super::super::super::rids::api::AssetRid,
18    #[builder(into)]
19    #[serde(rename = "title")]
20    title: String,
21    #[builder(default, into)]
22    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
23    description: Option<String>,
24    #[builder(default, map(key(type = String, into), value(type = String, into)))]
25    #[serde(
26        rename = "properties",
27        skip_serializing_if = "std::collections::BTreeMap::is_empty",
28        default
29    )]
30    properties: std::collections::BTreeMap<String, String>,
31    #[builder(default, set(item(type = String, into)))]
32    #[serde(
33        rename = "labels",
34        skip_serializing_if = "std::collections::BTreeSet::is_empty",
35        default
36    )]
37    labels: std::collections::BTreeSet<String>,
38    #[builder(default, list(item(type = super::super::super::run::api::Link)))]
39    #[serde(rename = "links", skip_serializing_if = "Vec::is_empty", default)]
40    links: Vec<super::super::super::run::api::Link>,
41    #[builder(default, list(item(type = super::DataScope)))]
42    #[serde(rename = "dataScopes", skip_serializing_if = "Vec::is_empty", default)]
43    data_scopes: Vec<super::DataScope>,
44    #[builder(default, into)]
45    #[serde(rename = "createdBy", skip_serializing_if = "Option::is_none", default)]
46    created_by: Option<conjure_object::ResourceIdentifier>,
47    #[serde(rename = "createdAt")]
48    created_at: conjure_object::DateTime<conjure_object::Utc>,
49    #[serde(rename = "updatedAt")]
50    updated_at: conjure_object::DateTime<conjure_object::Utc>,
51    #[builder(default, set(item(type = conjure_object::ResourceIdentifier)))]
52    #[serde(
53        rename = "attachments",
54        skip_serializing_if = "std::collections::BTreeSet::is_empty",
55        default
56    )]
57    attachments: std::collections::BTreeSet<conjure_object::ResourceIdentifier>,
58    #[builder(default, into)]
59    #[serde(rename = "type", skip_serializing_if = "Option::is_none", default)]
60    type_: Option<super::super::super::rids::api::TypeRid>,
61    #[serde(rename = "isStaged")]
62    is_staged: bool,
63    #[serde(rename = "isArchived")]
64    is_archived: bool,
65}
66impl Asset {
67    #[inline]
68    pub fn rid(&self) -> &super::super::super::rids::api::AssetRid {
69        &self.rid
70    }
71    #[inline]
72    pub fn title(&self) -> &str {
73        &*self.title
74    }
75    #[inline]
76    pub fn description(&self) -> Option<&str> {
77        self.description.as_ref().map(|o| &**o)
78    }
79    #[inline]
80    pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
81        &self.properties
82    }
83    /// Labels associated with the asset. These labels do not have a time dimension.
84    /// To associate labels with a range of time, create a time range on the asset with labels.
85    #[inline]
86    pub fn labels(&self) -> &std::collections::BTreeSet<String> {
87        &self.labels
88    }
89    /// Links associated with the asset. These links do not have a time dimension.
90    /// To associate links with a range of time, create a time range on the asset with links.
91    #[inline]
92    pub fn links(&self) -> &[super::super::super::run::api::Link] {
93        &*self.links
94    }
95    /// The data scopes associated with the asset.
96    #[inline]
97    pub fn data_scopes(&self) -> &[super::DataScope] {
98        &*self.data_scopes
99    }
100    #[inline]
101    pub fn created_by(&self) -> Option<&conjure_object::ResourceIdentifier> {
102        self.created_by.as_ref().map(|o| &*o)
103    }
104    #[inline]
105    pub fn created_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
106        self.created_at
107    }
108    #[inline]
109    pub fn updated_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
110        self.updated_at
111    }
112    #[inline]
113    pub fn attachments(
114        &self,
115    ) -> &std::collections::BTreeSet<conjure_object::ResourceIdentifier> {
116        &self.attachments
117    }
118    #[inline]
119    pub fn type_(&self) -> Option<&super::super::super::rids::api::TypeRid> {
120        self.type_.as_ref().map(|o| &*o)
121    }
122    /// Auto created assets are considered staged by default.
123    #[inline]
124    pub fn is_staged(&self) -> bool {
125        self.is_staged
126    }
127    #[inline]
128    pub fn is_archived(&self) -> bool {
129        self.is_archived
130    }
131}