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 = String, into)))]
20    #[serde(
21        rename = "source",
22        skip_serializing_if = "std::collections::BTreeSet::is_empty",
23        default
24    )]
25    source: std::collections::BTreeSet<String>,
26    #[builder(into)]
27    #[serde(rename = "target")]
28    target: String,
29    #[builder(custom(type = super::ConflictBehavior, convert = Box::new))]
30    #[serde(rename = "onConflict")]
31    on_conflict: Box<super::ConflictBehavior>,
32}
33impl RenamePropertyKey {
34    /// Constructs a new instance of the type.
35    #[inline]
36    pub fn new(target: impl Into<String>, on_conflict: super::ConflictBehavior) -> Self {
37        Self::builder().target(target).on_conflict(on_conflict).build()
38    }
39    #[inline]
40    pub fn source(&self) -> &std::collections::BTreeSet<String> {
41        &self.source
42    }
43    #[inline]
44    pub fn target(&self) -> &str {
45        &*self.target
46    }
47    #[inline]
48    pub fn on_conflict(&self) -> &super::ConflictBehavior {
49        &*self.on_conflict
50    }
51}