Skip to main content

nominal_api/conjure/objects/secrets/api/
create_secret_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 CreateSecretRequest {
16    #[builder(into)]
17    #[serde(rename = "name")]
18    name: String,
19    #[builder(into)]
20    #[serde(rename = "description")]
21    description: String,
22    #[builder(into)]
23    #[serde(rename = "decryptedValue")]
24    decrypted_value: String,
25    #[builder(
26        default,
27        map(
28            key(type = super::super::super::api::PropertyName),
29            value(type = super::super::super::api::PropertyValue)
30        )
31    )]
32    #[serde(
33        rename = "properties",
34        skip_serializing_if = "std::collections::BTreeMap::is_empty",
35        default
36    )]
37    properties: std::collections::BTreeMap<
38        super::super::super::api::PropertyName,
39        super::super::super::api::PropertyValue,
40    >,
41    #[builder(default, set(item(type = super::super::super::api::Label)))]
42    #[serde(
43        rename = "labels",
44        skip_serializing_if = "std::collections::BTreeSet::is_empty",
45        default
46    )]
47    labels: std::collections::BTreeSet<super::super::super::api::Label>,
48    #[builder(default, into)]
49    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
50    workspace: Option<super::super::super::api::rids::WorkspaceRid>,
51}
52impl CreateSecretRequest {
53    /// Constructs a new instance of the type.
54    #[inline]
55    pub fn new(
56        name: impl Into<String>,
57        description: impl Into<String>,
58        decrypted_value: impl Into<String>,
59    ) -> Self {
60        Self::builder()
61            .name(name)
62            .description(description)
63            .decrypted_value(decrypted_value)
64            .build()
65    }
66    #[inline]
67    pub fn name(&self) -> &str {
68        &*self.name
69    }
70    #[inline]
71    pub fn description(&self) -> &str {
72        &*self.description
73    }
74    #[inline]
75    pub fn decrypted_value(&self) -> &str {
76        &*self.decrypted_value
77    }
78    #[inline]
79    pub fn properties(
80        &self,
81    ) -> &std::collections::BTreeMap<
82        super::super::super::api::PropertyName,
83        super::super::super::api::PropertyValue,
84    > {
85        &self.properties
86    }
87    #[inline]
88    pub fn labels(
89        &self,
90    ) -> &std::collections::BTreeSet<super::super::super::api::Label> {
91        &self.labels
92    }
93    /// The workspace in which to create the secret. If not provided, the secret will be created in
94    /// the default workspace for the user's organization, if the default workspace for the
95    /// organization is configured.
96    #[inline]
97    pub fn workspace(&self) -> Option<&super::super::super::api::rids::WorkspaceRid> {
98        self.workspace.as_ref().map(|o| &*o)
99    }
100}