Skip to main content

nominal_api/conjure/objects/scout/integrations/api/
opsgenie_region.rs

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