aws-sdk-cloudextensions 1.0.0

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

/// What a request conflicts with. Exactly one member is set.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub enum Conflict {
    /// A resource the request depends on is in a state that doesn't allow the request, such as a draft revised after the caller read its draftRevision.
    DependencyState(crate::types::DependencyStateConflict),
    /// Another resource already has the value the request gives a field that must be unique, such as a profile's name.
    DuplicateValue(crate::types::DuplicateValueConflict),
    /// The target resource's state doesn't allow the request.
    ResourceState(crate::types::ResourceStateConflict),
    /// 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 Conflict {
    /// Tries to convert the enum instance into [`DependencyState`](crate::types::Conflict::DependencyState), extracting the inner [`DependencyStateConflict`](crate::types::DependencyStateConflict).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_dependency_state(&self) -> ::std::result::Result<&crate::types::DependencyStateConflict, &Self> {
        if let Conflict::DependencyState(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`DependencyState`](crate::types::Conflict::DependencyState).
    pub fn is_dependency_state(&self) -> bool {
        self.as_dependency_state().is_ok()
    }
    /// Tries to convert the enum instance into [`DuplicateValue`](crate::types::Conflict::DuplicateValue), extracting the inner [`DuplicateValueConflict`](crate::types::DuplicateValueConflict).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_duplicate_value(&self) -> ::std::result::Result<&crate::types::DuplicateValueConflict, &Self> {
        if let Conflict::DuplicateValue(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`DuplicateValue`](crate::types::Conflict::DuplicateValue).
    pub fn is_duplicate_value(&self) -> bool {
        self.as_duplicate_value().is_ok()
    }
    /// Tries to convert the enum instance into [`ResourceState`](crate::types::Conflict::ResourceState), extracting the inner [`ResourceStateConflict`](crate::types::ResourceStateConflict).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_resource_state(&self) -> ::std::result::Result<&crate::types::ResourceStateConflict, &Self> {
        if let Conflict::ResourceState(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`ResourceState`](crate::types::Conflict::ResourceState).
    pub fn is_resource_state(&self) -> bool {
        self.as_resource_state().is_ok()
    }
    /// Returns true if the enum instance is the `Unknown` variant.
    pub fn is_unknown(&self) -> bool {
        matches!(self, Self::Unknown)
    }
}