2018-07-14 00:39:19 -07:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
from moto.core.exceptions import JsonRESTError
|
|
|
|
|
|
|
|
|
|
|
|
class SecretsManagerClientError(JsonRESTError):
|
|
|
|
code = 400
|
|
|
|
|
|
|
|
|
|
|
|
class ResourceNotFoundException(SecretsManagerClientError):
|
2019-10-15 21:57:16 +11:00
|
|
|
def __init__(self, message):
|
2018-07-14 00:39:19 -07:00
|
|
|
self.code = 404
|
|
|
|
super(ResourceNotFoundException, self).__init__(
|
2019-10-31 08:44:26 -07:00
|
|
|
"ResourceNotFoundException", message
|
2018-07-14 00:39:19 -07:00
|
|
|
)
|
2018-07-16 12:39:59 -07:00
|
|
|
|
|
|
|
|
2019-10-18 10:09:16 +11:00
|
|
|
class SecretNotFoundException(SecretsManagerClientError):
|
|
|
|
def __init__(self):
|
|
|
|
self.code = 404
|
|
|
|
super(SecretNotFoundException, self).__init__(
|
|
|
|
"ResourceNotFoundException",
|
2019-11-12 10:01:12 +11:00
|
|
|
message="Secrets Manager can't find the specified secret.",
|
2019-10-18 10:09:16 +11:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2019-10-18 12:06:12 +11:00
|
|
|
class SecretHasNoValueException(SecretsManagerClientError):
|
|
|
|
def __init__(self, version_stage):
|
|
|
|
self.code = 404
|
|
|
|
super(SecretHasNoValueException, self).__init__(
|
|
|
|
"ResourceNotFoundException",
|
2019-11-12 10:01:12 +11:00
|
|
|
message="Secrets Manager can't find the specified secret "
|
2019-10-31 08:44:26 -07:00
|
|
|
"value for staging label: {}".format(version_stage),
|
2019-10-18 12:06:12 +11:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2018-07-16 12:39:59 -07:00
|
|
|
class ClientError(SecretsManagerClientError):
|
|
|
|
def __init__(self, message):
|
2019-10-31 08:44:26 -07:00
|
|
|
super(ClientError, self).__init__("InvalidParameterValue", message)
|
2018-07-16 12:39:59 -07:00
|
|
|
|
|
|
|
|
|
|
|
class InvalidParameterException(SecretsManagerClientError):
|
|
|
|
def __init__(self, message):
|
|
|
|
super(InvalidParameterException, self).__init__(
|
2019-10-31 08:44:26 -07:00
|
|
|
"InvalidParameterException", message
|
|
|
|
)
|
2019-04-18 12:58:50 +01:00
|
|
|
|
|
|
|
|
2019-05-22 05:45:22 -04:00
|
|
|
class ResourceExistsException(SecretsManagerClientError):
|
|
|
|
def __init__(self, message):
|
|
|
|
super(ResourceExistsException, self).__init__(
|
2019-10-31 08:44:26 -07:00
|
|
|
"ResourceExistsException", message
|
2019-05-22 05:45:22 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2019-04-18 12:58:50 +01:00
|
|
|
class InvalidRequestException(SecretsManagerClientError):
|
|
|
|
def __init__(self, message):
|
|
|
|
super(InvalidRequestException, self).__init__(
|
2019-10-31 08:44:26 -07:00
|
|
|
"InvalidRequestException", message
|
|
|
|
)
|
2020-07-31 15:31:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ValidationException(SecretsManagerClientError):
|
|
|
|
def __init__(self, message):
|
|
|
|
super(ValidationException, self).__init__("ValidationException", message)
|