Struct aws_sdk_cloudfront::error::CreateCachePolicyError
source · #[non_exhaustive]pub struct CreateCachePolicyError {
pub kind: CreateCachePolicyErrorKind,
/* private fields */
}
Expand description
Error type for the CreateCachePolicy
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: CreateCachePolicyErrorKind
Kind of error that occurred.
Implementations§
source§impl CreateCachePolicyError
impl CreateCachePolicyError
sourcepub fn new(kind: CreateCachePolicyErrorKind, meta: Error) -> Self
pub fn new(kind: CreateCachePolicyErrorKind, meta: Error) -> Self
Creates a new CreateCachePolicyError
.
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 CreateCachePolicyError::Unhandled
variant from any error type.
Examples found in repository?
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
pub fn parse_create_cache_policy_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::CreateCachePolicyOutput, crate::error::CreateCachePolicyError>
{
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::CreateCachePolicyError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::CreateCachePolicyError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDenied" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"CachePolicyAlreadyExists" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InconsistentQuantities" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidArgument" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyCachePolicies" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::TooManyCachePolicies({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::too_many_cache_policies::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_too_many_cache_policies_xml_err(response.body().as_ref(), output).map_err(crate::error::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyCookiesInCachePolicy" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyHeadersInCachePolicy" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyQueryStringsInCachePolicy" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::CreateCachePolicyError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn parse_create_cache_policy_response(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::CreateCachePolicyOutput, crate::error::CreateCachePolicyError>
{
Ok({
#[allow(unused_mut)]
let mut output = crate::output::create_cache_policy_output::Builder::default();
let _ = response;
output = output.set_cache_policy(
crate::http_serde::deser_payload_create_cache_policy_create_cache_policy_output_cache_policy(response.body().as_ref())?
);
output = output.set_e_tag(
crate::http_serde::deser_header_create_cache_policy_create_cache_policy_output_e_tag(
response.headers(),
)
.map_err(|_| {
crate::error::CreateCachePolicyError::unhandled(
"Failed to parse ETag from header `ETag",
)
})?,
);
output = output.set_location(
crate::http_serde::deser_header_create_cache_policy_create_cache_policy_output_location(response.headers())
.map_err(|_|crate::error::CreateCachePolicyError::unhandled("Failed to parse Location from header `Location"))?
);
output.build()
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the CreateCachePolicyError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
pub fn parse_create_cache_policy_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::CreateCachePolicyOutput, crate::error::CreateCachePolicyError>
{
let generic = crate::xml_deser::parse_http_generic_error(response)
.map_err(crate::error::CreateCachePolicyError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::CreateCachePolicyError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDenied" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"CachePolicyAlreadyExists" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InconsistentQuantities" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidArgument" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyCachePolicies" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::TooManyCachePolicies({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::too_many_cache_policies::Builder::default();
let _ = response;
output = crate::xml_deser::deser_structure_crate_error_too_many_cache_policies_xml_err(response.body().as_ref(), output).map_err(crate::error::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyCookiesInCachePolicy" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyHeadersInCachePolicy" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"TooManyQueryStringsInCachePolicy" => crate::error::CreateCachePolicyError {
meta: generic,
kind: crate::error::CreateCachePolicyErrorKind::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::CreateCachePolicyError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::CreateCachePolicyError::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 CreateCachePolicyErrorKind::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 CreateCachePolicyErrorKind::CachePolicyAlreadyExists
.
sourcepub fn is_inconsistent_quantities(&self) -> bool
pub fn is_inconsistent_quantities(&self) -> bool
Returns true
if the error kind is CreateCachePolicyErrorKind::InconsistentQuantities
.
sourcepub fn is_invalid_argument(&self) -> bool
pub fn is_invalid_argument(&self) -> bool
Returns true
if the error kind is CreateCachePolicyErrorKind::InvalidArgument
.
sourcepub fn is_too_many_cache_policies(&self) -> bool
pub fn is_too_many_cache_policies(&self) -> bool
Returns true
if the error kind is CreateCachePolicyErrorKind::TooManyCachePolicies
.
Returns true
if the error kind is CreateCachePolicyErrorKind::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 CreateCachePolicyErrorKind::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 CreateCachePolicyErrorKind::TooManyQueryStringsInCachePolicy
.