aws-s3-transfer 1.0.0

Transfer Manager for Amazon S3 - a high-performance data plane client for uploading and downloading objects and directories.
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// When matching `ObjectCannedAcl`, handle known variants and retain a wildcard
/// arm for values introduced by S3 after this crate was generated.
///
/// To recognize a value that is not yet a named variant, use `as_str()`:
///
/// ```text
/// match value {
///     // Handle known variants here.
///     other if other.as_str() == "NewFeature" => { /* ... */ },
///     _ => { /* ... */ },
/// }
/// ```
///
/// This continues to recognize `"NewFeature"` if a future version of this crate
/// adds a named variant for it. Avoid matching `Unknown` directly: its inner
/// value is opaque, and that arm would no longer match the new named variant.
#[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 ObjectCannedAcl {
    #[allow(missing_docs)] // documentation missing in model
    AuthenticatedRead,
    #[allow(missing_docs)] // documentation missing in model
    AwsExecRead,
    #[allow(missing_docs)] // documentation missing in model
    BucketOwnerFullControl,
    #[allow(missing_docs)] // documentation missing in model
    BucketOwnerRead,
    #[allow(missing_docs)] // documentation missing in model
    Private,
    #[allow(missing_docs)] // documentation missing in model
    PublicRead,
    #[allow(missing_docs)] // documentation missing in model
    PublicReadWrite,
    /// `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::model::sealed_enum_unknown::UnknownVariantValue),
}
impl ::std::convert::From<&str> for ObjectCannedAcl {
    fn from(s: &str) -> Self {
        match s {
            "authenticated-read" => ObjectCannedAcl::AuthenticatedRead,
            "aws-exec-read" => ObjectCannedAcl::AwsExecRead,
            "bucket-owner-full-control" => ObjectCannedAcl::BucketOwnerFullControl,
            "bucket-owner-read" => ObjectCannedAcl::BucketOwnerRead,
            "private" => ObjectCannedAcl::Private,
            "public-read" => ObjectCannedAcl::PublicRead,
            "public-read-write" => ObjectCannedAcl::PublicReadWrite,
            other => ObjectCannedAcl::Unknown(
                crate::model::sealed_enum_unknown::UnknownVariantValue(other.to_owned()),
            ),
        }
    }
}
impl ::std::str::FromStr for ObjectCannedAcl {
    type Err = ::std::convert::Infallible;

    fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
        ::std::result::Result::Ok(ObjectCannedAcl::from(s))
    }
}
impl ObjectCannedAcl {
    /// Returns the `&str` value of the enum member.
    pub fn as_str(&self) -> &str {
        match self {
            ObjectCannedAcl::AuthenticatedRead => "authenticated-read",
            ObjectCannedAcl::AwsExecRead => "aws-exec-read",
            ObjectCannedAcl::BucketOwnerFullControl => "bucket-owner-full-control",
            ObjectCannedAcl::BucketOwnerRead => "bucket-owner-read",
            ObjectCannedAcl::Private => "private",
            ObjectCannedAcl::PublicRead => "public-read",
            ObjectCannedAcl::PublicReadWrite => "public-read-write",
            ObjectCannedAcl::Unknown(value) => value.as_str(),
        }
    }
    /// Returns all the `&str` representations of the enum members.
    pub const fn values() -> &'static [&'static str] {
        &[
            "authenticated-read",
            "aws-exec-read",
            "bucket-owner-full-control",
            "bucket-owner-read",
            "private",
            "public-read",
            "public-read-write",
        ]
    }
}
impl ::std::convert::AsRef<str> for ObjectCannedAcl {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}
impl ObjectCannedAcl {
    /// 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::model::error::UnknownVariantError> {
        match Self::from(value) {
            #[allow(deprecated)]
            Self::Unknown(_) => {
                ::std::result::Result::Err(crate::model::error::UnknownVariantError::new(value))
            }
            known => Ok(known),
        }
    }
}
impl ::std::fmt::Display for ObjectCannedAcl {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        match self {
            ObjectCannedAcl::AuthenticatedRead => write!(f, "authenticated-read"),
            ObjectCannedAcl::AwsExecRead => write!(f, "aws-exec-read"),
            ObjectCannedAcl::BucketOwnerFullControl => write!(f, "bucket-owner-full-control"),
            ObjectCannedAcl::BucketOwnerRead => write!(f, "bucket-owner-read"),
            ObjectCannedAcl::Private => write!(f, "private"),
            ObjectCannedAcl::PublicRead => write!(f, "public-read"),
            ObjectCannedAcl::PublicReadWrite => write!(f, "public-read-write"),
            ObjectCannedAcl::Unknown(value) => write!(f, "{value}"),
        }
    }
}