nominal_api/conjure/objects/scout/asset/api/
create_asset_request.rs1#[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 CreateAssetRequest {
16 #[builder(into)]
17 #[serde(rename = "title")]
18 title: String,
19 #[builder(default, into)]
20 #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
21 description: Option<String>,
22 #[builder(default, map(key(type = String, into), value(type = String, into)))]
23 #[serde(
24 rename = "properties",
25 skip_serializing_if = "std::collections::BTreeMap::is_empty",
26 default
27 )]
28 properties: std::collections::BTreeMap<String, String>,
29 #[builder(default, set(item(type = String, into)))]
30 #[serde(
31 rename = "labels",
32 skip_serializing_if = "std::collections::BTreeSet::is_empty",
33 default
34 )]
35 labels: std::collections::BTreeSet<String>,
36 #[builder(default, list(item(type = super::super::super::run::api::Link)))]
37 #[serde(rename = "links", skip_serializing_if = "Vec::is_empty", default)]
38 links: Vec<super::super::super::run::api::Link>,
39 #[builder(default, set(item(type = super::CreateAssetDataScope)))]
40 #[serde(
41 rename = "dataScopes",
42 skip_serializing_if = "std::collections::BTreeSet::is_empty",
43 default
44 )]
45 data_scopes: std::collections::BTreeSet<super::CreateAssetDataScope>,
46 #[builder(default, set(item(type = conjure_object::ResourceIdentifier)))]
47 #[serde(
48 rename = "attachments",
49 skip_serializing_if = "std::collections::BTreeSet::is_empty",
50 default
51 )]
52 attachments: std::collections::BTreeSet<conjure_object::ResourceIdentifier>,
53 #[builder(default, into)]
54 #[serde(rename = "type", skip_serializing_if = "Option::is_none", default)]
55 type_: Option<super::super::super::rids::api::TypeRid>,
56 #[builder(default, into)]
57 #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
58 workspace: Option<conjure_object::ResourceIdentifier>,
59}
60impl CreateAssetRequest {
61 #[inline]
63 pub fn new(title: impl Into<String>) -> Self {
64 Self::builder().title(title).build()
65 }
66 #[inline]
67 pub fn title(&self) -> &str {
68 &*self.title
69 }
70 #[inline]
71 pub fn description(&self) -> Option<&str> {
72 self.description.as_ref().map(|o| &**o)
73 }
74 #[inline]
75 pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
76 &self.properties
77 }
78 #[inline]
79 pub fn labels(&self) -> &std::collections::BTreeSet<String> {
80 &self.labels
81 }
82 #[inline]
83 pub fn links(&self) -> &[super::super::super::run::api::Link] {
84 &*self.links
85 }
86 #[inline]
88 pub fn data_scopes(
89 &self,
90 ) -> &std::collections::BTreeSet<super::CreateAssetDataScope> {
91 &self.data_scopes
92 }
93 #[inline]
94 pub fn attachments(
95 &self,
96 ) -> &std::collections::BTreeSet<conjure_object::ResourceIdentifier> {
97 &self.attachments
98 }
99 #[inline]
100 pub fn type_(&self) -> Option<&super::super::super::rids::api::TypeRid> {
101 self.type_.as_ref().map(|o| &*o)
102 }
103 #[inline]
108 pub fn workspace(&self) -> Option<&conjure_object::ResourceIdentifier> {
109 self.workspace.as_ref().map(|o| &*o)
110 }
111}