Struct aws_sdk_memorydb::error::CreateSnapshotError
source · #[non_exhaustive]pub struct CreateSnapshotError {
pub kind: CreateSnapshotErrorKind,
/* private fields */
}
Expand description
Error type for the CreateSnapshot
operation.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.kind: CreateSnapshotErrorKind
Kind of error that occurred.
Implementations§
source§impl CreateSnapshotError
impl CreateSnapshotError
sourcepub fn new(kind: CreateSnapshotErrorKind, meta: Error) -> Self
pub fn new(kind: CreateSnapshotErrorKind, meta: Error) -> Self
Creates a new CreateSnapshotError
.
sourcepub fn unhandled(err: impl Into<Box<dyn Error + Send + Sync + 'static>>) -> Self
pub fn unhandled(err: impl Into<Box<dyn Error + Send + Sync + 'static>>) -> Self
Creates the CreateSnapshotError::Unhandled
variant from any error type.
Examples found in repository?
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053
pub fn parse_create_snapshot_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::CreateSnapshotOutput, crate::error::CreateSnapshotError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::CreateSnapshotError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::CreateSnapshotError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ClusterNotFoundFault" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::ClusterNotFoundFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::cluster_not_found_fault::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_cluster_not_found_fault_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidClusterStateFault" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::InvalidClusterStateFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_cluster_state_fault::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_cluster_state_fault_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterCombinationException" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::InvalidParameterCombinationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_parameter_combination_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_parameter_combination_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterValueException" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::InvalidParameterValueException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_parameter_value_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_parameter_value_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceLinkedRoleNotFoundFault" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::ServiceLinkedRoleNotFoundFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::service_linked_role_not_found_fault::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_service_linked_role_not_found_fault_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"SnapshotAlreadyExistsFault" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::SnapshotAlreadyExistsFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::snapshot_already_exists_fault::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_snapshot_already_exists_fault_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"SnapshotQuotaExceededFault" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::SnapshotQuotaExceededFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::snapshot_quota_exceeded_fault::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_snapshot_quota_exceeded_fault_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TagQuotaPerResourceExceeded" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::TagQuotaPerResourceExceeded({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::tag_quota_per_resource_exceeded::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_tag_quota_per_resource_exceeded_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::CreateSnapshotError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the CreateSnapshotError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053
pub fn parse_create_snapshot_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::CreateSnapshotOutput, crate::error::CreateSnapshotError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::CreateSnapshotError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::CreateSnapshotError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ClusterNotFoundFault" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::ClusterNotFoundFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::cluster_not_found_fault::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_cluster_not_found_fault_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidClusterStateFault" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::InvalidClusterStateFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_cluster_state_fault::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_cluster_state_fault_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterCombinationException" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::InvalidParameterCombinationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_parameter_combination_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_parameter_combination_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterValueException" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::InvalidParameterValueException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::invalid_parameter_value_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_parameter_value_exception_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceLinkedRoleNotFoundFault" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::ServiceLinkedRoleNotFoundFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::service_linked_role_not_found_fault::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_service_linked_role_not_found_fault_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"SnapshotAlreadyExistsFault" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::SnapshotAlreadyExistsFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::snapshot_already_exists_fault::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_snapshot_already_exists_fault_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"SnapshotQuotaExceededFault" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::SnapshotQuotaExceededFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::snapshot_quota_exceeded_fault::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_snapshot_quota_exceeded_fault_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TagQuotaPerResourceExceeded" => crate::error::CreateSnapshotError {
meta: generic,
kind: crate::error::CreateSnapshotErrorKind::TagQuotaPerResourceExceeded({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::tag_quota_per_resource_exceeded::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_tag_quota_per_resource_exceeded_json_err(response.body().as_ref(), output).map_err(crate::error::CreateSnapshotError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::CreateSnapshotError::generic(generic),
})
}
sourcepub fn meta(&self) -> &Error
pub fn meta(&self) -> &Error
Returns error metadata, which includes the error code, message, request ID, and potentially additional information.
sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
Returns the request ID if it’s available.
sourcepub fn is_cluster_not_found_fault(&self) -> bool
pub fn is_cluster_not_found_fault(&self) -> bool
Returns true
if the error kind is CreateSnapshotErrorKind::ClusterNotFoundFault
.
sourcepub fn is_invalid_cluster_state_fault(&self) -> bool
pub fn is_invalid_cluster_state_fault(&self) -> bool
Returns true
if the error kind is CreateSnapshotErrorKind::InvalidClusterStateFault
.
sourcepub fn is_invalid_parameter_combination_exception(&self) -> bool
pub fn is_invalid_parameter_combination_exception(&self) -> bool
Returns true
if the error kind is CreateSnapshotErrorKind::InvalidParameterCombinationException
.
sourcepub fn is_invalid_parameter_value_exception(&self) -> bool
pub fn is_invalid_parameter_value_exception(&self) -> bool
Returns true
if the error kind is CreateSnapshotErrorKind::InvalidParameterValueException
.
sourcepub fn is_service_linked_role_not_found_fault(&self) -> bool
pub fn is_service_linked_role_not_found_fault(&self) -> bool
Returns true
if the error kind is CreateSnapshotErrorKind::ServiceLinkedRoleNotFoundFault
.
sourcepub fn is_snapshot_already_exists_fault(&self) -> bool
pub fn is_snapshot_already_exists_fault(&self) -> bool
Returns true
if the error kind is CreateSnapshotErrorKind::SnapshotAlreadyExistsFault
.
sourcepub fn is_snapshot_quota_exceeded_fault(&self) -> bool
pub fn is_snapshot_quota_exceeded_fault(&self) -> bool
Returns true
if the error kind is CreateSnapshotErrorKind::SnapshotQuotaExceededFault
.
sourcepub fn is_tag_quota_per_resource_exceeded(&self) -> bool
pub fn is_tag_quota_per_resource_exceeded(&self) -> bool
Returns true
if the error kind is CreateSnapshotErrorKind::TagQuotaPerResourceExceeded
.