aws-sdk-qapps 1.63.0

AWS SDK for QApps
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>A card representing a component or step in an Amazon Q App's flow.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub enum Card {
    /// <p>A container for the properties of the file upload card.</p>
    FileUpload(crate::types::FileUploadCard),
    /// <p>A container for the properties of the form input card.</p>
    FormInput(crate::types::FormInputCard),
    /// <p>A container for the properties of the plugin card.</p>
    QPlugin(crate::types::QPluginCard),
    /// <p>A container for the properties of the query card.</p>
    QQuery(crate::types::QQueryCard),
    /// <p>A container for the properties of the text input card.</p>
    TextInput(crate::types::TextInputCard),
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
    /// An unknown enum variant
    ///
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
    #[non_exhaustive]
    Unknown,
}
impl Card {
    /// Tries to convert the enum instance into [`FileUpload`](crate::types::Card::FileUpload), extracting the inner [`FileUploadCard`](crate::types::FileUploadCard).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_file_upload(&self) -> ::std::result::Result<&crate::types::FileUploadCard, &Self> {
        if let Card::FileUpload(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`FileUpload`](crate::types::Card::FileUpload).
    pub fn is_file_upload(&self) -> bool {
        self.as_file_upload().is_ok()
    }
    /// Tries to convert the enum instance into [`FormInput`](crate::types::Card::FormInput), extracting the inner [`FormInputCard`](crate::types::FormInputCard).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_form_input(&self) -> ::std::result::Result<&crate::types::FormInputCard, &Self> {
        if let Card::FormInput(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`FormInput`](crate::types::Card::FormInput).
    pub fn is_form_input(&self) -> bool {
        self.as_form_input().is_ok()
    }
    /// Tries to convert the enum instance into [`QPlugin`](crate::types::Card::QPlugin), extracting the inner [`QPluginCard`](crate::types::QPluginCard).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_q_plugin(&self) -> ::std::result::Result<&crate::types::QPluginCard, &Self> {
        if let Card::QPlugin(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`QPlugin`](crate::types::Card::QPlugin).
    pub fn is_q_plugin(&self) -> bool {
        self.as_q_plugin().is_ok()
    }
    /// Tries to convert the enum instance into [`QQuery`](crate::types::Card::QQuery), extracting the inner [`QQueryCard`](crate::types::QQueryCard).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_q_query(&self) -> ::std::result::Result<&crate::types::QQueryCard, &Self> {
        if let Card::QQuery(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`QQuery`](crate::types::Card::QQuery).
    pub fn is_q_query(&self) -> bool {
        self.as_q_query().is_ok()
    }
    /// Tries to convert the enum instance into [`TextInput`](crate::types::Card::TextInput), extracting the inner [`TextInputCard`](crate::types::TextInputCard).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_text_input(&self) -> ::std::result::Result<&crate::types::TextInputCard, &Self> {
        if let Card::TextInput(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`TextInput`](crate::types::Card::TextInput).
    pub fn is_text_input(&self) -> bool {
        self.as_text_input().is_ok()
    }
    /// Returns true if the enum instance is the `Unknown` variant.
    pub fn is_unknown(&self) -> bool {
        matches!(self, Self::Unknown)
    }
}