aws_sdk_rolesanywhere/types/
_source_data.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The data field of the trust anchor depending on its type.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub enum SourceData {
7    /// <p>The root certificate of the Private Certificate Authority specified by this ARN is used in trust validation for temporary credential requests. Included for trust anchors of type <code>AWS_ACM_PCA</code>.</p>
8    AcmPcaArn(::std::string::String),
9    /// <p>The PEM-encoded data for the certificate anchor. Included for trust anchors of type <code>CERTIFICATE_BUNDLE</code>.</p>
10    X509CertificateData(::std::string::String),
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 SourceData {
22    /// Tries to convert the enum instance into [`AcmPcaArn`](crate::types::SourceData::AcmPcaArn), extracting the inner [`String`](::std::string::String).
23    /// Returns `Err(&Self)` if it can't be converted.
24    pub fn as_acm_pca_arn(&self) -> ::std::result::Result<&::std::string::String, &Self> {
25        if let SourceData::AcmPcaArn(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 [`AcmPcaArn`](crate::types::SourceData::AcmPcaArn).
32    pub fn is_acm_pca_arn(&self) -> bool {
33        self.as_acm_pca_arn().is_ok()
34    }
35    /// Tries to convert the enum instance into [`X509CertificateData`](crate::types::SourceData::X509CertificateData), extracting the inner [`String`](::std::string::String).
36    /// Returns `Err(&Self)` if it can't be converted.
37    pub fn as_x509_certificate_data(&self) -> ::std::result::Result<&::std::string::String, &Self> {
38        if let SourceData::X509CertificateData(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 [`X509CertificateData`](crate::types::SourceData::X509CertificateData).
45    pub fn is_x509_certificate_data(&self) -> bool {
46        self.as_x509_certificate_data().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}