2017-11-10 18:44:02 +09:00
|
|
|
from __future__ import unicode_literals
|
2017-11-13 17:54:10 +09:00
|
|
|
from moto.core.exceptions import JsonRESTError
|
2017-11-10 18:44:02 +09:00
|
|
|
|
|
|
|
|
2017-11-13 17:54:10 +09:00
|
|
|
class IoTClientError(JsonRESTError):
|
2017-11-10 18:44:02 +09:00
|
|
|
code = 400
|
|
|
|
|
|
|
|
|
|
|
|
class ResourceNotFoundException(IoTClientError):
|
|
|
|
def __init__(self):
|
2017-11-13 17:54:10 +09:00
|
|
|
self.code = 404
|
2017-11-10 18:44:02 +09:00
|
|
|
super(ResourceNotFoundException, self).__init__(
|
2019-10-31 08:44:26 -07:00
|
|
|
"ResourceNotFoundException", "The specified resource does not exist"
|
2017-11-10 18:44:02 +09:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class InvalidRequestException(IoTClientError):
|
2018-01-04 18:59:37 +09:00
|
|
|
def __init__(self, msg=None):
|
2017-11-10 18:44:02 +09:00
|
|
|
self.code = 400
|
|
|
|
super(InvalidRequestException, self).__init__(
|
2019-10-31 08:44:26 -07:00
|
|
|
"InvalidRequestException", msg or "The request is not valid."
|
2018-01-04 18:59:37 +09:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2019-04-29 13:26:33 +02:00
|
|
|
class InvalidStateTransitionException(IoTClientError):
|
|
|
|
def __init__(self, msg=None):
|
|
|
|
self.code = 409
|
|
|
|
super(InvalidStateTransitionException, self).__init__(
|
|
|
|
"InvalidStateTransitionException",
|
2019-12-23 09:01:53 +01:00
|
|
|
msg or "An attempt was made to change to an invalid state.",
|
2019-04-29 13:26:33 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2018-01-04 18:59:37 +09:00
|
|
|
class VersionConflictException(IoTClientError):
|
|
|
|
def __init__(self, name):
|
|
|
|
self.code = 409
|
|
|
|
super(VersionConflictException, self).__init__(
|
2019-10-31 08:44:26 -07:00
|
|
|
"VersionConflictException",
|
|
|
|
"The version for thing %s does not match the expected version." % name,
|
2017-11-10 18:44:02 +09:00
|
|
|
)
|
2018-10-30 14:38:59 +09:00
|
|
|
|
|
|
|
|
|
|
|
class CertificateStateException(IoTClientError):
|
|
|
|
def __init__(self, msg, cert_id):
|
|
|
|
self.code = 406
|
|
|
|
super(CertificateStateException, self).__init__(
|
2019-10-31 08:44:26 -07:00
|
|
|
"CertificateStateException", "%s Id: %s" % (msg, cert_id)
|
2018-10-30 14:38:59 +09:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class DeleteConflictException(IoTClientError):
|
|
|
|
def __init__(self, msg):
|
|
|
|
self.code = 409
|
2019-10-31 08:44:26 -07:00
|
|
|
super(DeleteConflictException, self).__init__("DeleteConflictException", msg)
|