Struct aws_sdk_autoscaling::error::PutScalingPolicyError
source · #[non_exhaustive]pub struct PutScalingPolicyError {
pub kind: PutScalingPolicyErrorKind,
/* private fields */
}Expand description
Error type for the PutScalingPolicy 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: PutScalingPolicyErrorKindKind of error that occurred.
Implementations§
source§impl PutScalingPolicyError
impl PutScalingPolicyError
sourcepub fn new(kind: PutScalingPolicyErrorKind, meta: Error) -> Self
pub fn new(kind: PutScalingPolicyErrorKind, meta: Error) -> Self
Creates a new PutScalingPolicyError.
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 PutScalingPolicyError::Unhandled variant from any error type.
Examples found in repository?
src/operation_deser.rs (line 3505)
3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565
pub fn parse_put_scaling_policy_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::PutScalingPolicyOutput, crate::error::PutScalingPolicyError>
{
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::PutScalingPolicyError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::PutScalingPolicyError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"LimitExceeded" => {
crate::error::PutScalingPolicyError {
meta: generic,
kind: crate::error::PutScalingPolicyErrorKind::LimitExceededFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::limit_exceeded_fault::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_limit_exceeded_fault_xml_err(response.body().as_ref(), output).map_err(crate::error::PutScalingPolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"ResourceContention" => crate::error::PutScalingPolicyError {
meta: generic,
kind: crate::error::PutScalingPolicyErrorKind::ResourceContentionFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::resource_contention_fault::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_resource_contention_fault_xml_err(response.body().as_ref(), output).map_err(crate::error::PutScalingPolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceLinkedRoleFailure" => crate::error::PutScalingPolicyError {
meta: generic,
kind: crate::error::PutScalingPolicyErrorKind::ServiceLinkedRoleFailure({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::service_linked_role_failure::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_service_linked_role_failure_xml_err(response.body().as_ref(), output).map_err(crate::error::PutScalingPolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::PutScalingPolicyError::generic(generic),
})
}sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the PutScalingPolicyError::Unhandled variant from a aws_smithy_types::Error.
Examples found in repository?
src/operation_deser.rs (line 3563)
3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565
pub fn parse_put_scaling_policy_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::PutScalingPolicyOutput, crate::error::PutScalingPolicyError>
{
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::PutScalingPolicyError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::PutScalingPolicyError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"LimitExceeded" => {
crate::error::PutScalingPolicyError {
meta: generic,
kind: crate::error::PutScalingPolicyErrorKind::LimitExceededFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::limit_exceeded_fault::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_limit_exceeded_fault_xml_err(response.body().as_ref(), output).map_err(crate::error::PutScalingPolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
}
}
"ResourceContention" => crate::error::PutScalingPolicyError {
meta: generic,
kind: crate::error::PutScalingPolicyErrorKind::ResourceContentionFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::resource_contention_fault::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_resource_contention_fault_xml_err(response.body().as_ref(), output).map_err(crate::error::PutScalingPolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ServiceLinkedRoleFailure" => crate::error::PutScalingPolicyError {
meta: generic,
kind: crate::error::PutScalingPolicyErrorKind::ServiceLinkedRoleFailure({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::service_linked_role_failure::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_service_linked_role_failure_xml_err(response.body().as_ref(), output).map_err(crate::error::PutScalingPolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::PutScalingPolicyError::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_limit_exceeded_fault(&self) -> bool
pub fn is_limit_exceeded_fault(&self) -> bool
Returns true if the error kind is PutScalingPolicyErrorKind::LimitExceededFault.
sourcepub fn is_resource_contention_fault(&self) -> bool
pub fn is_resource_contention_fault(&self) -> bool
Returns true if the error kind is PutScalingPolicyErrorKind::ResourceContentionFault.
sourcepub fn is_service_linked_role_failure(&self) -> bool
pub fn is_service_linked_role_failure(&self) -> bool
Returns true if the error kind is PutScalingPolicyErrorKind::ServiceLinkedRoleFailure.
Trait Implementations§
source§impl Debug for PutScalingPolicyError
impl Debug for PutScalingPolicyError
source§impl Display for PutScalingPolicyError
impl Display for PutScalingPolicyError
source§impl Error for PutScalingPolicyError
impl Error for PutScalingPolicyError
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<PutScalingPolicyError> for Error
impl From<PutScalingPolicyError> for Error
source§fn from(err: PutScalingPolicyError) -> Self
fn from(err: PutScalingPolicyError) -> Self
Converts to this type from the input type.