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(default, map(key(type = String, into), value(type = String, into)))]
26    #[serde(
27        rename = "properties",
28        skip_serializing_if = "std::collections::BTreeMap::is_empty",
29        default
30    )]
31    properties: std::collections::BTreeMap<String, String>,
32    #[builder(default, set(item(type = String, into)))]
33    #[serde(
34        rename = "labels",
35        skip_serializing_if = "std::collections::BTreeSet::is_empty",
36        default
37    )]
38    labels: std::collections::BTreeSet<String>,
39    #[builder(default, into)]
40    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
41    workspace: Option<conjure_object::ResourceIdentifier>,
42}
43impl CreateSecretRequest {
44    /// Constructs a new instance of the type.
45    #[inline]
46    pub fn new(
47        name: impl Into<String>,
48        description: impl Into<String>,
49        decrypted_value: impl Into<String>,
50    ) -> Self {
51        Self::builder()
52            .name(name)
53            .description(description)
54            .decrypted_value(decrypted_value)
55            .build()
56    }
57    #[inline]
58    pub fn name(&self) -> &str {
59        &*self.name
60    }
61    #[inline]
62    pub fn description(&self) -> &str {
63        &*self.description
64    }
65    #[inline]
66    pub fn decrypted_value(&self) -> &str {
67        &*self.decrypted_value
68    }
69    #[inline]
70    pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
71        &self.properties
72    }
73    #[inline]
74    pub fn labels(&self) -> &std::collections::BTreeSet<String> {
75        &self.labels
76    }
77    /// The workspace in which to create the secret. If not provided, the secret will be created in
78    /// the default workspace for the user's organization, if the default workspace for the
79    /// organization is configured.
80    #[inline]
81    pub fn workspace(&self) -> Option<&conjure_object::ResourceIdentifier> {
82        self.workspace.as_ref().map(|o| &*o)
83    }
84}