aws-sdk-apprunner 1.99.0

AWS SDK for AWS App Runner
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// When writing a match expression against `Runtime`, it is important to ensure
/// your code is forward-compatible. That is, if a match arm handles a case for a
/// feature that is supported by the service but has not been represented as an enum
/// variant in a current version of SDK, your code should continue to work when you
/// upgrade SDK to a future version in which the enum does include a variant for that
/// feature.
///
/// Here is an example of how you can make a match expression forward-compatible:
///
/// ```text
/// # let runtime = unimplemented!();
/// match runtime {
///     Runtime::Corretto11 => { /* ... */ },
///     Runtime::Corretto8 => { /* ... */ },
///     Runtime::Dotnet6 => { /* ... */ },
///     Runtime::Go1 => { /* ... */ },
///     Runtime::Nodejs12 => { /* ... */ },
///     Runtime::Nodejs14 => { /* ... */ },
///     Runtime::Nodejs16 => { /* ... */ },
///     Runtime::Nodejs18 => { /* ... */ },
///     Runtime::Nodejs22 => { /* ... */ },
///     Runtime::Php81 => { /* ... */ },
///     Runtime::Python3 => { /* ... */ },
///     Runtime::Python311 => { /* ... */ },
///     Runtime::Ruby31 => { /* ... */ },
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
///     _ => { /* ... */ },
/// }
/// ```
/// The above code demonstrates that when `runtime` represents
/// `NewFeature`, the execution path will lead to the second last match arm,
/// even though the enum does not contain a variant `Runtime::NewFeature`
/// in the current version of SDK. The reason is that the variable `other`,
/// created by the `@` operator, is bound to
/// `Runtime::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
/// and calling `as_str` on it yields `"NewFeature"`.
/// This match expression is forward-compatible when executed with a newer
/// version of SDK where the variant `Runtime::NewFeature` is defined.
/// Specifically, when `runtime` represents `NewFeature`,
/// the execution path will hit the second last match arm as before by virtue of
/// calling `as_str` on `Runtime::NewFeature` also yielding `"NewFeature"`.
///
/// Explicitly matching on the `Unknown` variant should
/// be avoided for two reasons:
/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
/// - It might inadvertently shadow other intended match arms.
///
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
)]
pub enum Runtime {
    #[allow(missing_docs)] // documentation missing in model
    Corretto11,
    #[allow(missing_docs)] // documentation missing in model
    Corretto8,
    #[allow(missing_docs)] // documentation missing in model
    Dotnet6,
    #[allow(missing_docs)] // documentation missing in model
    Go1,
    #[allow(missing_docs)] // documentation missing in model
    Nodejs12,
    #[allow(missing_docs)] // documentation missing in model
    Nodejs14,
    #[allow(missing_docs)] // documentation missing in model
    Nodejs16,
    #[allow(missing_docs)] // documentation missing in model
    Nodejs18,
    #[allow(missing_docs)] // documentation missing in model
    Nodejs22,
    #[allow(missing_docs)] // documentation missing in model
    Php81,
    #[allow(missing_docs)] // documentation missing in model
    Python3,
    #[allow(missing_docs)] // documentation missing in model
    Python311,
    #[allow(missing_docs)] // documentation missing in model
    Ruby31,
    /// `Unknown` contains new variants that have been added since this code was generated.
    #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
}
impl ::std::convert::From<&str> for Runtime {
    fn from(s: &str) -> Self {
        match s {
            "CORRETTO_11" => Runtime::Corretto11,
            "CORRETTO_8" => Runtime::Corretto8,
            "DOTNET_6" => Runtime::Dotnet6,
            "GO_1" => Runtime::Go1,
            "NODEJS_12" => Runtime::Nodejs12,
            "NODEJS_14" => Runtime::Nodejs14,
            "NODEJS_16" => Runtime::Nodejs16,
            "NODEJS_18" => Runtime::Nodejs18,
            "NODEJS_22" => Runtime::Nodejs22,
            "PHP_81" => Runtime::Php81,
            "PYTHON_3" => Runtime::Python3,
            "PYTHON_311" => Runtime::Python311,
            "RUBY_31" => Runtime::Ruby31,
            other => Runtime::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
        }
    }
}
impl ::std::str::FromStr for Runtime {
    type Err = ::std::convert::Infallible;

    fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
        ::std::result::Result::Ok(Runtime::from(s))
    }
}
impl Runtime {
    /// Returns the `&str` value of the enum member.
    pub fn as_str(&self) -> &str {
        match self {
            Runtime::Corretto11 => "CORRETTO_11",
            Runtime::Corretto8 => "CORRETTO_8",
            Runtime::Dotnet6 => "DOTNET_6",
            Runtime::Go1 => "GO_1",
            Runtime::Nodejs12 => "NODEJS_12",
            Runtime::Nodejs14 => "NODEJS_14",
            Runtime::Nodejs16 => "NODEJS_16",
            Runtime::Nodejs18 => "NODEJS_18",
            Runtime::Nodejs22 => "NODEJS_22",
            Runtime::Php81 => "PHP_81",
            Runtime::Python3 => "PYTHON_3",
            Runtime::Python311 => "PYTHON_311",
            Runtime::Ruby31 => "RUBY_31",
            Runtime::Unknown(value) => value.as_str(),
        }
    }
    /// Returns all the `&str` representations of the enum members.
    pub const fn values() -> &'static [&'static str] {
        &[
            "CORRETTO_11",
            "CORRETTO_8",
            "DOTNET_6",
            "GO_1",
            "NODEJS_12",
            "NODEJS_14",
            "NODEJS_16",
            "NODEJS_18",
            "NODEJS_22",
            "PHP_81",
            "PYTHON_3",
            "PYTHON_311",
            "RUBY_31",
        ]
    }
}
impl ::std::convert::AsRef<str> for Runtime {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}
impl Runtime {
    /// Parses the enum value while disallowing unknown variants.
    ///
    /// Unknown variants will result in an error.
    pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
        match Self::from(value) {
            #[allow(deprecated)]
            Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
            known => Ok(known),
        }
    }
}
impl ::std::fmt::Display for Runtime {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        match self {
            Runtime::Corretto11 => write!(f, "CORRETTO_11"),
            Runtime::Corretto8 => write!(f, "CORRETTO_8"),
            Runtime::Dotnet6 => write!(f, "DOTNET_6"),
            Runtime::Go1 => write!(f, "GO_1"),
            Runtime::Nodejs12 => write!(f, "NODEJS_12"),
            Runtime::Nodejs14 => write!(f, "NODEJS_14"),
            Runtime::Nodejs16 => write!(f, "NODEJS_16"),
            Runtime::Nodejs18 => write!(f, "NODEJS_18"),
            Runtime::Nodejs22 => write!(f, "NODEJS_22"),
            Runtime::Php81 => write!(f, "PHP_81"),
            Runtime::Python3 => write!(f, "PYTHON_3"),
            Runtime::Python311 => write!(f, "PYTHON_311"),
            Runtime::Ruby31 => write!(f, "RUBY_31"),
            Runtime::Unknown(value) => write!(f, "{value}"),
        }
    }
}