nominal_api/conjure/objects/attachments/api/
create_attachment_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 CreateAttachmentRequest {
16 #[serde(rename = "s3Path")]
17 s3_path: super::super::super::api::S3Path,
18 #[builder(into)]
19 #[serde(rename = "title")]
20 title: String,
21 #[builder(into)]
22 #[serde(rename = "description")]
23 description: String,
24 #[builder(
25 default,
26 map(
27 key(type = super::super::super::api::PropertyName),
28 value(type = super::super::super::api::PropertyValue)
29 )
30 )]
31 #[serde(
32 rename = "properties",
33 skip_serializing_if = "std::collections::BTreeMap::is_empty",
34 default
35 )]
36 properties: std::collections::BTreeMap<
37 super::super::super::api::PropertyName,
38 super::super::super::api::PropertyValue,
39 >,
40 #[builder(default, set(item(type = super::super::super::api::Label)))]
41 #[serde(
42 rename = "labels",
43 skip_serializing_if = "std::collections::BTreeSet::is_empty",
44 default
45 )]
46 labels: std::collections::BTreeSet<super::super::super::api::Label>,
47 #[builder(default, into)]
48 #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
49 workspace: Option<super::super::super::api::rids::WorkspaceRid>,
50}
51impl CreateAttachmentRequest {
52 #[inline]
54 pub fn new(
55 s3_path: super::super::super::api::S3Path,
56 title: impl Into<String>,
57 description: impl Into<String>,
58 ) -> Self {
59 Self::builder().s3_path(s3_path).title(title).description(description).build()
60 }
61 #[inline]
62 pub fn s3_path(&self) -> &super::super::super::api::S3Path {
63 &self.s3_path
64 }
65 #[inline]
66 pub fn title(&self) -> &str {
67 &*self.title
68 }
69 #[inline]
70 pub fn description(&self) -> &str {
71 &*self.description
72 }
73 #[inline]
74 pub fn properties(
75 &self,
76 ) -> &std::collections::BTreeMap<
77 super::super::super::api::PropertyName,
78 super::super::super::api::PropertyValue,
79 > {
80 &self.properties
81 }
82 #[inline]
83 pub fn labels(
84 &self,
85 ) -> &std::collections::BTreeSet<super::super::super::api::Label> {
86 &self.labels
87 }
88 #[inline]
92 pub fn workspace(&self) -> Option<&super::super::super::api::rids::WorkspaceRid> {
93 self.workspace.as_ref().map(|o| &*o)
94 }
95}