2023-04-26 14:25:00 +00:00
|
|
|
from typing import Any, Optional
|
2015-03-14 09:06:31 -04:00
|
|
|
from moto.core.exceptions import RESTError
|
|
|
|
|
|
|
|
|
|
|
2022-02-21 21:01:38 -01:00
|
|
|
class SNSException(RESTError):
|
2023-04-26 14:25:00 +00:00
|
|
|
def __init__(self, *args: Any, **kwargs: Any):
|
2022-02-21 21:01:38 -01:00
|
|
|
kwargs["template"] = "wrapped_single_error"
|
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SNSNotFoundError(SNSException):
|
2015-03-14 09:06:31 -04:00
|
|
|
code = 404
|
|
|
|
|
|
2023-04-26 14:25:00 +00:00
|
|
|
def __init__(self, message: str, template: Optional[str] = None):
|
|
|
|
|
super().__init__("NotFound", message, template=template)
|
2017-03-16 22:28:30 -04:00
|
|
|
|
|
|
|
|
|
2022-01-06 22:09:16 -01:00
|
|
|
class TopicNotFound(SNSNotFoundError):
|
2023-04-26 14:25:00 +00:00
|
|
|
def __init__(self) -> None:
|
2022-01-06 22:09:16 -01:00
|
|
|
super().__init__(message="Topic does not exist")
|
|
|
|
|
|
|
|
|
|
|
2022-02-21 21:01:38 -01:00
|
|
|
class ResourceNotFoundError(SNSException):
|
2019-10-12 20:36:15 +02:00
|
|
|
code = 404
|
|
|
|
|
|
2023-04-26 14:25:00 +00:00
|
|
|
def __init__(self) -> None:
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("ResourceNotFound", "Resource does not exist")
|
2019-10-12 20:36:15 +02:00
|
|
|
|
|
|
|
|
|
2022-02-21 21:01:38 -01:00
|
|
|
class DuplicateSnsEndpointError(SNSException):
|
2017-03-16 22:28:30 -04:00
|
|
|
code = 400
|
|
|
|
|
|
2023-04-26 14:25:00 +00:00
|
|
|
def __init__(self, message: str):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("DuplicateEndpoint", message)
|
2017-03-16 22:28:30 -04:00
|
|
|
|
|
|
|
|
|
2022-02-21 21:01:38 -01:00
|
|
|
class SnsEndpointDisabled(SNSException):
|
2017-03-16 22:28:30 -04:00
|
|
|
code = 400
|
|
|
|
|
|
2023-04-26 14:25:00 +00:00
|
|
|
def __init__(self, message: str):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("EndpointDisabled", message)
|
2017-09-08 03:19:34 +09:00
|
|
|
|
|
|
|
|
|
2022-02-21 21:01:38 -01:00
|
|
|
class SNSInvalidParameter(SNSException):
|
2017-09-08 03:19:34 +09:00
|
|
|
code = 400
|
|
|
|
|
|
2023-04-26 14:25:00 +00:00
|
|
|
def __init__(self, message: str):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("InvalidParameter", message)
|
2017-11-13 18:27:11 +00:00
|
|
|
|
|
|
|
|
|
2022-02-21 21:01:38 -01:00
|
|
|
class InvalidParameterValue(SNSException):
|
2017-11-13 18:27:11 +00:00
|
|
|
code = 400
|
|
|
|
|
|
2023-04-26 14:25:00 +00:00
|
|
|
def __init__(self, message: str):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("InvalidParameterValue", message)
|
2019-08-25 16:48:14 +02:00
|
|
|
|
|
|
|
|
|
2022-02-21 21:01:38 -01:00
|
|
|
class TagLimitExceededError(SNSException):
|
2019-10-12 20:36:15 +02:00
|
|
|
code = 400
|
|
|
|
|
|
2023-04-26 14:25:00 +00:00
|
|
|
def __init__(self) -> None:
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__(
|
2019-10-12 20:36:15 +02:00
|
|
|
"TagLimitExceeded",
|
|
|
|
|
"Could not complete request: tag quota of per resource exceeded",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2022-02-21 21:01:38 -01:00
|
|
|
class InternalError(SNSException):
|
2019-08-25 16:48:14 +02:00
|
|
|
code = 500
|
|
|
|
|
|
2023-04-26 14:25:00 +00:00
|
|
|
def __init__(self, message: str):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("InternalFailure", message)
|
2022-01-06 22:09:16 -01:00
|
|
|
|
|
|
|
|
|
2022-02-21 21:01:38 -01:00
|
|
|
class TooManyEntriesInBatchRequest(SNSException):
|
2022-01-06 22:09:16 -01:00
|
|
|
code = 400
|
|
|
|
|
|
2023-04-26 14:25:00 +00:00
|
|
|
def __init__(self) -> None:
|
2022-01-06 22:09:16 -01:00
|
|
|
super().__init__(
|
|
|
|
|
"TooManyEntriesInBatchRequest",
|
|
|
|
|
"The batch request contains more entries than permissible.",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2022-02-21 21:01:38 -01:00
|
|
|
class BatchEntryIdsNotDistinct(SNSException):
|
2022-01-06 22:09:16 -01:00
|
|
|
code = 400
|
|
|
|
|
|
2023-04-26 14:25:00 +00:00
|
|
|
def __init__(self) -> None:
|
2022-01-06 22:09:16 -01:00
|
|
|
super().__init__(
|
|
|
|
|
"BatchEntryIdsNotDistinct",
|
|
|
|
|
"Two or more batch entries in the request have the same Id.",
|
|
|
|
|
)
|