File: exceptions.py

package info (click to toggle)
python-moto 5.1.18-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 116,520 kB
  • sloc: python: 636,725; javascript: 181; makefile: 39; sh: 3
file content (62 lines) | stat: -rw-r--r-- 1,915 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""Exceptions raised by the acmpca service."""

from moto.core.exceptions import JsonRESTError


class ResourceNotFoundException(JsonRESTError):
    def __init__(self, arn: str):
        super().__init__("ResourceNotFoundException", f"Resource {arn} not found")


class InvalidS3ObjectAclInCrlConfiguration(JsonRESTError):
    code = 400

    def __init__(self, value: str):
        super().__init__(
            "InvalidS3ObjectAclInCrlConfiguration",
            f"Invalid value for parameter RevocationConfiguration.CrlConfiguration.S3ObjectAcl, value: {value}, valid values: ['PUBLIC_READ', 'BUCKET_OWNER_FULL_CONTROL']",
        )


class InvalidStateException(JsonRESTError):
    code = 400

    def __init__(self, arn: str):
        super().__init__(
            "InvalidStateException",
            f"The certificate authority {arn} is not in the correct state to have a certificate signing request.",
        )


class MalformedCertificateAuthorityException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "MalformedCertificateAuthorityException",
            "Malformed certificate.",
        )


class InvalidPolicyException(JsonRESTError):
    def __init__(self) -> None:
        super().__init__(
            "InvalidPolicyException",
            "The resource policy is invalid or is missing a required statement.",
        )


class LockoutPreventedException(JsonRESTError):
    def __init__(self) -> None:
        super().__init__(
            "LockoutPreventedException",
            "The current action was prevented because it would lock the caller out from performing subsequent actions.",
        )


class ConcurrentModificationException(JsonRESTError):
    def __init__(self) -> None:
        super().__init__(
            "ConcurrentModificationException",
            "A previous update to your private CA is still ongoing.",
        )