#[non_exhaustive]pub struct CreateOriginAccessControlError {
pub kind: CreateOriginAccessControlErrorKind,
/* private fields */
}
Expand description
Error type for the CreateOriginAccessControl
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: CreateOriginAccessControlErrorKind
Kind of error that occurred.
Implementations§
source§impl CreateOriginAccessControlError
impl CreateOriginAccessControlError
sourcepub fn new(kind: CreateOriginAccessControlErrorKind, meta: Error) -> Self
pub fn new(kind: CreateOriginAccessControlErrorKind, meta: Error) -> Self
Creates a new CreateOriginAccessControlError
.
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 CreateOriginAccessControlError::Unhandled
variant from any error type.
Examples found in repository?
src/operation_deser.rs (lines 3186-3188)
3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281
pub fn parse_create_origin_access_control_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::output::CreateOriginAccessControlOutput,
crate::error::CreateOriginAccessControlError,
> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::CreateOriginAccessControlError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => {
return Err(crate::error::CreateOriginAccessControlError::unhandled(
generic,
))
}
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InvalidArgument" => crate::error::CreateOriginAccessControlError {
meta: generic,
kind: crate::error::CreateOriginAccessControlErrorKind::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::CreateOriginAccessControlError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"OriginAccessControlAlreadyExists" => crate::error::CreateOriginAccessControlError {
meta: generic,
kind:
crate::error::CreateOriginAccessControlErrorKind::OriginAccessControlAlreadyExists(
{
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]let mut output = crate::error::origin_access_control_already_exists::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_origin_access_control_already_exists_xml_err(response.body().as_ref(), output).map_err(crate::error::CreateOriginAccessControlError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
},
),
},
"TooManyOriginAccessControls" => crate::error::CreateOriginAccessControlError {
meta: generic,
kind: crate::error::CreateOriginAccessControlErrorKind::TooManyOriginAccessControls({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::too_many_origin_access_controls::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_too_many_origin_access_controls_xml_err(response.body().as_ref(), output).map_err(crate::error::CreateOriginAccessControlError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::CreateOriginAccessControlError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn parse_create_origin_access_control_response(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::output::CreateOriginAccessControlOutput,
crate::error::CreateOriginAccessControlError,
> {
Ok({
#[allow(unused_mut)]
let mut output = crate::output::create_origin_access_control_output::Builder::default();
let _ = response;
output = output.set_e_tag(
crate::http_serde::deser_header_create_origin_access_control_create_origin_access_control_output_e_tag(response.headers())
.map_err(|_|crate::error::CreateOriginAccessControlError::unhandled("Failed to parse ETag from header `ETag"))?
);
output = output.set_location(
crate::http_serde::deser_header_create_origin_access_control_create_origin_access_control_output_location(response.headers())
.map_err(|_|crate::error::CreateOriginAccessControlError::unhandled("Failed to parse Location from header `Location"))?
);
output = output.set_origin_access_control(
crate::http_serde::deser_payload_create_origin_access_control_create_origin_access_control_output_origin_access_control(response.body().as_ref())?
);
output.build()
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the CreateOriginAccessControlError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
src/operation_deser.rs (line 3253)
3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255
pub fn parse_create_origin_access_control_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::output::CreateOriginAccessControlOutput,
crate::error::CreateOriginAccessControlError,
> {
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::CreateOriginAccessControlError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => {
return Err(crate::error::CreateOriginAccessControlError::unhandled(
generic,
))
}
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InvalidArgument" => crate::error::CreateOriginAccessControlError {
meta: generic,
kind: crate::error::CreateOriginAccessControlErrorKind::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::CreateOriginAccessControlError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"OriginAccessControlAlreadyExists" => crate::error::CreateOriginAccessControlError {
meta: generic,
kind:
crate::error::CreateOriginAccessControlErrorKind::OriginAccessControlAlreadyExists(
{
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]let mut output = crate::error::origin_access_control_already_exists::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_origin_access_control_already_exists_xml_err(response.body().as_ref(), output).map_err(crate::error::CreateOriginAccessControlError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
},
),
},
"TooManyOriginAccessControls" => crate::error::CreateOriginAccessControlError {
meta: generic,
kind: crate::error::CreateOriginAccessControlErrorKind::TooManyOriginAccessControls({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::too_many_origin_access_controls::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_too_many_origin_access_controls_xml_err(response.body().as_ref(), output).map_err(crate::error::CreateOriginAccessControlError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::CreateOriginAccessControlError::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_invalid_argument(&self) -> bool
pub fn is_invalid_argument(&self) -> bool
Returns true
if the error kind is CreateOriginAccessControlErrorKind::InvalidArgument
.
sourcepub fn is_origin_access_control_already_exists(&self) -> bool
pub fn is_origin_access_control_already_exists(&self) -> bool
Returns true
if the error kind is CreateOriginAccessControlErrorKind::OriginAccessControlAlreadyExists
.
sourcepub fn is_too_many_origin_access_controls(&self) -> bool
pub fn is_too_many_origin_access_controls(&self) -> bool
Returns true
if the error kind is CreateOriginAccessControlErrorKind::TooManyOriginAccessControls
.
Trait Implementations§
source§impl Error for CreateOriginAccessControlError
impl Error for CreateOriginAccessControlError
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<CreateOriginAccessControlError> for Error
impl From<CreateOriginAccessControlError> for Error
source§fn from(err: CreateOriginAccessControlError) -> Self
fn from(err: CreateOriginAccessControlError) -> Self
Converts to this type from the input type.