aws_sdk_accessanalyzer/types/
_kms_grant_operation.rs1#[allow(missing_docs)] #[non_exhaustive]
53#[derive(
54 ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
55)]
56pub enum KmsGrantOperation {
57 #[allow(missing_docs)] CreateGrant,
59 #[allow(missing_docs)] Decrypt,
61 #[allow(missing_docs)] DescribeKey,
63 #[allow(missing_docs)] Encrypt,
65 #[allow(missing_docs)] GenerateDataKey,
67 #[allow(missing_docs)] GenerateDataKeyPair,
69 #[allow(missing_docs)] GenerateDataKeyPairWithoutPlaintext,
71 #[allow(missing_docs)] GenerateDataKeyWithoutPlaintext,
73 #[allow(missing_docs)] GetPublicKey,
75 #[allow(missing_docs)] ReencryptFrom,
77 #[allow(missing_docs)] ReencryptTo,
79 #[allow(missing_docs)] RetireGrant,
81 #[allow(missing_docs)] Sign,
83 #[allow(missing_docs)] Verify,
85 #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
87 Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
88}
89impl ::std::convert::From<&str> for KmsGrantOperation {
90 fn from(s: &str) -> Self {
91 match s {
92 "CreateGrant" => KmsGrantOperation::CreateGrant,
93 "Decrypt" => KmsGrantOperation::Decrypt,
94 "DescribeKey" => KmsGrantOperation::DescribeKey,
95 "Encrypt" => KmsGrantOperation::Encrypt,
96 "GenerateDataKey" => KmsGrantOperation::GenerateDataKey,
97 "GenerateDataKeyPair" => KmsGrantOperation::GenerateDataKeyPair,
98 "GenerateDataKeyPairWithoutPlaintext" => KmsGrantOperation::GenerateDataKeyPairWithoutPlaintext,
99 "GenerateDataKeyWithoutPlaintext" => KmsGrantOperation::GenerateDataKeyWithoutPlaintext,
100 "GetPublicKey" => KmsGrantOperation::GetPublicKey,
101 "ReEncryptFrom" => KmsGrantOperation::ReencryptFrom,
102 "ReEncryptTo" => KmsGrantOperation::ReencryptTo,
103 "RetireGrant" => KmsGrantOperation::RetireGrant,
104 "Sign" => KmsGrantOperation::Sign,
105 "Verify" => KmsGrantOperation::Verify,
106 other => KmsGrantOperation::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
107 }
108 }
109}
110impl ::std::str::FromStr for KmsGrantOperation {
111 type Err = ::std::convert::Infallible;
112
113 fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
114 ::std::result::Result::Ok(KmsGrantOperation::from(s))
115 }
116}
117impl KmsGrantOperation {
118 pub fn as_str(&self) -> &str {
120 match self {
121 KmsGrantOperation::CreateGrant => "CreateGrant",
122 KmsGrantOperation::Decrypt => "Decrypt",
123 KmsGrantOperation::DescribeKey => "DescribeKey",
124 KmsGrantOperation::Encrypt => "Encrypt",
125 KmsGrantOperation::GenerateDataKey => "GenerateDataKey",
126 KmsGrantOperation::GenerateDataKeyPair => "GenerateDataKeyPair",
127 KmsGrantOperation::GenerateDataKeyPairWithoutPlaintext => "GenerateDataKeyPairWithoutPlaintext",
128 KmsGrantOperation::GenerateDataKeyWithoutPlaintext => "GenerateDataKeyWithoutPlaintext",
129 KmsGrantOperation::GetPublicKey => "GetPublicKey",
130 KmsGrantOperation::ReencryptFrom => "ReEncryptFrom",
131 KmsGrantOperation::ReencryptTo => "ReEncryptTo",
132 KmsGrantOperation::RetireGrant => "RetireGrant",
133 KmsGrantOperation::Sign => "Sign",
134 KmsGrantOperation::Verify => "Verify",
135 KmsGrantOperation::Unknown(value) => value.as_str(),
136 }
137 }
138 pub const fn values() -> &'static [&'static str] {
140 &[
141 "CreateGrant",
142 "Decrypt",
143 "DescribeKey",
144 "Encrypt",
145 "GenerateDataKey",
146 "GenerateDataKeyPair",
147 "GenerateDataKeyPairWithoutPlaintext",
148 "GenerateDataKeyWithoutPlaintext",
149 "GetPublicKey",
150 "ReEncryptFrom",
151 "ReEncryptTo",
152 "RetireGrant",
153 "Sign",
154 "Verify",
155 ]
156 }
157}
158impl ::std::convert::AsRef<str> for KmsGrantOperation {
159 fn as_ref(&self) -> &str {
160 self.as_str()
161 }
162}
163impl KmsGrantOperation {
164 pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
168 match Self::from(value) {
169 #[allow(deprecated)]
170 Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
171 known => Ok(known),
172 }
173 }
174}
175impl ::std::fmt::Display for KmsGrantOperation {
176 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
177 match self {
178 KmsGrantOperation::CreateGrant => write!(f, "CreateGrant"),
179 KmsGrantOperation::Decrypt => write!(f, "Decrypt"),
180 KmsGrantOperation::DescribeKey => write!(f, "DescribeKey"),
181 KmsGrantOperation::Encrypt => write!(f, "Encrypt"),
182 KmsGrantOperation::GenerateDataKey => write!(f, "GenerateDataKey"),
183 KmsGrantOperation::GenerateDataKeyPair => write!(f, "GenerateDataKeyPair"),
184 KmsGrantOperation::GenerateDataKeyPairWithoutPlaintext => write!(f, "GenerateDataKeyPairWithoutPlaintext"),
185 KmsGrantOperation::GenerateDataKeyWithoutPlaintext => write!(f, "GenerateDataKeyWithoutPlaintext"),
186 KmsGrantOperation::GetPublicKey => write!(f, "GetPublicKey"),
187 KmsGrantOperation::ReencryptFrom => write!(f, "ReEncryptFrom"),
188 KmsGrantOperation::ReencryptTo => write!(f, "ReEncryptTo"),
189 KmsGrantOperation::RetireGrant => write!(f, "RetireGrant"),
190 KmsGrantOperation::Sign => write!(f, "Sign"),
191 KmsGrantOperation::Verify => write!(f, "Verify"),
192 KmsGrantOperation::Unknown(value) => write!(f, "{value}"),
193 }
194 }
195}