Struct aws_sdk_cloudfront::error::CreateInvalidationError
source · #[non_exhaustive]pub struct CreateInvalidationError {
pub kind: CreateInvalidationErrorKind,
/* private fields */
}
Expand description
Error type for the CreateInvalidation
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: CreateInvalidationErrorKind
Kind of error that occurred.
Implementations§
source§impl CreateInvalidationError
impl CreateInvalidationError
sourcepub fn new(kind: CreateInvalidationErrorKind, meta: Error) -> Self
pub fn new(kind: CreateInvalidationErrorKind, meta: Error) -> Self
Creates a new CreateInvalidationError
.
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 CreateInvalidationError::Unhandled
variant from any error type.
Examples found in repository?
2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944
pub fn parse_create_invalidation_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::output::CreateInvalidationOutput,
crate::error::CreateInvalidationError,
> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::CreateInvalidationError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::CreateInvalidationError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDenied" => crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::AccessDenied({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::access_denied::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_access_denied_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"BatchTooLarge" => crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::BatchTooLarge({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::batch_too_large::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_batch_too_large_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InconsistentQuantities" => crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::InconsistentQuantities({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::inconsistent_quantities::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_inconsistent_quantities_xml_err(response.body().as_ref(), output).map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidArgument" => crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::InvalidArgument({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_argument::Builder::default();
let _ = response;
output =
crate::xml_deser::deser_structure_crate_error_invalid_argument_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"MissingBody" => crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::MissingBody({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::missing_body::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_missing_body_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NoSuchDistribution" => {
crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::NoSuchDistribution({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::no_such_distribution::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_no_such_distribution_xml_err(response.body().as_ref(), output).map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"TooManyInvalidationsInProgress" => crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::TooManyInvalidationsInProgress({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::too_many_invalidations_in_progress::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_too_many_invalidations_in_progress_xml_err(response.body().as_ref(), output).map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::CreateInvalidationError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn parse_create_invalidation_response(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::output::CreateInvalidationOutput,
crate::error::CreateInvalidationError,
> {
Ok({
#[allow(unused_mut)]
let mut output = crate::output::create_invalidation_output::Builder::default();
let _ = response;
output = output.set_invalidation(
crate::http_serde::deser_payload_create_invalidation_create_invalidation_output_invalidation(response.body().as_ref())?
);
output = output.set_location(
crate::http_serde::deser_header_create_invalidation_create_invalidation_output_location(response.headers())
.map_err(|_|crate::error::CreateInvalidationError::unhandled("Failed to parse Location from header `Location"))?
);
output.build()
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the CreateInvalidationError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922
pub fn parse_create_invalidation_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::output::CreateInvalidationOutput,
crate::error::CreateInvalidationError,
> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::CreateInvalidationError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::CreateInvalidationError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDenied" => crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::AccessDenied({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::access_denied::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_access_denied_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"BatchTooLarge" => crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::BatchTooLarge({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::batch_too_large::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_batch_too_large_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InconsistentQuantities" => crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::InconsistentQuantities({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::inconsistent_quantities::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_inconsistent_quantities_xml_err(response.body().as_ref(), output).map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidArgument" => crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::InvalidArgument({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_argument::Builder::default();
let _ = response;
output =
crate::xml_deser::deser_structure_crate_error_invalid_argument_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"MissingBody" => crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::MissingBody({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::missing_body::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_missing_body_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NoSuchDistribution" => {
crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::NoSuchDistribution({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::no_such_distribution::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_no_such_distribution_xml_err(response.body().as_ref(), output).map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"TooManyInvalidationsInProgress" => crate::error::CreateInvalidationError {
meta: generic,
kind: crate::error::CreateInvalidationErrorKind::TooManyInvalidationsInProgress({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::too_many_invalidations_in_progress::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_too_many_invalidations_in_progress_xml_err(response.body().as_ref(), output).map_err(crate::error::CreateInvalidationError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::CreateInvalidationError::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_access_denied(&self) -> bool
pub fn is_access_denied(&self) -> bool
Returns true
if the error kind is CreateInvalidationErrorKind::AccessDenied
.
sourcepub fn is_batch_too_large(&self) -> bool
pub fn is_batch_too_large(&self) -> bool
Returns true
if the error kind is CreateInvalidationErrorKind::BatchTooLarge
.
sourcepub fn is_inconsistent_quantities(&self) -> bool
pub fn is_inconsistent_quantities(&self) -> bool
Returns true
if the error kind is CreateInvalidationErrorKind::InconsistentQuantities
.
sourcepub fn is_invalid_argument(&self) -> bool
pub fn is_invalid_argument(&self) -> bool
Returns true
if the error kind is CreateInvalidationErrorKind::InvalidArgument
.
sourcepub fn is_missing_body(&self) -> bool
pub fn is_missing_body(&self) -> bool
Returns true
if the error kind is CreateInvalidationErrorKind::MissingBody
.
sourcepub fn is_no_such_distribution(&self) -> bool
pub fn is_no_such_distribution(&self) -> bool
Returns true
if the error kind is CreateInvalidationErrorKind::NoSuchDistribution
.
sourcepub fn is_too_many_invalidations_in_progress(&self) -> bool
pub fn is_too_many_invalidations_in_progress(&self) -> bool
Returns true
if the error kind is CreateInvalidationErrorKind::TooManyInvalidationsInProgress
.