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)]
17#[serde(crate = "conjure_object::serde")]
18pub enum SandboxWorkspace {
19    #[serde(rename = "PRIMARY")]
20    Primary,
21    #[serde(rename = "SECONDARY")]
22    Secondary,
23    /// An unknown variant.
24    #[serde(untagged)]
25    Unknown(Unknown),
26}
27impl SandboxWorkspace {
28    /// Returns the string representation of the enum.
29    #[inline]
30    pub fn as_str(&self) -> &str {
31        match self {
32            SandboxWorkspace::Primary => "PRIMARY",
33            SandboxWorkspace::Secondary => "SECONDARY",
34            SandboxWorkspace::Unknown(v) => &*v,
35        }
36    }
37}
38impl fmt::Display for SandboxWorkspace {
39    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
40        fmt::Display::fmt(self.as_str(), fmt)
41    }
42}
43impl conjure_object::Plain for SandboxWorkspace {
44    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
45        conjure_object::Plain::fmt(self.as_str(), fmt)
46    }
47}
48impl str::FromStr for SandboxWorkspace {
49    type Err = conjure_object::plain::ParseEnumError;
50    #[inline]
51    fn from_str(
52        v: &str,
53    ) -> Result<SandboxWorkspace, conjure_object::plain::ParseEnumError> {
54        match v {
55            "PRIMARY" => Ok(SandboxWorkspace::Primary),
56            "SECONDARY" => Ok(SandboxWorkspace::Secondary),
57            v => v.parse().map(|v| SandboxWorkspace::Unknown(Unknown(v))),
58        }
59    }
60}
61impl conjure_object::FromPlain for SandboxWorkspace {
62    type Err = conjure_object::plain::ParseEnumError;
63    #[inline]
64    fn from_plain(
65        v: &str,
66    ) -> Result<SandboxWorkspace, conjure_object::plain::ParseEnumError> {
67        v.parse()
68    }
69}
70///An unknown variant of the SandboxWorkspace enum.
71#[derive(
72    Debug,
73    Clone,
74    PartialEq,
75    Eq,
76    PartialOrd,
77    Ord,
78    Hash,
79    conjure_object::serde::Deserialize,
80    conjure_object::serde::Serialize,
81)]
82#[serde(crate = "conjure_object::serde", transparent)]
83pub struct Unknown(conjure_object::private::Variant);
84impl std::ops::Deref for Unknown {
85    type Target = str;
86    #[inline]
87    fn deref(&self) -> &str {
88        &self.0
89    }
90}
91impl fmt::Display for Unknown {
92    #[inline]
93    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
94        fmt::Display::fmt(&self.0, fmt)
95    }
96}