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 (148 lines) | stat: -rw-r--r-- 3,795 bytes parent folder | download | duplicates (2)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
from moto.core.exceptions import JsonRESTError


class AccountAlreadyRegisteredException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "AccountAlreadyRegisteredException",
            "The provided account is already a delegated administrator for your organization.",
        )


class AccountAlreadyClosedException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "AccountAlreadyClosedException",
            "The provided account is already closed.",
        )


class AccountNotRegisteredException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "AccountNotRegisteredException",
            "The provided account is not a registered delegated administrator for your organization.",
        )


class AccountNotFoundException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "AccountNotFoundException", "You specified an account that doesn't exist."
        )


class AlreadyInOrganizationException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "AlreadyInOrganizationException",
            "The provided account is already a member of an organization.",
        )


class AWSOrganizationsNotInUseException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "AWSOrganizationsNotInUseException",
            "Your account is not a member of an organization.",
        )


class ConstraintViolationException(JsonRESTError):
    code = 400

    def __init__(self, message: str):
        super().__init__("ConstraintViolationException", message)


class InvalidInputException(JsonRESTError):
    code = 400

    def __init__(self, message: str):
        super().__init__("InvalidInputException", message)


class DuplicateOrganizationalUnitException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "DuplicateOrganizationalUnitException",
            "An OU with the same name already exists.",
        )


class DuplicatePolicyException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "DuplicatePolicyException", "A policy with the same name already exists."
        )


class OrganizationNotEmptyException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "OrganizationNotEmptyException",
            "To delete an organization you must first remove all member accounts (except the master).",
        )


class PolicyTypeAlreadyEnabledException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "PolicyTypeAlreadyEnabledException",
            "The specified policy type is already enabled.",
        )


class PolicyTypeNotEnabledException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "PolicyTypeNotEnabledException",
            "This operation can be performed only for enabled policy types.",
        )


class RootNotFoundException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "RootNotFoundException", "You specified a root that doesn't exist."
        )


class TargetNotFoundException(JsonRESTError):
    code = 400

    def __init__(self) -> None:
        super().__init__(
            "TargetNotFoundException", "You specified a target that doesn't exist."
        )


class PolicyNotFoundException(JsonRESTError):
    code = 400

    def __init__(self, message: str) -> None:
        super().__init__("PolicyNotFoundException", message)