1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// 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)
}
}