Struct aws_sdk_cloudfront::error::GetPublicKeyError
source · #[non_exhaustive]pub struct GetPublicKeyError {
pub kind: GetPublicKeyErrorKind,
/* private fields */
}
Expand description
Error type for the GetPublicKey
operation.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.kind: GetPublicKeyErrorKind
Kind of error that occurred.
Implementations§
source§impl GetPublicKeyError
impl GetPublicKeyError
sourcepub fn new(kind: GetPublicKeyErrorKind, meta: Error) -> Self
pub fn new(kind: GetPublicKeyErrorKind, meta: Error) -> Self
Creates a new GetPublicKeyError
.
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 GetPublicKeyError::Unhandled
variant from any error type.
Examples found in repository?
src/operation_deser.rs (line 7702)
7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774
pub fn parse_get_public_key_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::GetPublicKeyOutput, crate::error::GetPublicKeyError> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::GetPublicKeyError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::GetPublicKeyError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDenied" => crate::error::GetPublicKeyError {
meta: generic,
kind: crate::error::GetPublicKeyErrorKind::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::GetPublicKeyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NoSuchPublicKey" => {
crate::error::GetPublicKeyError {
meta: generic,
kind: crate::error::GetPublicKeyErrorKind::NoSuchPublicKey({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::no_such_public_key::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_no_such_public_key_xml_err(response.body().as_ref(), output).map_err(crate::error::GetPublicKeyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
_ => crate::error::GetPublicKeyError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn parse_get_public_key_response(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::GetPublicKeyOutput, crate::error::GetPublicKeyError> {
Ok({
#[allow(unused_mut)]
let mut output = crate::output::get_public_key_output::Builder::default();
let _ = response;
output = output.set_e_tag(
crate::http_serde::deser_header_get_public_key_get_public_key_output_e_tag(
response.headers(),
)
.map_err(|_| {
crate::error::GetPublicKeyError::unhandled("Failed to parse ETag from header `ETag")
})?,
);
output = output.set_public_key(
crate::http_serde::deser_payload_get_public_key_get_public_key_output_public_key(
response.body().as_ref(),
)?,
);
output.build()
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the GetPublicKeyError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
src/operation_deser.rs (line 7747)
7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749
pub fn parse_get_public_key_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::GetPublicKeyOutput, crate::error::GetPublicKeyError> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::GetPublicKeyError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::GetPublicKeyError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDenied" => crate::error::GetPublicKeyError {
meta: generic,
kind: crate::error::GetPublicKeyErrorKind::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::GetPublicKeyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"NoSuchPublicKey" => {
crate::error::GetPublicKeyError {
meta: generic,
kind: crate::error::GetPublicKeyErrorKind::NoSuchPublicKey({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::no_such_public_key::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_no_such_public_key_xml_err(response.body().as_ref(), output).map_err(crate::error::GetPublicKeyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
_ => crate::error::GetPublicKeyError::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 GetPublicKeyErrorKind::AccessDenied
.
sourcepub fn is_no_such_public_key(&self) -> bool
pub fn is_no_such_public_key(&self) -> bool
Returns true
if the error kind is GetPublicKeyErrorKind::NoSuchPublicKey
.
Trait Implementations§
source§impl Debug for GetPublicKeyError
impl Debug for GetPublicKeyError
source§impl Display for GetPublicKeyError
impl Display for GetPublicKeyError
source§impl Error for GetPublicKeyError
impl Error for GetPublicKeyError
source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl From<GetPublicKeyError> for Error
impl From<GetPublicKeyError> for Error
source§fn from(err: GetPublicKeyError) -> Self
fn from(err: GetPublicKeyError) -> Self
Converts to this type from the input type.