aws_sdk_paymentcryptographydata/types/_re_encryption_attributes.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Parameters that are required to perform reencryption operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub enum ReEncryptionAttributes {
7    /// <p>Parameters that are required to encrypt plaintext data using DUKPT.</p>
8    Dukpt(crate::types::DukptEncryptionAttributes),
9    /// <p>Parameters that are required to encrypt data using symmetric keys.</p>
10    Symmetric(crate::types::SymmetricEncryptionAttributes),
11    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
12    /// An unknown enum variant
13    ///
14    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
15    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
16    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
17    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
18    #[non_exhaustive]
19    Unknown,
20}
21impl ReEncryptionAttributes {
22    /// Tries to convert the enum instance into [`Dukpt`](crate::types::ReEncryptionAttributes::Dukpt), extracting the inner [`DukptEncryptionAttributes`](crate::types::DukptEncryptionAttributes).
23    /// Returns `Err(&Self)` if it can't be converted.
24    pub fn as_dukpt(&self) -> ::std::result::Result<&crate::types::DukptEncryptionAttributes, &Self> {
25        if let ReEncryptionAttributes::Dukpt(val) = &self {
26            ::std::result::Result::Ok(val)
27        } else {
28            ::std::result::Result::Err(self)
29        }
30    }
31    /// Returns true if this is a [`Dukpt`](crate::types::ReEncryptionAttributes::Dukpt).
32    pub fn is_dukpt(&self) -> bool {
33        self.as_dukpt().is_ok()
34    }
35    /// Tries to convert the enum instance into [`Symmetric`](crate::types::ReEncryptionAttributes::Symmetric), extracting the inner [`SymmetricEncryptionAttributes`](crate::types::SymmetricEncryptionAttributes).
36    /// Returns `Err(&Self)` if it can't be converted.
37    pub fn as_symmetric(&self) -> ::std::result::Result<&crate::types::SymmetricEncryptionAttributes, &Self> {
38        if let ReEncryptionAttributes::Symmetric(val) = &self {
39            ::std::result::Result::Ok(val)
40        } else {
41            ::std::result::Result::Err(self)
42        }
43    }
44    /// Returns true if this is a [`Symmetric`](crate::types::ReEncryptionAttributes::Symmetric).
45    pub fn is_symmetric(&self) -> bool {
46        self.as_symmetric().is_ok()
47    }
48    /// Returns true if the enum instance is the `Unknown` variant.
49    pub fn is_unknown(&self) -> bool {
50        matches!(self, Self::Unknown)
51    }
52}