Skip to main content

nominal_api/conjure/objects/scout/metadata/
rename_property_key.rs

1/// Rename one or more source property keys to a single target key.
2/// Existing values are preserved under the new key.
3/// The rename should be skipped in the service for resources w/ conflicting keys.
4#[derive(
5    Debug,
6    Clone,
7    conjure_object::serde::Serialize,
8    conjure_object::serde::Deserialize,
9    PartialEq,
10    Eq,
11    PartialOrd,
12    Ord,
13    Hash
14)]
15#[serde(crate = "conjure_object::serde")]
16#[conjure_object::private::staged_builder::staged_builder]
17#[builder(crate = conjure_object::private::staged_builder, update, inline)]
18pub struct RenamePropertyKey {
19    #[builder(default, set(item(type = super::super::super::api::PropertyName)))]
20    #[serde(
21        rename = "source",
22        skip_serializing_if = "std::collections::BTreeSet::is_empty",
23        default
24    )]
25    source: std::collections::BTreeSet<super::super::super::api::PropertyName>,
26    #[serde(rename = "target")]
27    target: super::super::super::api::PropertyName,
28    #[builder(custom(type = super::ConflictBehavior, convert = Box::new))]
29    #[serde(rename = "onConflict")]
30    on_conflict: Box<super::ConflictBehavior>,
31}
32impl RenamePropertyKey {
33    /// Constructs a new instance of the type.
34    #[inline]
35    pub fn new(
36        target: super::super::super::api::PropertyName,
37        on_conflict: super::ConflictBehavior,
38    ) -> Self {
39        Self::builder().target(target).on_conflict(on_conflict).build()
40    }
41    #[inline]
42    pub fn source(
43        &self,
44    ) -> &std::collections::BTreeSet<super::super::super::api::PropertyName> {
45        &self.source
46    }
47    #[inline]
48    pub fn target(&self) -> &super::super::super::api::PropertyName {
49        &self.target
50    }
51    #[inline]
52    pub fn on_conflict(&self) -> &super::ConflictBehavior {
53        &*self.on_conflict
54    }
55}