2018-06-01 03:05:50 +00:00
|
|
|
from moto.core.exceptions import RESTError
|
2014-11-15 14:35:52 +00:00
|
|
|
|
|
|
|
|
2019-10-27 11:46:59 +00:00
|
|
|
class ReceiptHandleIsInvalid(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self) -> None:
|
2022-01-14 19:51:49 +00:00
|
|
|
super().__init__(
|
2019-10-27 11:46:59 +00:00
|
|
|
"ReceiptHandleIsInvalid", "The input receipt handle is invalid."
|
|
|
|
)
|
2014-09-28 19:59:14 +00:00
|
|
|
|
|
|
|
|
2020-07-28 13:34:26 +00:00
|
|
|
class MessageAttributesInvalid(RESTError):
|
|
|
|
code = 400
|
2014-09-28 19:59:14 +00:00
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self, description: str):
|
2022-01-14 19:51:49 +00:00
|
|
|
super().__init__("MessageAttributesInvalid", description)
|
2017-10-10 19:51:48 +00:00
|
|
|
|
|
|
|
|
2019-10-18 07:04:29 +00:00
|
|
|
class QueueDoesNotExist(RESTError):
|
2021-08-26 15:23:17 +00:00
|
|
|
code = 400
|
2019-10-18 07:04:29 +00:00
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self) -> None:
|
2021-08-26 15:23:17 +00:00
|
|
|
super().__init__(
|
|
|
|
"AWS.SimpleQueueService.NonExistentQueue",
|
2019-10-18 07:04:29 +00:00
|
|
|
"The specified queue does not exist for this wsdl version.",
|
2021-08-26 15:23:17 +00:00
|
|
|
template="wrapped_single_error",
|
2019-10-18 07:04:29 +00:00
|
|
|
)
|
2018-06-01 03:05:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
class QueueAlreadyExists(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self, message: str):
|
2022-01-14 19:51:49 +00:00
|
|
|
super().__init__("QueueAlreadyExists", message)
|
2019-10-26 20:08:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
class EmptyBatchRequest(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self) -> None:
|
2022-01-14 19:51:49 +00:00
|
|
|
super().__init__(
|
2019-10-26 20:08:45 +00:00
|
|
|
"EmptyBatchRequest",
|
|
|
|
"There should be at least one SendMessageBatchRequestEntry in the request.",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class InvalidBatchEntryId(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self) -> None:
|
2022-01-14 19:51:49 +00:00
|
|
|
super().__init__(
|
2019-10-26 20:08:45 +00:00
|
|
|
"InvalidBatchEntryId",
|
|
|
|
"A batch entry id can only contain alphanumeric characters, "
|
|
|
|
"hyphens and underscores. It can be at most 80 letters long.",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class BatchRequestTooLong(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self, length: int):
|
2022-01-14 19:51:49 +00:00
|
|
|
super().__init__(
|
2019-10-26 20:08:45 +00:00
|
|
|
"BatchRequestTooLong",
|
|
|
|
"Batch requests cannot be longer than 262144 bytes. "
|
2022-11-21 19:21:34 +00:00
|
|
|
f"You have sent {length} bytes.",
|
2019-10-26 20:08:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class BatchEntryIdsNotDistinct(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self, entry_id: str):
|
2022-11-21 19:21:34 +00:00
|
|
|
super().__init__("BatchEntryIdsNotDistinct", f"Id {entry_id} repeated.")
|
2019-10-26 20:08:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TooManyEntriesInBatchRequest(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self, number: int):
|
2022-01-14 19:51:49 +00:00
|
|
|
super().__init__(
|
2019-10-26 20:08:45 +00:00
|
|
|
"TooManyEntriesInBatchRequest",
|
2022-11-21 19:21:34 +00:00
|
|
|
"Maximum number of entries per request are 10. " f"You have sent {number}.",
|
2019-10-26 20:08:45 +00:00
|
|
|
)
|
2019-10-27 11:13:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
class InvalidAttributeName(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self, attribute_name: str):
|
2022-11-21 19:21:34 +00:00
|
|
|
super().__init__("InvalidAttributeName", f"Unknown Attribute {attribute_name}.")
|
2020-01-30 21:42:27 +00:00
|
|
|
|
|
|
|
|
2020-10-10 16:54:36 +00:00
|
|
|
class InvalidAttributeValue(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self, attribute_name: str):
|
2022-01-14 19:51:49 +00:00
|
|
|
super().__init__(
|
2020-10-10 16:54:36 +00:00
|
|
|
"InvalidAttributeValue",
|
2022-11-21 19:21:34 +00:00
|
|
|
f"Invalid value for the parameter {attribute_name}.",
|
2020-10-10 16:54:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-01-30 21:42:27 +00:00
|
|
|
class InvalidParameterValue(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self, message: str):
|
2022-01-14 19:51:49 +00:00
|
|
|
super().__init__("InvalidParameterValue", message)
|
2020-01-30 21:42:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
class MissingParameter(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self, parameter: str):
|
2022-01-14 19:51:49 +00:00
|
|
|
super().__init__(
|
2022-11-21 19:21:34 +00:00
|
|
|
"MissingParameter", f"The request must contain the parameter {parameter}."
|
2020-01-30 21:42:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class OverLimit(RESTError):
|
|
|
|
code = 403
|
|
|
|
|
2023-04-24 16:46:01 +00:00
|
|
|
def __init__(self, count: int):
|
2022-01-14 19:51:49 +00:00
|
|
|
super().__init__(
|
2022-11-21 19:21:34 +00:00
|
|
|
"OverLimit", f"{count} Actions were found, maximum allowed is 7."
|
2020-01-30 21:42:27 +00:00
|
|
|
)
|