Skip to main content

nominal_api_conjure/conjure/objects/authorization/
sandbox_workspace.rs

1#![allow(deprecated)]
2use std::fmt;
3use std::str;
4/// Which sandbox workspace to create a token for. Each has its own service user, so
5/// the two values are two user identities in the same sandbox org.
6#[derive(
7    Debug,
8    Clone,
9    PartialEq,
10    Eq,
11    PartialOrd,
12    Ord,
13    Hash,
14    conjure_object::serde::Deserialize,
15    conjure_object::serde::Serialize,
16    conjure_object::log_safety::derive::LogSafe
17)]
18#[serde(crate = "conjure_object::serde")]
19pub enum SandboxWorkspace {
20    #[serde(rename = "PRIMARY")]
21    Primary,
22    #[serde(rename = "SECONDARY")]
23    Secondary,
24    /// An unknown variant.
25    #[serde(untagged)]
26    Unknown(Unknown),
27}
28impl SandboxWorkspace {
29    /// Returns the string representation of the enum.
30    #[inline]
31    pub fn as_str(&self) -> &str {
32        match self {
33            SandboxWorkspace::Primary => "PRIMARY",
34            SandboxWorkspace::Secondary => "SECONDARY",
35            SandboxWorkspace::Unknown(v) => &*v,
36        }
37    }
38}
39impl fmt::Display for SandboxWorkspace {
40    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
41        fmt::Display::fmt(self.as_str(), fmt)
42    }
43}
44impl conjure_object::Plain for SandboxWorkspace {
45    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
46        conjure_object::Plain::fmt(self.as_str(), fmt)
47    }
48}
49impl str::FromStr for SandboxWorkspace {
50    type Err = conjure_object::plain::ParseEnumError;
51    #[inline]
52    fn from_str(
53        v: &str,
54    ) -> Result<SandboxWorkspace, conjure_object::plain::ParseEnumError> {
55        match v {
56            "PRIMARY" => Ok(SandboxWorkspace::Primary),
57            "SECONDARY" => Ok(SandboxWorkspace::Secondary),
58            v => v.parse().map(|v| SandboxWorkspace::Unknown(Unknown(v))),
59        }
60    }
61}
62impl conjure_object::FromPlain for SandboxWorkspace {
63    type Err = conjure_object::plain::ParseEnumError;
64    #[inline]
65    fn from_plain(
66        v: &str,
67    ) -> Result<SandboxWorkspace, conjure_object::plain::ParseEnumError> {
68        v.parse()
69    }
70}
71///An unknown variant of the SandboxWorkspace enum.
72#[derive(
73    Debug,
74    Clone,
75    PartialEq,
76    Eq,
77    PartialOrd,
78    Ord,
79    Hash,
80    conjure_object::serde::Deserialize,
81    conjure_object::serde::Serialize,
82    conjure_object::log_safety::derive::LogSafe,
83)]
84#[serde(crate = "conjure_object::serde", transparent)]
85pub struct Unknown(conjure_object::private::Variant);
86impl std::ops::Deref for Unknown {
87    type Target = str;
88    #[inline]
89    fn deref(&self) -> &str {
90        &self.0
91    }
92}
93impl fmt::Display for Unknown {
94    #[inline]
95    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
96        fmt::Display::fmt(&self.0, fmt)
97    }
98}