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 (51 lines) | stat: -rw-r--r-- 1,616 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
from typing import Optional

from moto.core.exceptions import JsonRESTError


class WAFv2ClientError(JsonRESTError):
    code = 400


class WAFV2DuplicateItemException(WAFv2ClientError):
    def __init__(self) -> None:
        super().__init__(
            "WafV2DuplicateItem",
            "AWS WAF could not perform the operation because some resource in your request is a duplicate of an existing one.",
        )


class WAFV2InsufficientInformationException(WAFv2ClientError):
    def __init__(
        self,
        name: Optional[str],
        scope: Optional[str],
        id: Optional[str],
        arn: Optional[str],
    ) -> None:
        super().__init__(
            "AcessDeniedException",
            (
                "Critical information is missing in your request: "
                f"GetRuleGroupRequest(name={name if name else 'null'}, "
                f"scope={scope if scope else 'null'}, "
                f"id={id if id else 'null'}, "
                f"aRN={arn if arn is not None else 'null'})."
            ),
        )


class WAFNonexistentItemException(WAFv2ClientError):
    def __init__(self) -> None:
        super().__init__(
            "WAFNonexistentItemException",
            "AWS WAF couldn’t perform the operation because your resource doesn’t exist.",
        )


class WAFOptimisticLockException(WAFv2ClientError):
    def __init__(self) -> None:
        super().__init__(
            "WAFOptimisticLockException",
            "AWS WAF couldn’t save your changes because someone changed the resource after you started to edit it. Reapply your changes.",
        )