aws_sdk_workspaces/types/
_association_error_code.rs1#[allow(missing_docs)] #[non_exhaustive]
45#[derive(
46 ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
47)]
48pub enum AssociationErrorCode {
49 #[allow(missing_docs)] InternalServerError,
51 #[allow(missing_docs)] WorkspaceUnreachable,
53 #[allow(missing_docs)] ApplicationOldversionexistFailure,
55 #[allow(missing_docs)] InsufficientDiskspace,
57 #[allow(missing_docs)] InsufficientMemory,
59 #[allow(missing_docs)] UnsupportedOperatingSystem,
61 #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
63 Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
64}
65impl ::std::convert::From<&str> for AssociationErrorCode {
66 fn from(s: &str) -> Self {
67 match s {
68 "DeploymentError.InternalServerError" => AssociationErrorCode::InternalServerError,
69 "DeploymentError.WorkspaceUnreachable" => AssociationErrorCode::WorkspaceUnreachable,
70 "ValidationError.ApplicationOldVersionExists" => AssociationErrorCode::ApplicationOldversionexistFailure,
71 "ValidationError.InsufficientDiskSpace" => AssociationErrorCode::InsufficientDiskspace,
72 "ValidationError.InsufficientMemory" => AssociationErrorCode::InsufficientMemory,
73 "ValidationError.UnsupportedOperatingSystem" => AssociationErrorCode::UnsupportedOperatingSystem,
74 other => AssociationErrorCode::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
75 }
76 }
77}
78impl ::std::str::FromStr for AssociationErrorCode {
79 type Err = ::std::convert::Infallible;
80
81 fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
82 ::std::result::Result::Ok(AssociationErrorCode::from(s))
83 }
84}
85impl AssociationErrorCode {
86 pub fn as_str(&self) -> &str {
88 match self {
89 AssociationErrorCode::InternalServerError => "DeploymentError.InternalServerError",
90 AssociationErrorCode::WorkspaceUnreachable => "DeploymentError.WorkspaceUnreachable",
91 AssociationErrorCode::ApplicationOldversionexistFailure => "ValidationError.ApplicationOldVersionExists",
92 AssociationErrorCode::InsufficientDiskspace => "ValidationError.InsufficientDiskSpace",
93 AssociationErrorCode::InsufficientMemory => "ValidationError.InsufficientMemory",
94 AssociationErrorCode::UnsupportedOperatingSystem => "ValidationError.UnsupportedOperatingSystem",
95 AssociationErrorCode::Unknown(value) => value.as_str(),
96 }
97 }
98 pub const fn values() -> &'static [&'static str] {
100 &[
101 "DeploymentError.InternalServerError",
102 "DeploymentError.WorkspaceUnreachable",
103 "ValidationError.ApplicationOldVersionExists",
104 "ValidationError.InsufficientDiskSpace",
105 "ValidationError.InsufficientMemory",
106 "ValidationError.UnsupportedOperatingSystem",
107 ]
108 }
109}
110impl ::std::convert::AsRef<str> for AssociationErrorCode {
111 fn as_ref(&self) -> &str {
112 self.as_str()
113 }
114}
115impl AssociationErrorCode {
116 pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
120 match Self::from(value) {
121 #[allow(deprecated)]
122 Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
123 known => Ok(known),
124 }
125 }
126}
127impl ::std::fmt::Display for AssociationErrorCode {
128 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
129 match self {
130 AssociationErrorCode::InternalServerError => write!(f, "DeploymentError.InternalServerError"),
131 AssociationErrorCode::WorkspaceUnreachable => write!(f, "DeploymentError.WorkspaceUnreachable"),
132 AssociationErrorCode::ApplicationOldversionexistFailure => write!(f, "ValidationError.ApplicationOldVersionExists"),
133 AssociationErrorCode::InsufficientDiskspace => write!(f, "ValidationError.InsufficientDiskSpace"),
134 AssociationErrorCode::InsufficientMemory => write!(f, "ValidationError.InsufficientMemory"),
135 AssociationErrorCode::UnsupportedOperatingSystem => write!(f, "ValidationError.UnsupportedOperatingSystem"),
136 AssociationErrorCode::Unknown(value) => write!(f, "{value}"),
137 }
138 }
139}