aws_s3_transfer/model/
_server_side_encryption.rs1#[allow(missing_docs)] #[non_exhaustive]
21#[derive(
22 ::std::clone::Clone,
23 ::std::cmp::Eq,
24 ::std::cmp::Ord,
25 ::std::cmp::PartialEq,
26 ::std::cmp::PartialOrd,
27 ::std::fmt::Debug,
28 ::std::hash::Hash,
29)]
30pub enum ServerSideEncryption {
31 #[allow(missing_docs)] Aes256,
33 #[allow(missing_docs)] AwsFsx,
35 #[allow(missing_docs)] AwsKms,
37 #[allow(missing_docs)] AwsKmsDsse,
39 #[deprecated(
41 note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants."
42 )]
43 Unknown(crate::model::sealed_enum_unknown::UnknownVariantValue),
44}
45impl ::std::convert::From<&str> for ServerSideEncryption {
46 fn from(s: &str) -> Self {
47 match s {
48 "AES256" => ServerSideEncryption::Aes256,
49 "aws:fsx" => ServerSideEncryption::AwsFsx,
50 "aws:kms" => ServerSideEncryption::AwsKms,
51 "aws:kms:dsse" => ServerSideEncryption::AwsKmsDsse,
52 other => ServerSideEncryption::Unknown(
53 crate::model::sealed_enum_unknown::UnknownVariantValue(other.to_owned()),
54 ),
55 }
56 }
57}
58impl ::std::str::FromStr for ServerSideEncryption {
59 type Err = ::std::convert::Infallible;
60
61 fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
62 ::std::result::Result::Ok(ServerSideEncryption::from(s))
63 }
64}
65impl ServerSideEncryption {
66 pub fn as_str(&self) -> &str {
68 match self {
69 ServerSideEncryption::Aes256 => "AES256",
70 ServerSideEncryption::AwsFsx => "aws:fsx",
71 ServerSideEncryption::AwsKms => "aws:kms",
72 ServerSideEncryption::AwsKmsDsse => "aws:kms:dsse",
73 ServerSideEncryption::Unknown(value) => value.as_str(),
74 }
75 }
76 pub const fn values() -> &'static [&'static str] {
78 &["AES256", "aws:fsx", "aws:kms", "aws:kms:dsse"]
79 }
80}
81impl ::std::convert::AsRef<str> for ServerSideEncryption {
82 fn as_ref(&self) -> &str {
83 self.as_str()
84 }
85}
86impl ServerSideEncryption {
87 pub fn try_parse(
91 value: &str,
92 ) -> ::std::result::Result<Self, crate::model::error::UnknownVariantError> {
93 match Self::from(value) {
94 #[allow(deprecated)]
95 Self::Unknown(_) => {
96 ::std::result::Result::Err(crate::model::error::UnknownVariantError::new(value))
97 }
98 known => Ok(known),
99 }
100 }
101}
102impl ::std::fmt::Display for ServerSideEncryption {
103 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
104 match self {
105 ServerSideEncryption::Aes256 => write!(f, "AES256"),
106 ServerSideEncryption::AwsFsx => write!(f, "aws:fsx"),
107 ServerSideEncryption::AwsKms => write!(f, "aws:kms"),
108 ServerSideEncryption::AwsKmsDsse => write!(f, "aws:kms:dsse"),
109 ServerSideEncryption::Unknown(value) => write!(f, "{value}"),
110 }
111 }
112}