Struct aws_sdk_cloudfront::error::UpdateCachePolicyError
source · #[non_exhaustive]pub struct UpdateCachePolicyError {
pub kind: UpdateCachePolicyErrorKind,
/* private fields */
}
Expand description
Error type for the UpdateCachePolicy
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: UpdateCachePolicyErrorKind
Kind of error that occurred.
Implementations§
source§impl UpdateCachePolicyError
impl UpdateCachePolicyError
sourcepub fn new(kind: UpdateCachePolicyErrorKind, meta: Error) -> Self
pub fn new(kind: UpdateCachePolicyErrorKind, meta: Error) -> Self
Creates a new UpdateCachePolicyError
.
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 UpdateCachePolicyError::Unhandled
variant from any error type.
Examples found in repository?
10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792
pub fn parse_update_cache_policy_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::UpdateCachePolicyOutput, crate::error::UpdateCachePolicyError>
{
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::UpdateCachePolicyError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::UpdateCachePolicyError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDenied" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::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::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"CachePolicyAlreadyExists" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::CachePolicyAlreadyExists({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::cache_policy_already_exists::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_cache_policy_already_exists_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"IllegalUpdate" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::IllegalUpdate({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::illegal_update::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_illegal_update_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InconsistentQuantities" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::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::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidArgument" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::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::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidIfMatchVersion" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::InvalidIfMatchVersion({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_if_match_version::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_invalid_if_match_version_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NoSuchCachePolicy" => {
crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::NoSuchCachePolicy({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::no_such_cache_policy::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_no_such_cache_policy_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"PreconditionFailed" => {
crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::PreconditionFailed({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::precondition_failed::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_precondition_failed_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"TooManyCookiesInCachePolicy" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::TooManyCookiesInCachePolicy({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::too_many_cookies_in_cache_policy::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_too_many_cookies_in_cache_policy_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyHeadersInCachePolicy" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::TooManyHeadersInCachePolicy({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::too_many_headers_in_cache_policy::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_too_many_headers_in_cache_policy_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyQueryStringsInCachePolicy" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::TooManyQueryStringsInCachePolicy({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::too_many_query_strings_in_cache_policy::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_too_many_query_strings_in_cache_policy_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::UpdateCachePolicyError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn parse_update_cache_policy_response(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::UpdateCachePolicyOutput, crate::error::UpdateCachePolicyError>
{
Ok({
#[allow(unused_mut)]
let mut output = crate::output::update_cache_policy_output::Builder::default();
let _ = response;
output = output.set_cache_policy(
crate::http_serde::deser_payload_update_cache_policy_update_cache_policy_output_cache_policy(response.body().as_ref())?
);
output = output.set_e_tag(
crate::http_serde::deser_header_update_cache_policy_update_cache_policy_output_e_tag(
response.headers(),
)
.map_err(|_| {
crate::error::UpdateCachePolicyError::unhandled(
"Failed to parse ETag from header `ETag",
)
})?,
);
output.build()
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the UpdateCachePolicyError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766
pub fn parse_update_cache_policy_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::UpdateCachePolicyOutput, crate::error::UpdateCachePolicyError>
{
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::UpdateCachePolicyError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::UpdateCachePolicyError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDenied" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::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::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"CachePolicyAlreadyExists" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::CachePolicyAlreadyExists({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::cache_policy_already_exists::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_cache_policy_already_exists_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"IllegalUpdate" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::IllegalUpdate({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::illegal_update::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_illegal_update_xml_err(
response.body().as_ref(),
output,
)
.map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InconsistentQuantities" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::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::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidArgument" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::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::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidIfMatchVersion" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::InvalidIfMatchVersion({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_if_match_version::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_invalid_if_match_version_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NoSuchCachePolicy" => {
crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::NoSuchCachePolicy({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::no_such_cache_policy::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_no_such_cache_policy_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"PreconditionFailed" => {
crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::PreconditionFailed({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::precondition_failed::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_precondition_failed_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"TooManyCookiesInCachePolicy" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::TooManyCookiesInCachePolicy({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::too_many_cookies_in_cache_policy::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_too_many_cookies_in_cache_policy_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyHeadersInCachePolicy" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::TooManyHeadersInCachePolicy({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::too_many_headers_in_cache_policy::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_too_many_headers_in_cache_policy_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyQueryStringsInCachePolicy" => crate::error::UpdateCachePolicyError {
meta: generic,
kind: crate::error::UpdateCachePolicyErrorKind::TooManyQueryStringsInCachePolicy({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::too_many_query_strings_in_cache_policy::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_too_many_query_strings_in_cache_policy_xml_err(response.body().as_ref(), output).map_err(crate::error::UpdateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::UpdateCachePolicyError::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 UpdateCachePolicyErrorKind::AccessDenied
.
sourcepub fn is_cache_policy_already_exists(&self) -> bool
pub fn is_cache_policy_already_exists(&self) -> bool
Returns true
if the error kind is UpdateCachePolicyErrorKind::CachePolicyAlreadyExists
.
sourcepub fn is_illegal_update(&self) -> bool
pub fn is_illegal_update(&self) -> bool
Returns true
if the error kind is UpdateCachePolicyErrorKind::IllegalUpdate
.
sourcepub fn is_inconsistent_quantities(&self) -> bool
pub fn is_inconsistent_quantities(&self) -> bool
Returns true
if the error kind is UpdateCachePolicyErrorKind::InconsistentQuantities
.
sourcepub fn is_invalid_argument(&self) -> bool
pub fn is_invalid_argument(&self) -> bool
Returns true
if the error kind is UpdateCachePolicyErrorKind::InvalidArgument
.
sourcepub fn is_invalid_if_match_version(&self) -> bool
pub fn is_invalid_if_match_version(&self) -> bool
Returns true
if the error kind is UpdateCachePolicyErrorKind::InvalidIfMatchVersion
.
sourcepub fn is_no_such_cache_policy(&self) -> bool
pub fn is_no_such_cache_policy(&self) -> bool
Returns true
if the error kind is UpdateCachePolicyErrorKind::NoSuchCachePolicy
.
sourcepub fn is_precondition_failed(&self) -> bool
pub fn is_precondition_failed(&self) -> bool
Returns true
if the error kind is UpdateCachePolicyErrorKind::PreconditionFailed
.
Returns true
if the error kind is UpdateCachePolicyErrorKind::TooManyCookiesInCachePolicy
.
sourcepub fn is_too_many_headers_in_cache_policy(&self) -> bool
pub fn is_too_many_headers_in_cache_policy(&self) -> bool
Returns true
if the error kind is UpdateCachePolicyErrorKind::TooManyHeadersInCachePolicy
.
sourcepub fn is_too_many_query_strings_in_cache_policy(&self) -> bool
pub fn is_too_many_query_strings_in_cache_policy(&self) -> bool
Returns true
if the error kind is UpdateCachePolicyErrorKind::TooManyQueryStringsInCachePolicy
.