Skip to main content

nominal_api/conjure/objects/scout/asset/api/
update_asset_request.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 UpdateAssetRequest {
16    #[builder(default, into)]
17    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
18    title: Option<String>,
19    #[builder(default, into)]
20    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
21    description: Option<String>,
22    #[builder(default, into)]
23    #[serde(rename = "properties", skip_serializing_if = "Option::is_none", default)]
24    properties: Option<std::collections::BTreeMap<String, String>>,
25    #[builder(default, into)]
26    #[serde(rename = "labels", skip_serializing_if = "Option::is_none", default)]
27    labels: Option<std::collections::BTreeSet<String>>,
28    #[builder(default, into)]
29    #[serde(rename = "links", skip_serializing_if = "Option::is_none", default)]
30    links: Option<Vec<super::super::super::run::api::Link>>,
31    #[builder(default, into)]
32    #[serde(rename = "dataScopes", skip_serializing_if = "Option::is_none", default)]
33    data_scopes: Option<std::collections::BTreeSet<super::CreateAssetDataScope>>,
34    #[builder(
35        default,
36        custom(
37            type = impl
38            Into<Option<super::UpdateOrRemoveAssetType>>,
39            convert = |v|v.into().map(Box::new)
40        )
41    )]
42    #[serde(rename = "type", skip_serializing_if = "Option::is_none", default)]
43    type_: Option<Box<super::UpdateOrRemoveAssetType>>,
44    #[builder(default, into)]
45    #[serde(rename = "isStaged", skip_serializing_if = "Option::is_none", default)]
46    is_staged: Option<bool>,
47}
48impl UpdateAssetRequest {
49    /// Constructs a new instance of the type.
50    #[inline]
51    pub fn new() -> Self {
52        Self::builder().build()
53    }
54    #[inline]
55    pub fn title(&self) -> Option<&str> {
56        self.title.as_ref().map(|o| &**o)
57    }
58    #[inline]
59    pub fn description(&self) -> Option<&str> {
60        self.description.as_ref().map(|o| &**o)
61    }
62    #[inline]
63    pub fn properties(&self) -> Option<&std::collections::BTreeMap<String, String>> {
64        self.properties.as_ref().map(|o| &*o)
65    }
66    #[inline]
67    pub fn labels(&self) -> Option<&std::collections::BTreeSet<String>> {
68        self.labels.as_ref().map(|o| &*o)
69    }
70    #[inline]
71    pub fn links(&self) -> Option<&[super::super::super::run::api::Link]> {
72        self.links.as_ref().map(|o| &**o)
73    }
74    /// The data scopes for the asset. This will replace all existing data scopes with the scopes specified.
75    #[inline]
76    pub fn data_scopes(
77        &self,
78    ) -> Option<&std::collections::BTreeSet<super::CreateAssetDataScope>> {
79        self.data_scopes.as_ref().map(|o| &*o)
80    }
81    #[inline]
82    pub fn type_(&self) -> Option<&super::UpdateOrRemoveAssetType> {
83        self.type_.as_ref().map(|o| &**o)
84    }
85    #[inline]
86    pub fn is_staged(&self) -> Option<bool> {
87        self.is_staged.as_ref().map(|o| *o)
88    }
89}