1from moto.core.exceptions import JsonRESTError
2
3
4class SecretsManagerClientError(JsonRESTError):
5    code = 400
6
7
8class ResourceNotFoundException(SecretsManagerClientError):
9    def __init__(self, message):
10        self.code = 404
11        super(ResourceNotFoundException, self).__init__(
12            "ResourceNotFoundException", message
13        )
14
15
16class SecretNotFoundException(SecretsManagerClientError):
17    def __init__(self):
18        self.code = 404
19        super(SecretNotFoundException, self).__init__(
20            "ResourceNotFoundException",
21            message="Secrets Manager can't find the specified secret.",
22        )
23
24
25class SecretHasNoValueException(SecretsManagerClientError):
26    def __init__(self, version_stage):
27        self.code = 404
28        super(SecretHasNoValueException, self).__init__(
29            "ResourceNotFoundException",
30            message="Secrets Manager can't find the specified secret "
31            "value for staging label: {}".format(version_stage),
32        )
33
34
35class ClientError(SecretsManagerClientError):
36    def __init__(self, message):
37        super(ClientError, self).__init__("InvalidParameterValue", message)
38
39
40class InvalidParameterException(SecretsManagerClientError):
41    def __init__(self, message):
42        super(InvalidParameterException, self).__init__(
43            "InvalidParameterException", message
44        )
45
46
47class ResourceExistsException(SecretsManagerClientError):
48    def __init__(self, message):
49        super(ResourceExistsException, self).__init__(
50            "ResourceExistsException", message
51        )
52
53
54class InvalidRequestException(SecretsManagerClientError):
55    def __init__(self, message):
56        super(InvalidRequestException, self).__init__(
57            "InvalidRequestException", message
58        )
59
60
61class ValidationException(SecretsManagerClientError):
62    def __init__(self, message):
63        super(ValidationException, self).__init__("ValidationException", message)
64